Link to home
Start Free TrialLog in
Avatar of riceman0
riceman0

asked on

How to Show a window at a certain location


Hey, I have a VB.NET form that I am generating as a child window to another VB.NET form.  On startup, I want to make it visible at a certain location (stored in an INI file).  So I get the x,y from the INI file, and run the following code:

m_ChildWindow(c).MdiParent = Me
m_ChildWindow(c).Show()
m_ChildWindow(c).SetBounds(r.X, r.Y, r.Width, r.Height)

the problem is that the user can see the form appear in the default position, then quickly move over to the desired position.  To get rid of this flicker, I tried to reverse the Show and SetBounds commands, but then the Show seems to cancel the position I set it to.  Is there any way to have a form appear where I want it to, w/o moving it after it has appeared?
Avatar of razo
razo

y dont u set the form transparent then show,set bounds and then get it back to its normal background....u could use the opacity from 0 to 100
I normally use .Left and .Top to set the windows position. Dont know the pros and cons between the two methods, but I've never had any problems with it flicking between positions.

You can use .show after setting the position also.

Try using this method and let me know how you get on...
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or make it invisible then visible after positioning.