Unplanned
Last Updated: 30 Mar 2016 14:19 by ADMIN
ADMIN
Stefan
Created on: 12 Feb 2014 14:32
Category: Buttons
Type: Bug Report
1
FIX. RadButton - setting a shape has no effect on the image if it is set
To reproduce:


Add a RadButton to a form. Set an image, remove the text and set the shape of the ButtonElement to a new RoundRectShape. You will see that the image will not be painted with a shape.


Workaround:


Paint the image manually:


Image img = Image.FromFile(@"jpg.jpg");
RoundRectShape shape1 = new RoundRectShape(10);


protected override void OnLoad(EventArgs e)
{
    this.button = new RadButton();
    this.button.Parent = this;
    this.button.ButtonElement.Shape = shape1;
    this.button.Paint += button_Paint;
}


void button_Paint(object sender, PaintEventArgs e)
{
    e.Graphics.SetClip(shape1.CreatePath(new Rectangle(Point.Empty, this.button.Size)));
    e.Graphics.DrawImage(img, new Rectangle(Point.Empty, this.button.Size));
}
0 comments