Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Show a window at a certain location

Posted on 2006-10-31
4
Medium Priority
?
247 Views
Last Modified: 2008-02-01

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?
0
Comment
Question by:riceman0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Expert Comment

by:razo
ID: 17841760
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
0
 
LVL 9

Expert Comment

by:DjDezmond
ID: 17841805
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...
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 1000 total points
ID: 17841818
Initial window position should be set in the Load event handler in the form itself. Pass desired window coordinates to the child window using method or property, and use these valies in the Load event handler.

m_ChildWindow(c).MdiParent = Me
m_ChildWindow(c).SetDesiredPosition(r.X, r.Y, r.Width, r.Height)   ' SetDesiredPosition  is your function which keeps position to use it in Form_Load
m_ChildWindow(c).Show()

0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17841823
or make it invisible then visible after positioning.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question