My problem is to show a rounded panel in my .NET application.
Using the CreateRoundRectRgn Method, the Panel can be created with rounded borders. But here the problem starts, making 2 Panels in 1 UserControl doesn´t work, only the last element is always drawn rounded.
Trying to round just one panel works, but when clicking on the sidebar button, the panel just pops up without showing the rest of the selected page. Hard to Explain, the following pictures should explain it better:
As you can see, the first figure shows the About page, by clicking in the navigation panel to About the panel with the picture should get rounded and also the remaining part of the page should appear. But the only thing which happens is that the panel get rounded and then only this panel is shown...
CODE:
System.IntPtr ptr = GUI.Resources.roundEdges.CreateRoundRectRgn(panel1.Location.X, panel1.Location.Y, panel1.Location.X + panel1.Width, panel1.Location.Y + panel1.Height, 10, 10); // _BoarderRaduis can be adjusted to your needs, try 15 to start.
this.Region = System.Drawing.Region.FromHrgn(ptr);
GUI.Resources.roundEdges.DeleteObject(ptr);
Doing that for two panels in one user control, doesnt work! Don´t know why... The internet gives nothing.......
public ucAbout()
{
InitializeComponent();
System.IntPtr ptr = GUI.Resources.roundEdges.CreateRoundRectRgn(0, 0, this.Width, this.Height, 10, 10);
this.Region = System.Drawing.Region.FromHrgn(ptr);
GUI.Resources.roundEdges.DeleteObject(ptr);
ptr = GUI.Resources.roundEdges.CreateRoundRectRgn(panel1.Location.X, panel1.Location.Y, panel1.Location.X + panel1.Width, panel1.Location.Y + panel1.Height, 10, 10);
this.Region = System.Drawing.Region.FromHrgn(ptr);
GUI.Resources.roundEdges.DeleteObject(ptr);
Refresh();
}
I´m not in the mode to use GIMP or PAINT to create this blue panel with rounded corners.. Maybe somebody can help..
Bunifu UI - This Framework is able to round multiple panels in one uc... Cannot use it...
I need help ;(