I am trying to drag and resize controls during runtime with the same look and feel that VS does it. I paint the Handles and Selection Frames when a control gets the focus. However I need to remove them when the control loses focus. The Control_LostFocus function does not remove them. However, if I set a break point in the Control_Lostfocus function and them step out, the handles and Frame are removed. Why does break point do this? How can I resolve this issue?

ControlsHash is a Hash table containing the controls.

Thanks

Matt


Code:
private void Control_GotFocus(Object sender, EventArgs e) {
	// Retrieve related info
	Control c = (Control) sender;	
	ControlInfo info = (ControlInfo) ControlsHash[c];			
	if(info.Enabled) {				
		//Resizable rectangle
		Rectangle rectOutside = new Rectangle(c.Location.X-6, c.Location.Y-6, c.Width+12, c.Height+12);
		Rectangle rectInside = new Rectangle(c.Location.X, c.Location.Y, c.Width, c.Height);
		ControlPaint.DrawSelectionFrame(GraphicPainter, true, rectOutside, rectInside, Color.Transparent);

		Rectangle rect = new Rectangle(c.Location.X-8, c.Location.Y-8, 8, 8);
		ControlPaint.DrawGrabHandle( GraphicPainter, rect, true, true);
		rect.X = (c.Width-8)/2+ c.Location.X;
		ControlPaint.DrawGrabHandle( GraphicPainter, rect, true, true);
		rect.X = c.Width + c.Location.X;
		ControlPaint.DrawGrabHandle( GraphicPainter, rect, true, true);

		rect.X = c.Location.X-8;
		rect.Y =  c.Location.Y + c.Height;
		ControlPaint.DrawGrabHandle( GraphicPainter, rect, true, true);
		rect.X = (c.Width-8)/2+ c.Location.X;
		ControlPaint.DrawGrabHandle( GraphicPainter, rect, true, true);
		rect.X = c.Width + c.Location.X;
		ControlPaint.DrawGrabHandle( GraphicPainter, rect, true, true);
	}
}

private void Control_LostFocus(Object sender, EventArgs e) {
	Control c = (Control) sender;
	Rectangle rectOutside = new Rectangle(c.Location.X-8, c.Location.Y-8, c.Width+16, c.Height+16);
	c.Invalidate(rectOutside);
	c.Update();
}