Control Fixed Height/Width in Design Mode

Status
Not open for further replies.

Diesel

Contributor
Joined
Aug 18, 2003
Messages
662
What do you do to make a control a fixed height (and/or width) at Design time?

Control.SetStyle(ControlStyles.FixedHeight, true);

does not work
 
Well, yes if I was referring to the design mode of the control, but I was referring to the design mode of the container control that you place the user control on...So No, that does not work.
 
A usercontrol. Why...How would you make 'a standard VS control' not resizable?
 
That's the point, you can't control a standard VS control. But since you've got a user control then open the "Windows Form Designer generated code" region and in the New Sub set your contol's default size along with any other defaults you might need.
Visual Basic:
Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call
    SetStyle(ControlStyles.AllPaintingInWmPaint, True)
    SetStyle(ControlStyles.DoubleBuffer, True)
    SetStyle(ControlStyles.ResizeRedraw, True)

    MyBase.BackColor = System.Drawing.SystemColors.Control
    MyBase.Size = New Size(yourDefaultWidth, yourDefaultHeight)

End Sub
 
Ok, take that control you just made. Place it on a form. Now resize it.

I want a control that is not RESIZABLE!!!!!!!! at design time. Design time is when you place a control on a form.

I'm not taking my anger out specifically on you DiverDan, but the last 3 questions I've posted, I've recieved answers that are irrelevant.
 
I guess that you have little to no experience with user controls and your anger is a big deterent for helping you....But use my code to set the correct size FIRST!!!!! Then if you want to control the Resizing of the control then restrict the Overrides OnSizeChanged Sub. It's that simple and that easy!!!

You might also check into all the Overrides properities and educate yourself a bit prior to posting to avoid this type of frustration and silly posts in the future!
 
I did, it didn't work. Also, I'm looking to actually take the resize hooks off the control at design time.
 
What you are looking to achieve can be done via classes in the Design library, I believe in the System.Windows.Forms.Design namespace. You can enable/disable different sizing handles in the designer. You can also override the OnResize event and only call MyBase.Resize when you are in runtime mode. (I found this out through a google search). My recommendation would be reading some tutorials on designer aspects of control development.
 
I don't need a custom UI editor.
My recommendation for you would be reading some tutorials on how to use google.
 
LOL, Diesel. Keep up with the attitude. Pretty soon noone will help you, or better yet, you will be banned.

Next time you want to be a tool, think about the fact that you have asked a question to generous people that are willing to help you for free.
 
Your another one.

Think about the fact that I'm on here many times a week answering questions, for free.

I have an attitude because I hate it when people pretend to know something and hand out misinformation.

There's a lot of dumbasses that get paid a lot of money to do nothing. If someone else doesn't point out that they don't know what they're doing, they'll keep getting paid.

This question was never answered, if anyone else wants to take a crack. OnSizeChanged is not how you do it.

As far as I can figure, you have to use the function CreateParams and edit one of the control styles flags.
 
Status
Not open for further replies.
Back
Top