|
-
Mar 17th, 2004, 05:34 AM
#1
Thread Starter
Member
active drawing
good morning everyone
i've got a question i am trying to use a button from the toolbox , all buttons got square shap,
any idea how i can change the shape of a button from square to triangle or circle shape.
if that's not possible, do u reckon i can draw any shape than make it active,
thank you very much,
have a good day
-
Mar 17th, 2004, 06:42 AM
#2
Hi.
You can use a graphics path to create a region for your button.
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.MakeButtonRound(Button1)
End Sub
Public Sub MakeButtonRound(ByVal B As Button)
Dim Gp As New Drawing2D.GraphicsPath()
Gp.AddEllipse(0, 0, B.Width, B.Height)
B.Region = New Region(Gp)
Gp.Dispose()
End Sub
You can combine any number of shapes in your graphics path to create the layout you like.
The sample above will be better illustrated if the button and form are different colors.
I hope this helps you.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Mar 17th, 2004, 11:53 AM
#3
Thread Starter
Member
wha i am trying to do, is to draw an arrow,
the only way i managed to do that is through using a lable ""->"""
which is not very good aparently, but coz it is a label i coudl moved it, make it visible move to left right, wherever i want to position it....
anyone knows how i can draw a proper arrow, or a small triangle which i can stick it to a square, but at same time , i would be able to change its properties like a control..
thank you very much
sorry about broken english
-
Mar 17th, 2004, 01:11 PM
#4
Hi.
I guess you could make a graphicspath shaped as an arrow, and use it to set the region of a label.
That way you will have an arrow that you can move around like any other control.
Only thing is, that it will only be arrowshaped in runtime.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Mar 22nd, 2004, 07:29 AM
#5
Thread Starter
Member
-
Mar 22nd, 2004, 08:44 AM
#6
Well, basically the same way as the example I posted.
But instead of just adding an ellipse to the graphics path, you would add a series of rectangles and lines to make up an arrow.
Then just set the label region the same way as the button.
Then just set the backgoundcolor of the label to the color you would like for your arrow and you're set.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Mar 22nd, 2004, 08:50 AM
#7
Here's an example.
Add a label called Label1 to your form.
Set the backgroundcolor of the label to something other than the form.
Set the Size to W=100, H=30
Run this code.
VB Code:
Dim G As New Drawing2D.GraphicsPath()
G.AddRectangle(New Rectangle(0, 10, 85, 10))
G.AddLine(85, 0, 100, 15)
G.AddLine(100, 15, 85, 30)
Label1.Region = New Region(G)
This should get you started.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Mar 22nd, 2004, 11:54 AM
#8
Thread Starter
Member
THANK YOU VERY MUCH
U R GORGEOUS ;-)
CHEERS MATE
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
|