469,270 Members | 1,772 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

User Control Resize

Hi All

VB.NET 2003

Can anyone tell me how to stop a user control being able to be resized
during both design time & run time, please?

I am looking for something like the LOCKED property, but being able to move
the control to wherever on the form it's needed.

Any ideas?

TIA
Jan 9 '07 #1
11 7390
I don't think such a property exists. It would be in the Design
category of the properties window if there was one.

Matt

Newbie Coder wrote:
Hi All

VB.NET 2003

Can anyone tell me how to stop a user control being able to be resized
during both design time & run time, please?

I am looking for something like the LOCKED property, but being able to move
the control to wherever on the form it's needed.

Any ideas?

TIA
Jan 9 '07 #2
Newbie Coder wrote:
Can anyone tell me how to stop a user control being able to be resized
during both design time & run time, please?
Read up on:

ParentControlDesigner (this is the best place to start in MSDN)
A base class from which you derive a "designer" for your UserControl.
Within the class, the SelectionRules property controls the
appearance/hiding of sizing handles on your UserControl - no sizing
handle, no design-time resizing!

DesignerAttribute
Used to link your UserControl to your "designer" class.

DefaultSize property
Sets the size of the UserControl when it is created at design time.

At Run-Time, you may have to override/shadow the Size, Height and Width
properties.

HTH,
Phill W.
Jan 9 '07 #3
Easy. Set the UserControls MaximumSize and MinimumSize properties to the
same value.
"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eW****************@TK2MSFTNGP06.phx.gbl...
Hi All

VB.NET 2003

Can anyone tell me how to stop a user control being able to be resized
during both design time & run time, please?

I am looking for something like the LOCKED property, but being able to
move
the control to wherever on the form it's needed.

Any ideas?

TIA


Jan 9 '07 #4
Good for you, but these properties are /new/ to VB 2005 and the O.P.
specifically stated they were still using VB 2003.

Good enough reason to upgrade? YMMV :-)

Regards,
Phill W.

Mudhead wrote:
Easy. Set the UserControls MaximumSize and MinimumSize properties to the
same value.

"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eW****************@TK2MSFTNGP06.phx.gbl...
>Hi All

VB.NET 2003

Can anyone tell me how to stop a user control being able to be resized
during both design time & run time, please?
Jan 9 '07 #5
Or just set the size back again in the resize event, this is how I have done
it in the past.

Saves upgrading to 2005! haha.

"Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-kwrote in message
news:eo**********@south.jnrs.ja.net...
Good for you, but these properties are /new/ to VB 2005 and the O.P.
specifically stated they were still using VB 2003.

Good enough reason to upgrade? YMMV :-)

Regards,
Phill W.

Mudhead wrote:
>Easy. Set the UserControls MaximumSize and MinimumSize properties to the
same value.

"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eW****************@TK2MSFTNGP06.phx.gbl...
>>Hi All

VB.NET 2003

Can anyone tell me how to stop a user control being able to be resized
during both design time & run time, please?

Jan 9 '07 #6
Thank you Phil for your suggestions

I have used the Design Attribute & Shadowed the Height/Width properties, but
isn't enough

One question that has arose from your SIZE is that my control uses a Textbox
with border set to none, which makes the height 13 & won't allow me to
change to a height of 20/24. Any idea how? Setting height makes to anything
other than 13 is ignored

Anyway. Thanks again for your suggestions.

Newbie Coder

"Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-kwrote in message
news:eo**********@south.jnrs.ja.net...
Newbie Coder wrote:
Can anyone tell me how to stop a user control being able to be resized
during both design time & run time, please?

Read up on:

ParentControlDesigner (this is the best place to start in MSDN)
A base class from which you derive a "designer" for your UserControl.
Within the class, the SelectionRules property controls the
appearance/hiding of sizing handles on your UserControl - no sizing
handle, no design-time resizing!

DesignerAttribute
Used to link your UserControl to your "designer" class.

DefaultSize property
Sets the size of the UserControl when it is created at design time.

At Run-Time, you may have to override/shadow the Size, Height and Width
properties.

HTH,
Phill W.

Jan 10 '07 #7
In the reside event I have set the size to the original, but this is ignored
in design time

I know Microsoft have had certain controls at least since VB 6 that the size
is locked at both design/run time

Thanks for the suggestion though Nick

BTW: I have VS.NET 2005 Pro, but this project was originally written in 1.1
& I am continuing to update it in the same Framework version.

Maybe, when I have a spare few coding weeks I will totally upgrade
everything to 2.0

Newbie Coder
Jan 10 '07 #8
Hi,

That's strange....

Always worked for me, just a second.....

http://nickpateman.m6.net/Files/resizecontroltest.zip

That will do ask you are after. Will prevent resizing during design
time as well as runtime. Although if you do it at run time it will probably
flicker, this is because the event is fired post resize.

In order to fix this, override the WM_SIZE method or use the other
methods posted in this thread. But this is the simplest solution.

Unless you have opposing anchors or docking set it will never resize at
runtime anyway....

Nick.

"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eb**************@TK2MSFTNGP04.phx.gbl...
In the reside event I have set the size to the original, but this is
ignored
in design time

I know Microsoft have had certain controls at least since VB 6 that the
size
is locked at both design/run time

Thanks for the suggestion though Nick

BTW: I have VS.NET 2005 Pro, but this project was originally written in
1.1
& I am continuing to update it in the same Framework version.

Maybe, when I have a spare few coding weeks I will totally upgrade
everything to 2.0

Newbie Coder


Jan 10 '07 #9
The height of the textbox is determined by it's font size. Make the font
bigger if you want to increase the height of the Textbox

"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:OS***************@TK2MSFTNGP06.phx.gbl...
Thank you Phil for your suggestions

I have used the Design Attribute & Shadowed the Height/Width properties,
but
isn't enough

One question that has arose from your SIZE is that my control uses a
Textbox
with border set to none, which makes the height 13 & won't allow me to
change to a height of 20/24. Any idea how? Setting height makes to
anything
other than 13 is ignored

Anyway. Thanks again for your suggestions.

Newbie Coder

"Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-kwrote in message
news:eo**********@south.jnrs.ja.net...
>Newbie Coder wrote:
Can anyone tell me how to stop a user control being able to be resized
during both design time & run time, please?

Read up on:

ParentControlDesigner (this is the best place to start in MSDN)
A base class from which you derive a "designer" for your UserControl.
Within the class, the SelectionRules property controls the
appearance/hiding of sizing handles on your UserControl - no sizing
handle, no design-time resizing!

DesignerAttribute
Used to link your UserControl to your "designer" class.

DefaultSize property
Sets the size of the UserControl when it is created at design time.

At Run-Time, you may have to override/shadow the Size, Height and Width
properties.

HTH,
Phill W.


Jan 10 '07 #10
Thanks for your reply

I want to keep the font 8.25 (standard), but increase the height

Newbie Coder
Jan 10 '07 #11
Oh I see.

You are working in VB.NET 2005 & I am using VB.NET 2003, which was the
version I mentioned in my original post.

Will take another look

Thank you once again, Nick

Newbie Coder
Jan 10 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ian | last post: by
2 posts views Thread by Rodrigo Ferreira | last post: by
6 posts views Thread by ACaunter | last post: by
reply views Thread by marfi95 | last post: by
1 post views Thread by Lucien Dol | last post: by
1 post views Thread by rudjohn | last post: by
1 post views Thread by johnson.bj | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.