Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

UserControl not fitting onto Form

UserControl not fitting onto Form

UserControl not fitting onto Form


I'm having trouble getting my UserControl to fit snuggly in my panel. Here's a screen shot of what it looks like:

The UserControl is in red and the panel I'm trying to fit it onto is in grey (the white is a ListBox in my UserControl). As you can see,

it's going off the right edge of the Form.

I have these settings for both the panel and the UserControl:

AutoSize: true
AutoSizeMode: GrowAndShrink
Anchor: AnchorStyle.Left | AnchorStyle.Top | AnchorStyle.Right
Dock: DockStyle.Top

But for some reason, either the panel or the UserControl doesn't want to shrink down to the appropriate size.

Any help would be very much appreciated.

RE: UserControl not fitting onto Form

You haven't shown the code that you use to place your control in the panel. Try adding your control to the Controls collection of the Panel and if appropriate set a suitable DockingStyle

RE: UserControl not fitting onto Form

Thanks softhemc,

Setting dockstyle to top worked.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close