Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2007

Tip: Looking for answers? Try searching our database.

Container control resizing issue (child not anchored)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason Barnett - 16 Oct 2007 22:48 GMT
I'm working with VS2005 on a Windows 2000 workstation, and I'm trying to
create a container control for use with win forms.  I've started out by
creating a UserControl and adding the Designer attribute;
ParentControlDesigner (according to
http://support.microsoft.com/default.aspx?scid=kb;EN-US;322222).

I've placed a panel on my UserControl, and anchored its top, left, and right
sides; to appear as a titlebar.  I've created an instance of my UserControl
on a Form and anchored it's top, left, and right sides as well.

I noticed when I execute my application, and resize the Form, the right-side
anchor of the panel (the UserControl's child) temporarily loses hold.  I say
this, because a gap appears between the right edge of the Panel and the
right-edge of the UserControl.  However, if I then resize the form, the
UserControl resizes and the Panel resizes with the gap remaining.

Does this make sense?  Has anyone experienced this, and found a resolution?
Jason Barnett - 16 Oct 2007 22:54 GMT
I forgot to add that this problem occurs after I place a control onto my
UserControl when using my UserControl as a compiled control (not when
designing my UserControl).

Here are the steps to help clarify:

1. Create a new UserControl and, in it's designer, place a panel with
anchored edges

2. Compile the project and drop an instance of the UserControl onto a Form
(setting the UserControl's anchor property).

3. Add a control (i.e. Label control) onto the UserControl and run the
application

> I'm working with VS2005 on a Windows 2000 workstation, and I'm trying to
> create a container control for use with win forms.  I've started out by
[quoted text clipped - 13 lines]
>
> Does this make sense?  Has anyone experienced this, and found a resolution?
Jason Barnett - 19 Oct 2007 17:52 GMT
I found a workaround... an old technique from my VB6 programming days.  I've
assigned the width of my CustomControl to the Panel within it on the Resize
event; effectively, manually anchoring the control at runtime.

> I'm working with VS2005 on a Windows 2000 workstation, and I'm trying to
> create a container control for use with win forms.  I've started out by
[quoted text clipped - 13 lines]
>
> Does this make sense?  Has anyone experienced this, and found a resolution?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.