problem with setting Top & Left of a form
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: problem with setting Top & Left of a form

Threaded View

  1. #1
    Join Date
    May 2001
    Silicon Valley

    Exclamation problem with setting Top & Left of a form


    I’m doing some recreational programming. I'm trying to display a semi-transparent form (overlay) over a control. (The purpose of the overlay is to show that a control can be a target for drag & drop.) I’ve whipped-up a quick code to determine size and position of the overlay, and then display it. Here it is:

            private void button1_Click(object sender, EventArgs e)
                m_frmOverlay.Bounds = treeView1.RectangleToScreen(treeView1.ClientRectangle);
    In this code, new Bounds are set before Show(). Overlay form is displayed with default Top & Left (as set in the form designer), not the new Top & Left. Is it possible to set Top & Left before the form is shown ?
    If I change the code and set Bounds after Show(), overlay is displayed with correct top & left. Unfortunately, the overlay form still flickers for a moment at the default position. What would be a good way of getting rid of this flicker ?

    I'm using .NET 3.5 / VS 2008.

    Any suggestion, insight or reference is really appreciated!

    - Nick
    Last edited by kender_a; January 23rd, 2011 at 03:21 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)