I have the rounded panel (pic.1). When I add the picture of a background, curves vanish (pic.2). How to solve a problem?
4 Answers, 1 is accepted
0
Aleksej
Top achievements
Rank 1
answered on 22 Sep 2014, 01:30 PM
Up!
0
Hi Aleksej,
Thank you for writing.
Here is a sample implementation of an element with clipped image, which you can host in RadPanel. I hope that you find it useful.
Regards,
Stefan
Telerik
Thank you for writing.
Here is a sample implementation of an element with clipped image, which you can host in RadPanel. I hope that you find it useful.
protected
override
void
OnLoad(EventArgs e)
{
base
.OnLoad(e);
InitializeComponent();
RadPanel panel =
new
RadPanel();
panel.Size =
new
System.Drawing.Size(302, 302);
panel.Parent =
this
;
panel.PanelElement.PanelBorder.ForeColor = Color.Red;
panel.PanelElement.PanelBorder.BorderThickness =
new
Padding(3);
panel.PanelElement.Shape =
new
RoundRectShape(45);
MyElement imp =
new
MyElement();
imp.Image = Image.FromFile(@
"C:\Users\stefanov\Desktop\a.png"
);
imp.ImageLayout = ImageLayout.Tile;
imp.Shape = panel.PanelElement.Shape;
panel.PanelElement.Children.Add(imp);
}
class
MyElement : LightVisualElement
{
protected
override
void
PaintElement(Telerik.WinControls.Paint.IGraphics graphics,
float
angle, SizeF scale)
{
object
state = graphics.SaveState();
Graphics g = (graphics.UnderlayGraphics
as
Graphics);
Rectangle rect =
new
Rectangle(0, 0,
this
.Bounds.Width ,
this
.Bounds.Height );
g.SetClip(
this
.Shape.CreatePath(rect), CombineMode.Intersect);
base
.PaintElement(graphics, angle, scale);
graphics.RestoreState(state);
}
}
Regards,
Stefan
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Aleksej
Top achievements
Rank 1
answered on 23 Sep 2014, 06:22 AM
Thanks! And why not to realize it in RadPanel?
0
Hello,
We will consider it if we have more request for such functionality.
Regards,
Stefan
Telerik
We will consider it if we have more request for such functionality.
Regards,
Stefan
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.