/// <summary> /// /// </summary> /// <remarks> /// Move operations have to be done as a single operation to reduce flickering /// </remarks> private void PositionShadowForms(bool move) { if (!_allowDrawing) { // Probably called before shown is complete return; } void Mi() { bool shadowFormVisible = AllowDrawing; foreach (VisualShadowBase shadowForm in _shadowForms) { shadowForm.Visible = shadowFormVisible; } if (!shadowFormVisible) { return; } Point desktopLocation = _parentForm.DesktopLocation; IntPtr hWinPosInfo = PI.BeginDeferWindowPos(_shadowForms.Length); foreach (VisualShadowBase shadowForm in _shadowForms) { shadowForm.CalcPositionShadowForm(desktopLocation, CommonHelper.RealClientRectangle(_parentForm.Handle)); Rectangle targetRect = shadowForm.TargetRect; hWinPosInfo = PI.DeferWindowPos(hWinPosInfo, shadowForm.Handle, /*PI.HWND_TOPMOST, //*/ _parentForm.Handle, targetRect.X, targetRect.Y, targetRect.Width, targetRect.Height, (move ? PI.SWP_.NOSIZE : 0) | PI.SWP_.NOACTIVATE | PI.SWP_.NOREDRAW | PI.SWP_.SHOWWINDOW | PI.SWP_.NOCOPYBITS | PI.SWP_.NOOWNERZORDER ); } PI.EndDeferWindowPos(hWinPosInfo); } if (_parentForm.InvokeRequired) { _parentForm.Invoke((MethodInvoker)Mi); } else { Mi(); } }