How to disable resizing a custom user control?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mehdi_mousavi

    How to disable resizing a custom user control?

    Hi,
    I've written a custom user control, say, MyControl that's being derived
    from System.Windows. Forms.UserContr ol. The problem is that I need the
    control to be fixed size; i.e., I donot want the control to be resized
    either in design mode, or run-time. How can I do that?

    Any help would be highly appreciated,

    Cheers,
    Mehdi

  • Tim Wilson

    #2
    Re: How to disable resizing a custom user control?

    For design-time, you can create a custom ControlDesigner and override the
    SelectionRules property to specify the appropriate behavior.


    For run-time, you can override the SetBoundsCore method of your custom
    UserControl and enforce the desired size.


    --
    Tim Wilson
    ..Net Compact Framework MVP

    "mehdi_mous avi" <mehdi.mousavi@ gmail.com> wrote in message
    news:1120489455 .724951.164400@ f14g2000cwb.goo glegroups.com.. .[color=blue]
    > Hi,
    > I've written a custom user control, say, MyControl that's being derived
    > from System.Windows. Forms.UserContr ol. The problem is that I need the
    > control to be fixed size; i.e., I donot want the control to be resized
    > either in design mode, or run-time. How can I do that?
    >
    > Any help would be highly appreciated,
    >
    > Cheers,
    > Mehdi
    >[/color]


    Comment

    Working...