Develop own UserControl

  • Thread starter Thread starter =?iso-8859-1?Q?Ren=E9_Paschold?=
  • Start date Start date
?

=?iso-8859-1?Q?Ren=E9_Paschold?=

Hello there,

i want to write my on control. Its a control which
contains a collection of other controls like TextBox and more.

So i want to have a border like the Panel Control
only for Designer. The panel have a light black border
during programming in VS .NET!

In Runtime the border ist not visible.

Can anyone help me and tell me what should i do to
have the same effect?

Cheers
René
 
Hello René,

every component has a DesignMode property that you can use to determine if you're at design-time or run-time. You could use this property and paint a
border for the user control. Here is an example:

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

Dim controlRect As Rectangle = ClientRectangle
controlRect.Inflate(-1, -1)

If (Me.DesignMode = True) Then
e.Graphics.DrawRectangle(New Pen(Color.Black), controlRect)
End If
End Sub


HTH

Antoine
Microsoft Visual Basic .NET

--------------------
From: =?iso-8859-1?Q?Ren=E9_Paschold?= <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.vb
Subject: Develop own UserControl
Date: Fri, 22 Aug 2003 17:04:15 +0200
Lines: 17
Message-ID: <[email protected]>
NNTP-Posting-Host: p508a947f.dip.t-dialin.net (80.138.148.127)
Mime-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 1061564479 5737948 80.138.148.127 (16 [96132])
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.com!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni- berlin.de!p508a947f.dip.t-dialin.NET!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:129711
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

Hello there,

i want to write my on control. Its a control which
contains a collection of other controls like TextBox and more.

So i want to have a border like the Panel Control
only for Designer. The panel have a light black border
during programming in VS .NET!

In Runtime the border ist not visible.

Can anyone help me and tell me what should i do to
have the same effect?

Cheers
René


--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
 
Back
Top