473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

UserControl inherit from label


Hello
How to set the minimum size, the dock comportement of a usercontrol herited
from a label ?
i tried this without success :
Imports System.ComponentModel

<ToolboxBitmap(GetType(MyLblCtrl.MonLabel), "MonLabel.bmp")_

Public Class MonLabel

Inherits Windows.Forms.Label

Public Sub New()

' This call is required by the Windows Form Designer.

InitializeComponent()

' Add any initialization after the InitializeComponent() call.

Me.AllowDrop = True

Me.BorderStyle = Windows.Forms.BorderStyle.FixedSingle

Me.MinimumSize.Width = 80 'error here

Me.Dock = DockStyle.Fill

Me.Height = 25

End Sub













http://www.scalpa.info
http://scalpa98.blogspot.com/
Oct 30 '08 #1
3 4573
On Thu, 30 Oct 2008 19:22:48 +0100, "Pascal" <sc**@wndoo.frwrote:
>
Hello
How to set the minimum size, the dock comportement of a usercontrol herited
from a label ?
i tried this without success :
Imports System.ComponentModel

<ToolboxBitmap(GetType(MyLblCtrl.MonLabel), "MonLabel.bmp")_

Public Class MonLabel

Inherits Windows.Forms.Label

Public Sub New()

' This call is required by the Windows Form Designer.

InitializeComponent()

' Add any initialization after the InitializeComponent() call.

Me.AllowDrop = True

Me.BorderStyle = Windows.Forms.BorderStyle.FixedSingle

Me.MinimumSize.Width = 80 'error here

Me.Dock = DockStyle.Fill

Me.Height = 25

End Sub
The MinimumSize property is an instance of the Size class, which does
not allow its properties to be modified. Create a new instance:

Me.MinimumSize = New Size(80, Me.MinimumSize.Height)
or
Me.MinimumSize = New Size(80, 0)
Oct 30 '08 #2
"Pascal" <sc**@wndoo.frschrieb
>
Hello
How to set the minimum size, the dock comportement of a usercontrol
herited
from a label ?
i tried this without success :
....
Me.MinimumSize.Width = 80 'error here
Doesn't work because reading Me.MinimumSize returns a copy of the size. It's
a copy because the size is a value type (a Structure). Setting the Width of
the copy would not change the MinimumSize property. Therefore the error.
Assign a new Size object: Me.MinimumSize = new size(80, minimumsize.height)

Also set Me.Autosize = False. Otherwise Dock property doesn't have an
effect.
Armin

Oct 30 '08 #3
Thanks you for your help : it works fine!
pascal














http://www.scalpa.info
http://scalpa98.blogspot.com/
"Pascal" <sc**@wndoo.fra écrit dans le message de news:
uD**************@TK2MSFTNGP04.phx.gbl...
>
Hello
How to set the minimum size, the dock comportement of a usercontrol
herited from a label ?
i tried this without success :
Imports System.ComponentModel

<ToolboxBitmap(GetType(MyLblCtrl.MonLabel), "MonLabel.bmp")_

Public Class MonLabel

Inherits Windows.Forms.Label

Public Sub New()

' This call is required by the Windows Form Designer.

InitializeComponent()

' Add any initialization after the InitializeComponent() call.

Me.AllowDrop = True

Me.BorderStyle = Windows.Forms.BorderStyle.FixedSingle

Me.MinimumSize.Width = 80 'error here

Me.Dock = DockStyle.Fill

Me.Height = 25

End Sub













http://www.scalpa.info
http://scalpa98.blogspot.com/

Oct 31 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael Evanchik | last post by:
Tying not to spaghetti code which seems to be easy to do in .net, im trying to do my main .net html in index.aspx, use repeated .net html in an .ascx files and all code im doing in .vb code behind...
2
by: bill yeager | last post by:
When trying to run my web project, I get the following error: Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the...
0
by: Sebastian Hiller | last post by:
Hello, i'm new to .Net (i'm using VB as language and i'm working in the code-behind mode) and i can't solve the following problem: I have a WebForm and want to Add a UserControl...
3
by: Patrick.O.Ige | last post by:
I created a USERCONTROL and i want to call a LABEL from an ASPX page. The USERCONTROL is in the ASPX page I have the label :- Label lblstr = new Label(); And displaying using:-...
1
by: Philipp Lenz | last post by:
I'm very confused about how this works, all the tutorials out there show me how to apply a skin to a webcontrol, but I want to know how I can access the components of a control....for example: I...
12
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control...
4
by: DanG | last post by:
Howdy, On past .NET projects, I only had System.Web.UI.Page forms. One application needed a set of functions to do processing against the Page, Session and Request objects associated with the...
3
by: Martin | last post by:
Hi ! I've developed a small UserControl with five textbox and label. However, when I want to display the UserControl in a form, controls appear slowly one after one. I've activated double...
2
by: Joe | last post by:
Is it possible to inherit from a UserControl? If I try my user control class is not recognized. Thanks, Joe
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.