January 23rd, 2011, 04:18 PM
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:
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 ?
private void button1_Click(object sender, EventArgs e)
m_frmOverlay.Bounds = treeView1.RectangleToScreen(treeView1.ClientRectangle);
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!
Last edited by kender_a; January 23rd, 2011 at 04:21 PM.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!