470,602 Members | 1,731 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,602 developers. It's quick & easy.

Develop own UserControl

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é

Nov 19 '05 #1
1 1474
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?= <re***@ppedv.de>
Newsgroups: microsoft.public.dotnet.languages.vb
Subject: Develop own UserControl
Date: Fri, 22 Aug 2003 17:04:15 +0200
Lines: 17
Message-ID: <bi************@ID-96132.news.uni-berlin.de>
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.t ele.dk!small.news.tele.dk!fu-berlin.de!uni- berlin.de!p508a947f.dip.t-dialin.NET!not-for-mailXref: 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.

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Raed Sawalha | last post: by
2 posts views Thread by Sascha | last post: by
12 posts views Thread by Joe | last post: by
9 posts views Thread by Marcelo Cabrera | last post: by
6 posts views Thread by MeowCow | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.