471,338 Members | 1,001 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

Custom shapes in VB .net

Hi all!
I have worked eith vb 6 and used custom shapes such as
circle,elipse,Rectangle and ...
But these shapes are not in vb .net?
How can i get them?
Best wishes...
Jul 21 '05 #1
3 5542
draw them in the Paint event.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"mf_sina" <mf*****@yahoo.com> wrote in message
news:Oj**************@TK2MSFTNGP11.phx.gbl...
Hi all!
I have worked eith vb 6 and used custom shapes such as
circle,elipse,Rectangle and ...
But these shapes are not in vb .net?
How can i get them?
Best wishes...

Jul 21 '05 #2
Dear Nick!
plz include a sample code in your reply because i couldn't do it using paint
event
Thanks in advance

"Nick Malik [Microsoft]" <ni*******@hotmail.nospam.com> wrote in message
news:X8********************@comcast.com...
draw them in the Paint event.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"mf_sina" <mf*****@yahoo.com> wrote in message
news:Oj**************@TK2MSFTNGP11.phx.gbl...
Hi all!
I have worked eith vb 6 and used custom shapes such as
circle,elipse,Rectangle and ...
But these shapes are not in vb .net?
How can i get them?
Best wishes...


Jul 21 '05 #3
MF,

Of course are they in VBNet

Here a sample I made once, maybe you can use it. This is just a simple
sample it needs only a form and than paste the code in and run. However you
see a lot of classes you can use.

Where the system drawing is the class you are looking for and in that the
region.

\\\made by Cor Ligthert from ideas I got from Herfried. K. Wagner and Fergus
Cooney
Private WithEvents button1 As New Button
Private mouseX, mouseY As Integer
Private myMouseDown As Boolean
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim g As New System.Drawing.Drawing2D.GraphicsPath
g.AddString("HTH" & vbCrLf & "Cor", _
System.Drawing.FontFamily.GenericSansSerif, _
System.Drawing.FontStyle.Bold, 200, _
New Point(0, 0), _
System.Drawing.StringFormat.GenericDefault)
Me.BackColor = Color.Red
Me.Region = New System.Drawing.Region(g)
g.Dispose()
Me.AutoScaleBaseSize = New System.Drawing.Size(0, 0)
Me.ClientSize = New System.Drawing.Size(500, 450)
button1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
button1.ForeColor = System.Drawing.Color.Black
button1.Location = New System.Drawing.Point(425, 18)
button1.Size = New System.Drawing.Size(20, 20)
Me.Controls.Add(button1)
button1.Text = "X"
Me.Location = New System.Drawing.Point(50, 50)
End Sub
Private Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles button1.Click
Me.Close()
End Sub
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal _
e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
myMouseDown = True
mouseX = Cursor.Position.X - Me.Location.X
mouseY = Cursor.Position.Y - Me.Location.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e _
As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Static LastCursor As Point
Dim NowCursor As Point = New Point(Cursor.Position.X,
Cursor.Position.Y)
If Point.op_Inequality(NowCursor, LastCursor) Then
If myMouseDown Then
Me.Location = New System.Drawing.Point(Cursor.Position.X _
- mouseX, Cursor.Position.Y - mouseY)
End If
LastCursor = Cursor.Position
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
myMouseDown = False
End Sub
///

I hope this helps a little bit?

Cor
Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by raj | last post: by
1 post views Thread by Phil Price | last post: by
3 posts views Thread by mf_sina | last post: by
5 posts views Thread by moondaddy | last post: by
reply views Thread by alwayssmiling | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.