|
-
Aug 14th, 2007, 08:24 PM
#1
Thread Starter
Junior Member
Re: rounded corners on form using transparency key, but opacity change ruins it!
 Originally Posted by VBDT
I am surprised how many people post questions that have the answers in the CodeBank of this forum. Check the link in my signature (Rounded-corner rectangles and controls). The code is written for you already  I hope it helps.
Thank you very much for all your replies.
fourblades, the link you posted was exactly what i did. This causes the corners to not be transparent when i change opacity during runtime.
VBDT, I tried pasting the code
Code:
'End moving code
'Draw a rounded rectangle in the forms paint event.
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
e.Graphics.DrawPath(Pens.Red, Shape.RoundedRectangle(New Rectangle(5, 5, 100, 100), 8))
End Sub
'Show the control on the form with rounded corners.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Panel1.Region = Shape.RoundedRegion(Panel1.Size, 10)
End Sub
but i get shape and panel 11 as undeclared. How can I fix this?
-
Aug 14th, 2007, 10:45 PM
#2
Re: rounded corners on form using transparency key, but opacity change ruins it!
 Originally Posted by GODzillaSDM
Thank you very much for all your replies.
fourblades, the link you posted was exactly what i did. This causes the corners to not be transparent when i change opacity during runtime.
VBDT, I tried pasting the code
Code:
'End moving code
'Draw a rounded rectangle in the forms paint event.
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
e.Graphics.DrawPath(Pens.Red, Shape.RoundedRectangle(New Rectangle(5, 5, 100, 100), 8))
End Sub
'Show the control on the form with rounded corners.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Panel1.Region = Shape.RoundedRegion(Panel1.Size, 10)
End Sub
but i get shape and panel 11 as undeclared. How can I fix this?
It is because the example assumes that you have added the Shape class into your project and you have a Panel1 control on your form.
Let make things simple, download the “Shape” zip file from the link, unzip it and add to your project by clicking the “Add New Item” button on VS tools, select the “Add Existing Item” menu item and add the class by browsing to the directory where the Shape.vb file is then select and click add. Put this code in the Form1.Load event and run the app.
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Region = Shape.RoundedRegion(Me.Size, 20)
End Sub
Check the parameters of the method for descriptions.
Last edited by VBDT; Aug 14th, 2007 at 10:51 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|