all groups > vb.net controls > june 2007 >
You're in the

vb.net controls

group:

Drawing a rectangle around my control


Drawing a rectangle around my control Adam Stachura
6/14/2007 12:00:00 AM
vb.net controls:
Hey!

I need to draw a rectangle around my control but not inside it. How can I
do it?
Is it possible?

My code isn't working correctly during resising a window:

Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)

MyBase.OnPaint(e)

If Me.Parent Is Nothing Then

Exit Sub

End If

Dim grTemp As Graphics = Me.Parent.CreateGraphics()

Dim prvRecTemp As Rectangle

prvRecTemp = New Rectangle(Me.Location.X - 1, Me.Location.Y - 1, Me.Width +
1, Me.Height + 1)

grTemp.DrawRectangle(New Pen(System.Drawing.Color.Yellow, 1), prvRecTemp)

End Sub


thanks for help

Adam Stachura

Re: Drawing a rectangle around my control Adam Stachura
6/15/2007 2:38:41 PM
OK - I've just resolved my problem...

thanks for ENORMOUS help!


U¿ytkownik "Adam Stachura" <admin@vbultra.com> napisa³ w wiadomo¶ci
news:emUODbmrHHA.4104@TK2MSFTNGP06.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button