This is a migrated thread and some comments may be shown as answers.

Bevel effect like Delphi/BCB

3 Answers 106 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
shortie
Top achievements
Rank 2
shortie asked on 25 Dec 2008, 10:05 AM
Hello,

Today, one of my customers ask me to set the RadLabel to beveled (like the beveled label they see in Delphi or BCB).
Hornestly, I have no idea for that.
Any hint?
Thanks in advance.

BR/shortie

3 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 29 Dec 2008, 02:43 PM
Hello ChunChang,

Thank you for your question. Please review the following help topic from our documenation about BorderPrimitive customization options. We do not have bavel effect out of the box, but it can be achieved fairly easily, using the design time UI Element Editor option. Do not hesitate to write me back if you have more questions.

Sincerely yours,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chan
Top achievements
Rank 1
answered on 06 Jun 2013, 07:56 AM
Helo !

I need to display the RadListView items and groups with bevelled effect how can i achieve this.

The appearance of all Item and Groups must be bevelled.

I have a hint that there is something hidden in border primitive and gradient styles and gradient angle to achieve this but I am unable to figure out exact propety values for borders, gradient style, gradient angle.


thanks,

Chan
0
Ivan Petrov
Telerik team
answered on 11 Jun 2013, 07:27 AM
Hello Chan,

Thank you for writing.

To achieve a beveled rectangle you can create a custom shape inheriting from ElementShape. Here is an example:
public class BeveledShape : ElementShape
{
    private int width;
 
    public BeveledShape()
        : this(5)
    { }
 
    public BeveledShape(int width)
    {
        this.width = width;
    }
 
    public int Width
    {
        get { return width; }
        set { width = value; }
    }
 
    public override GraphicsPath CreatePath(Rectangle bounds)
    {
        GraphicsPath path = new GraphicsPath();
        path.AddLine(bounds.X + this.Width, bounds.Y, bounds.Right - this.Width, bounds.Y);
        path.AddLine(bounds.Right - this.Width, bounds.Y, bounds.Right, bounds.Y + this.Width);
        path.AddLine(bounds.Right, bounds.Y + this.Width, bounds.Right, bounds.Bottom - this.Width);
        path.AddLine(bounds.Right, bounds.Bottom - this.Width, bounds.Right - this.Width, bounds.Bottom);
        path.AddLine(bounds.Right - this.Width, bounds.Bottom, bounds.X + this.Width, bounds.Bottom);
        path.AddLine(bounds.X + this.Width, bounds.Bottom, bounds.X, bounds.Bottom - this.Width);
        path.AddLine(bounds.X, bounds.Bottom - this.Width, bounds.X, bounds.Y + this.Width);
        path.AddLine(bounds.X, bounds.Y + this.Width, bounds.X, bounds.Y + this.Width);
 
        return path;
    }
}

The you can use the VisualItemCreating event to apply it to all elements that are created:
this.radListView1.VisualItemCreating += radListView1_VisualItemCreating;
 
private void radListView1_VisualItemCreating(object sender, ListViewVisualItemCreatingEventArgs e)
{
    e.VisualItem.Shape = new BeveledShape();
}

I hope this will be useful. Should you have further questions, I would be glad to help.

Regards,
Ivan Petrov
Telerik
RadChart for WinForms is obsolete. Now what?
Tags
General Discussions
Asked by
shortie
Top achievements
Rank 2
Answers by
Nick
Telerik team
Chan
Top achievements
Rank 1
Ivan Petrov
Telerik team
Share this question
or