how the form is being skinned?

Master Zero

Well-known member
Joined
Sep 10, 2005
Messages
51
Programming Experience
Beginner
Good afternoon readers!

I have tried mercilessly all day to understand how this code works. I thought I understood it, but after so many attempts, I have finally giving up. Could anyone of you take a look at this example and explain it to me. I just want to know how the form is being skinned. Please...just break it down to only what’s necessary for me, then I can work my way from there. Thank you in advance!

http://www.codeproject.com/KB/miscctrl/taskbarnotifier.aspx
 
Last edited by a moderator:
1. You have an image with transparency (or a color mask used for transparency), this is set as background image.
2. that code checked all pixels in image, non transparent pixels were added to a GraphicsPath, then a new Region object was initialized from the GP and assigned the forms Region property.
3. other elements drawn to the form in Paint event, like button images and text at designated locations/rectangles.
4. mouse events used to hit-test if within the button rectangles and draw different button images (button regular/hover/pressed), and trigger button actions.

The simplest example of using Region property is this:
VB.NET:
Dim gp As New Drawing2D.GraphicsPath
gp.AddEllipse(Me.ClientRectangle)
Me.Region = New Region(gp)
 
A thousand thanks to you! Your example works great, I’ll use that as a base to try and add the background image next.
 
Back
Top