• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1244
  • Last Modified:

Anchor problem in UserControl happens on random computers

I am using VB.Net 2008 (had the same problem in 2005) and have a problem on random computers... it is very wierd.  It works fine on most computers, but I have a XP - SP3 machine that the anchored objects refuse to anchor.  Everything was assembled using the designer.  The controls having the problems are datagridviews anchored to a splitter panel inside of a tab.  So the anchoring goes pretty deep.  The tab control sits on a user control, which sits on a form inside of an MDI frame.  Here is the order to where the control having the problem lives:

MDI Frame
form in the frame
user control on the form
horizontal SplitContainer Panel
tab control in the lower SplitContainer Panel
vertical SplitContainer Panel on the tab control
DataGridView sitting in this vertical SplitContainer Panel...this is the one that the anchors do not work on some computers.

All the anchors go crazy and stuff is cut off or gone.  It is like the controls don't anchor themselves properly to the splitter panel.  

There must be some bug with the Visual Studio Designer causing this.  All the controls in this window were put there by the designer.  Some things in the panels are set visible/invisible during runtime, but the positions are getting screwed up.  This only happens on random machines like 1 out of 10 computers.  Why would the anchors do this?

I posted this on :
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/ea4594ce-7d6b-4837-a7f2-6c0085693ddb   and got no answer.

If there is something in the designer code that I can rearrange, that is fine, I just need to know how to get around this anomole.  It appears to have something to do with controls living on the splitter panels.  The bad thing is that I cannot reproduce this on my computer, so it makes it hard to troubleshoot.  It only happens on certain computers that are running Windows XP.  It works fine on Vista.

Thanks,
Jeff
0
jdressing
Asked:
jdressing
  • 6
  • 4
  • 3
1 Solution
 
CodeCruiserCommented:
Is the resolution on that computer similar to other computers?
0
 
jdressingAuthor Commented:
We have tried all the resolutions and even when they are the same as those that work, it screws them up.  One person said it could have to do with the order the designer put the objects in... although if it was a designer bug, I would expect the problem on all computers.   It is almost as if the anchors do not recognize what they are sitting on.  With them living in a splitter panel, it as if the controls cannot anchor to the panels.  If it was consistent, it would be much easier to troubleshoot.
0
 
CodeCruiserCommented:
can you post a screenshot of the messed up form please? May help to recognize some pattern.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Bob LearnedCommented:
Are you running SP1 or the base version for 2008?  Operating systems (XP, Vista, ...)?
0
 
jdressingAuthor Commented:
It is the base version of 2008   Version 9.0.21022.8 RTM
This also happened in VS 2005
Operating system for development is Vista Business.
The problem seems to be happening on XP Pro computers... those are that their latest service packs.
All machines running the software are using .Net 3.5 framework.
0
 
Bob LearnedCommented:
I am curious if this is a bug that was fixed in 3.5 SP1.  Can you give me a little better "picture" of your anchoring/docking requirements?
0
 
jdressingAuthor Commented:
I just installed SP1 for Visual Studio on my laptop.  I asked a buddy to get 3.5 SP1 on the computer with the issues.

In the app, I have a form that lives in an MDI frame
On the form lives a user control
On the user control there are a bunch of splitter panels and tabs and splitter panels on the tabs and data grids on those splitter panels.  I have attached a screen shot.
The grids that are messing up are only the ones that live in the lower splitter panel.  (This happens on 3 of the tabs).  All the other ones are fine.   I drew arrows on the screen to show what is happening.  I cannot get a screen shot from the actual user until next week.
MainWindow.jpg
0
 
Bob LearnedCommented:
Are you saying that you have nested SplitterContainer controls?  Are the DataGridView controls custom?
0
 
jdressingAuthor Commented:
Yes in the case of the one that is failing... it is actually nested 3 levels
It appears to just be the nested ones that are failing.  1st level splitter seems to be fine... it is the one that is 2nd and 3rd that are messing up on XP machines.
There is 1 horizontal splitter that top and bottom both have a datagridview - these are messing up
That horizontal splitter lives in the right side of the vertical splitter and there is a datagridview in the left side of that splitter.
These splitters live on a tab control that lives in 1 larger horizontal splitter.
0
 
Bob LearnedCommented:
Are you talking about Splitter control, or SplitterContainer controls?
0
 
jdressingAuthor Commented:
I am using SplitterContainers on all of these.  The splittercontainer then contains Splitter Panels.  These were all put there using the Visual Studio Designer.
0
 
jdressingAuthor Commented:
I figured out the problem.  Apparently when controls live on a tabpage and you remove the tabpage (because .Net doesn't alllow us to hide a tabpage), it screws up the anchors and positions of some of the controls.  It seems to primarily happen when that tabpage contains splitcontainers or contains other tabcontrols within it.  Those nested controls (splittercontainers and tabcontrols) get screwed up when removing and re-adding the parent tabpages.   It would be nice if the TabControl allowed the .Hide to work instead of actually having to removing them.  

When removing the tabpages from the tabcontrol, and re-adding the tabpage, the tabpage must not realign nested splitcontainers and tabcontrols... most other controls seem to be fine.
0
 
CodeCruiserCommented:
Try using the .Visible=False property instead of the Hide method.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now