PC Review


Reply
Thread Tools Rate Thread

Develop own UserControl

 
 
=?iso-8859-1?Q?Ren=E9_Paschold?=
Guest
Posts: n/a
 
      22nd Aug 2003
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é

 
Reply With Quote
 
 
 
 
Antoine Cote [MSFT]
Guest
Posts: n/a
 
      25th Aug 2003
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?= <(E-Mail Removed)>
>Newsgroups: microsoft.public.dotnet.languages.vb
>Subject: Develop own UserControl
>Date: Fri, 22 Aug 2003 17:04:15 +0200
>Lines: 17
>Message-ID: <bi5b7v$5f3es$(E-Mail Removed)>
>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.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bind controls on a usercontrol to bindingsource from anotherform/usercontrol jogisarge Microsoft C# .NET 0 18th Dec 2008 08:10 AM
Create a usercontrol instances to another usercontrol in code behi =?Utf-8?B?UGFkYW0=?= Microsoft C# .NET 1 9th Apr 2007 11:52 AM
web usercontrol + delegates or specialised usercontrol base class info@record-play.com Microsoft ASP .NET 0 23rd Jun 2006 10:41 AM
Usercontrol derived from Usercontrol - masterpage init is fired tw =?Utf-8?B?Q2FwdGFpbiBTZW5zaWJsZQ==?= Microsoft ASP .NET 0 3rd Feb 2006 03:39 PM
Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack huobazi Microsoft ASP .NET 1 3rd Jul 2003 04:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:03 AM.