public override void ShowToolBar(Form parent) { base.ShowToolBar(parent); this.frm = new ScrapPaintTextTool(this); this.frm.Left = parent.Left; this.frm.Top = (parent.Top - this.frm.Height) - 20; parent.AddOwnedForm(this.frm); this.frm.Show(); parent.AddOwnedForm(this.frm); }
public override void ShowToolBar(Form parent) { base.ShowToolBar(parent); this.frm = new ScrapPaintPenTool(this, EraseColor.ToArgb() == this._color.ToArgb()); this.frm.Left = parent.Left; this.frm.Top = (parent.Top - this.frm.Height) - 20; parent.AddOwnedForm(this.frm); this.frm.Show(); parent.AddOwnedForm(this.frm); }
// Token: 0x0600051F RID: 1311 RVA: 0x000244EC File Offset: 0x000226EC public override void ShowToolBar(Form parent) { base.ShowToolBar(parent); frm = new ScrapPaintTextTool(this) { Left = parent.Left }; frm.Top = parent.Top - frm.Height - 20; parent.AddOwnedForm(frm); frm.Show(); parent.AddOwnedForm(frm); }
/// <summary> /// Provides support for z-ordering of all popup-forms of the owning Form. /// </summary> /// <param name="e"></param> protected override void OnActivated(EventArgs e) { base.OnActivated(e); if (this.dockManager == null) { return; } Form dockForm = this.dockManager.FindForm(); if (dockForm != null) { //remove and add ourselves again to update the z-order dockForm.RemoveOwnedForm(this); dockForm.AddOwnedForm(this); } DockWindow activeWindow = this.dockManager.ActiveWindow; if (activeWindow != null && activeWindow.FindForm() == this) { return; } foreach (DockTabStrip strip in ControlHelper.GetChildControls <DockTabStrip>(this.dockContainer, true)) { if (strip.ActiveWindow != null && strip.DockManager == this.dockManager) { this.dockManager.ActiveWindow = strip.ActiveWindow; break; } } }
private void floatDockedWindow() { if (ownerForm == null) { ownerForm = this.FindForm(); } if (ownerParentControl == null) { ownerParentControl = this.Parent.Parent; } if (floatingBhvrWin == null || floatingBhvrWin.IsDisposed) { floatingBhvrWin = new Form(); floatingBhvrWin.Text = ownerName + " Editor: "; } this.floatWin_btn.Text = "Dock Window"; floatingBhvrWin.Size = ownerDockablePanel.Size; ownerForm.AddOwnedForm(floatingBhvrWin); ownerForm.Controls.Remove(ownerDockablePanel); floatingBhvrWin.FormClosing += new FormClosingEventHandler(floatingBhvrWin_FormClosing); floatingBhvrWin.Controls.Add(ownerDockablePanel); floatingBhvrWin.Show(); //((SplitContainer)(ownerParentControl.Parent)).Panel2Collapsed = true; isfloating = !isfloating; }
public ToolArgsDialog(LogTabWindow logTabWin, Form parent) { this.logTabWin = logTabWin; parent.AddOwnedForm(this); this.TopMost = parent.TopMost; InitializeComponent(); }
/// <summary> /// Shows the specified Form as a popup window, keeping the /// Owner's title bar active and preparing to cancel the popup /// should the user click anywhere outside the popup window. /// <para>Typical code to use this message is as follows:</para> /// <code> /// frmPopup popup = new frmPopup(); /// Point location = this.PointToScreen(new Point(button1.Left, button1.Bottom)); /// popupHelper.ShowPopup(this, popup, location); /// </code> /// <para>Put as much initialisation code as possible /// into the popup form's constructor, rather than the <see cref="System.Windows.Forms.Load"/> /// event as this will improve visual appearance.</para> /// </summary> /// <param name="Owner">Main form which owns the popup</param> /// <param name="Popup">Window to show as a popup</param> /// <param name="v">Location relative to the screen to show the popup at.</param> public void ShowDropDown(Form Owner, Form DropDown, Point Location) { _owner = Owner; _dropDown = DropDown; Application.AddMessageFilter(_filter); // Start checking for the popup being cancelled DropDown.StartPosition = FormStartPosition.Manual; // Set the location of the popup form: DropDown.Location = Location; Owner.AddOwnedForm(DropDown); // Make it owned by the window that's displaying it: DropDownClosedHandler = new EventHandler(Popup_Closed); // Respond to the Closed event in case the popup is closed by its own internal means DropDown.Closed += DropDownClosedHandler; _dropDownShowing = true; // Show the popup: DropDown.Show(); DropDown.Activate(); // A little bit of fun. We've shown the popup, but because we've kept the main window's // title bar in focus the tab sequence isn't quite right. This can be fixed by sending a tab, // but that on its own would shift focus to the second control in the form. So send a tab, // followed by a reverse-tab. UIApiCalls.keybd_event((byte)Keys.Tab, 0, 0, 0); UIApiCalls.keybd_event((byte)Keys.Tab, 0, UIApiCalls.KEYEVENTF_KEYUP, 0); UIApiCalls.keybd_event((byte)Keys.ShiftKey, 0, 0, 0); UIApiCalls.keybd_event((byte)Keys.Tab, 0, 0, 0); UIApiCalls.keybd_event((byte)Keys.Tab, 0, UIApiCalls.KEYEVENTF_KEYUP, 0); UIApiCalls.keybd_event((byte)Keys.ShiftKey, 0, UIApiCalls.KEYEVENTF_KEYUP, 0); _filter.DropDown = DropDown; // Start filtering for mouse clicks outside the popup }
public void Run(Guid _moduleID, String _testRoomCode, String _moduleName) { moduleID = _moduleID; testRoomCode = _testRoomCode; moduleName = _moduleName; ProgressScreen.Current.ShowSplashScreen(); Owner.AddOwnedForm(ProgressScreen.Current); worker.RunWorkerAsync(this); }
protected virtual void ShowShadow(FAShadow shadow) { if (Form != null) { Form.AddOwnedForm(shadow); } shadow.ShowShadow(); }
private WindowsFormView ActivateForm(WindowsFormView winFormView, ViewSettings viewSettings, Navigator navigator, Guid taskId, string previousView, TaskArgumentsHolder args) { winFormView.InternalTaskId = taskId; winFormView.InternalNavigationGraph = navigator.Name; winFormView.InternalViewName = viewSettings.Name; winFormView.InternalNavigator = navigator; ControllerBase controller = navigator.GetController(winFormView); winFormView.InternalController = controller; InitializeChildren(winFormView, navigator, taskId); winFormView.Initialize(args, viewSettings); AddActiveForm(taskId, viewSettings.Name, winFormView); AddActiveView(taskId, winFormView, viewSettings.Name); LayoutControlsIfRequired(viewSettings, winFormView); winFormView.Activated += new EventHandler(Form_Activated); winFormView.Closed += new EventHandler(Form_Closed); //Get the parent form Form parentForm = (Form)GetProperty(taskId, ParentFormKey); if (winFormView.IsMdiContainer || viewSettings.CanHaveFloatingWindows) { StoreProperty(taskId, ParentFormKey, winFormView); } else if (parentForm != null) { if (parentForm.IsMdiContainer) { winFormView.MdiParent = parentForm; } else if (viewSettings.IsFloatable) { winFormView.TopLevel = true; parentForm.AddOwnedForm(winFormView); winFormView.Show(); } } if (viewSettings.IsOpenModal) { ShowModal(winFormView, previousView, taskId, parentForm); } else { winFormView.Show(); } return(winFormView); }
public void Show(Point location) { ModuleProc PROC = new ModuleProc("PopupFormHelper", "Show"); try { // Start checking for the popup being cancelled Application.AddMessageFilter(filter); // Set the location of the popup form: popup.StartPosition = FormStartPosition.Manual; popup.Location = location; // Make it owned by the window that's displaying it: owner.AddOwnedForm(popup); // Respond to the Closed event in case the popup // is closed by its own internal means popClosedHandler = new EventHandler(Popup_Closed); popup.Closed += popClosedHandler; // Show the popup: this.popupShowing = true; popup.Show(); popup.Activate(); // A little bit of fun. We've shown the popup, // but because we've kept the main window's // title bar in focus the tab sequence isn't quite // right. This can be fixed by sending a tab, // but that on its own would shift focus to the // second control in the form. So send a tab, // followed by a reverse-tab. // Send a Tab command: keybd_event((byte)Keys.Tab, 0, 0, 0); keybd_event((byte)Keys.Tab, 0, KEYEVENTF_KEYUP, 0); // Send a reverse Tab command: keybd_event((byte)Keys.ShiftKey, 0, 0, 0); keybd_event((byte)Keys.Tab, 0, 0, 0); keybd_event((byte)Keys.Tab, 0, KEYEVENTF_KEYUP, 0); keybd_event((byte)Keys.ShiftKey, 0, KEYEVENTF_KEYUP, 0); // Start filtering for mouse clicks outside the popup filter.Popup = popup; } catch (Exception ex) { Log.Exception(PROC, ex); } }
protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); if (this.popupHelper != null) { Form owner = this.dockManager.FindForm(); if (owner != null) { owner.AddOwnedForm(this); this.popupHelper.AssignHandle(owner.Handle); } } }
public static SupportingFilesForm ShowForm(Form parent, BlogPostEditingManager editingManager) { SupportingFilesForm supportingFilesForm = new SupportingFilesForm(); parent.AddOwnedForm(supportingFilesForm); supportingFilesForm.Show(); Point location = parent.Location; Size size = parent.Size; supportingFilesForm.Location = new Point(location.X + size.Width + 2, location.Y); supportingFilesForm.BlogPostEditingManager = editingManager; return(supportingFilesForm); }
public OverlayForm(Form form) { InitializeComponent(); if (form != null) { real = form; real.Move += Form_Move; real.Resize += Form_Resize; real.Shown += Form_Move; real.Shown += Form_Resize; real.AddOwnedForm(this); } //Show(); }
public void ShowPopup(Form owner, Form popup, Point location, bool TabOrderFix) { this.owner = owner; this.popup = popup; // Start checking for the popup being cancelled Application.AddMessageFilter(filter); // Set the location of the popup form: popup.StartPosition = FormStartPosition.Manual; popup.Location = location; // Make it owned by the window that's displaying it: owner.AddOwnedForm(popup); // Respond to the Closed event in case the popup // is closed by its own internal means popClosedHandler = new EventHandler(popup_Closed); popup.Closed += popClosedHandler; // Show the popup: this.popupShowing = true; popup.Show(); popup.Activate(); // A little bit of fun. We've shown the popup, // but because we've kept the main window's // title bar in focus the tab sequence isn't quite // right. This can be fixed by sending a tab, // but that on its own would shift focus to the // second control in the form. So send a tab, // followed by a reverse-tab. if (TabOrderFix) { // Send a Tab command: NativeMethods.keybd_event((byte)Keys.Tab, 0, 0, 0); NativeMethods.keybd_event((byte)Keys.Tab, 0, (int)NativeMethods.KeyboardEvent.KeyUp, 0); // Send a reverse Tab command: NativeMethods.keybd_event((byte)Keys.ShiftKey, 0, 0, 0); NativeMethods.keybd_event((byte)Keys.Tab, 0, 0, 0); NativeMethods.keybd_event((byte)Keys.Tab, 0, (int)NativeMethods.KeyboardEvent.KeyUp, 0); NativeMethods.keybd_event((byte)Keys.ShiftKey, 0, (int)NativeMethods.KeyboardEvent.KeyUp, 0); } // Start filtering for mouse clicks outside the popup filter.Popup = popup; }
public frmWMSProp(mwIdentPlugin p) { // // Required for Windows Form Designer support // InitializeComponent(); //get a copy of the parent m_parent = p; //set the parent form System.IntPtr tempPtr = (System.IntPtr)m_parent.m_ParentHandle; Form mapFrm = (Form)System.Windows.Forms.Control.FromHandle(tempPtr); mapFrm.AddOwnedForm(this); }
public void Attach() { attachedWindow.ShowInTaskbar = false; ParentWindow.AddOwnedForm(attachedWindow); MoveWin(Offset); ParentWindow.LocationChanged += (s, g) => { MoveWin(Offset); }; attachedWindow.ResizeEnd += (s, g) => { MoveWin(Offset); }; }
public PopupForm(Popup popup) { mPopup = popup; SetStyle(ControlStyles.ResizeRedraw, true); FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; StartPosition = FormStartPosition.Manual; this.ShowInTaskbar = false; this.DockPadding.All = BORDER_MARGIN; mControlSize = mPopup.mUserControl.Size; mPopup.mUserControl.Dock = DockStyle.Fill; Controls.Add(mPopup.mUserControl); mWindowSize.Width = mControlSize.Width + 2 * BORDER_MARGIN; mWindowSize.Height = mControlSize.Height + 2 * BORDER_MARGIN; Form parentForm = mPopup.mParent.FindForm(); if (parentForm != null) { parentForm.AddOwnedForm(this); }
/// <summary> /// SplashForm_Load /// pictureBox.BackgroundImage を設定するとアニメーション GIF はアニメーションしない /// </summary> private void SplashForm_Load(object sender, System.EventArgs e) { try { _mainForm.AddOwnedForm(_form); // メイン フォームの位置とサイズ #if true Rectangle mainFormRectangle = ccMushroom.windowRectangle; if (mainFormRectangle != Rectangle.Empty) #else string iniFileName = Application.StartupPath + ccMushroom.CCMUSHROOM_INI_FILE_NAME; Rectangle mainFormRectangle; if ((mainFormRectangle = ccMushroom.GetWindowRectangle(iniFileName)) != Rectangle.Empty) #endif { _form.Location = new Point(mainFormRectangle.X + (mainFormRectangle.Width - _form.Width) / 2, mainFormRectangle.Y + (mainFormRectangle.Height - _form.Height) / 2); } // パネルの枠線をフォームサイズに合わせる // OnPaint をオーバーライドして線を引こうとしたが出来なかった(マルチスレッドにしてるから?)のでパネルの外枠でごまかす panel1.Location = new Point(0, 0); panel1.Size = new Size(_form.Size.Width, _form.Size.Height); panel2.Location = new Point(1, 1); panel2.Size = new Size(panel1.Size.Width - 2, panel1.Size.Height - 2); labelMessage1.Text = string.Empty; labelMessage2.Text = string.Empty; //label.Click += new EventHandler(_form_Click); #if (USE_MULTI_THRED_SPLASH_FORM) labelMultiThreadIndicator.Enabled = false; labelMultiThreadIndicator.Location = new Point(_form.Size.Width - labelMultiThreadIndicator.Width - 4, -1); #else labelMultiThreadIndicator.Visible = false; #endif } catch (Exception exp) { MessageBox.Show(exp.Message, MethodBase.GetCurrentMethod().Name, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 显示方向盘控制窗口 /// </summary> /// <param name="pControlList"></param> /// <param name="pParent"></param> /// <returns></returns> public static void ShowArrowForm(DesignSectionList pSectionList, Form pParent) { bool b = false; foreach (Form frm in pParent.OwnedForms) { if (frm.Name == "FrmArrowOperate") { b = true; frm.Show(); break; } } if (!b) { FrmArrowOperate frm = new FrmArrowOperate(pSectionList); pParent.AddOwnedForm(frm); frm.Show(); } }
public DisplayForm(Form parentForm, IRgbEasyCapture capture, ICaptureSwitcher captureSwitcher, IDialogFactory dialogFactory) { _parentForm = parentForm; _capture = capture; _captureSwitcher = captureSwitcher; _dialogFactory = dialogFactory; Form = new Form { FormBorderStyle = FormBorderStyle.FixedSingle }; Form.FormClosing += FormOnFormClosing; Form.Shown += FormOnShown; Form.GotFocus += FormOnGotFocus; Form.KeyDown += FormOnKeyDown; Form.Paint += FormPaint; Form.DoubleClick += FormDoubleClick; capture.ModeChanged += CaptureOnModeChanged; parentForm.AddOwnedForm(Form); Form.Text = $"Vision - {capture.Input + 1}"; }
public StiPopupBaseForm(Control parentControl) { this.SuspendLayout(); this.ParentControl = parentControl; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.MaximizeBox = false; this.MinimizeBox = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.TopMost = false; this.ResumeLayout(); if (parentControl != null) { Form parentForm = parentControl.FindForm(); if (parentForm != null) { parentForm.AddOwnedForm(this); } } }
public static DialogResult ShowDialog(LoginType loginType, Form owner, string applicationName) { try { if (owner == null || owner.IsDisposed) { throw new ArgumentException("owner can not be null or disposed."); } if (_LoginForm != null && !_LoginForm.IsDisposed) { try { _LoginForm.Dispose(); } catch { } } _LoginForm = new LoginForm(loginType, applicationName); owner.AddOwnedForm(_LoginForm); _LoginForm.LoginSucceeded += _LoginForm_LoginSucceeded; DialogResult result = _LoginForm.ShowDialog(owner); _LoginForm.LoginSucceeded -= _LoginForm_LoginSucceeded; return(result); } catch { throw; } }
public clsPopupForm(PopUpWindow wndParent) { Form frmParent = wndParent.Parent.FindForm(); PopUpWindow.PlacementType intPlacement; // Asigna las propiedades al formulario this.wndParent = wndParent; SetStyle(ControlStyles.ResizeRedraw, true); FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; StartPosition = FormStartPosition.Manual; ShowInTaskbar = false; DockPadding.All = cnstIntBorderMagin; sizControl = wndParent.UserControl.Size; wndParent.UserControl.Dock = DockStyle.Fill; Controls.Add(wndParent.UserControl); sizWindow.Width = sizControl.Width + 2 * cnstIntBorderMagin; sizWindow.Height = sizControl.Height + 2 * cnstIntBorderMagin; if (frmParent != null) { frmParent.AddOwnedForm(this); } intPlacement = wndParent.Placement; // Try to place the popup at the asked location ReLocate(); // Check if the form is out of the screen and if yes try to adapt the placement Rectangle rctWorkingArea = Screen.FromControl(wndParent.Parent).WorkingArea; if (pntNormalPos.X + this.Width > rctWorkingArea.Right) { if ((intPlacement & PopUpWindow.PlacementType.Right) != 0) { intPlacement = (intPlacement & ~PopUpWindow.PlacementType.Right) | PopUpWindow.PlacementType.Left; } } else if (pntNormalPos.X < rctWorkingArea.Left) { if ((intPlacement & PopUpWindow.PlacementType.Left) != 0) { intPlacement = (intPlacement & ~PopUpWindow.PlacementType.Left) | PopUpWindow.PlacementType.Right; } } if (pntNormalPos.Y + this.Height > rctWorkingArea.Bottom) { if ((intPlacement & PopUpWindow.PlacementType.Bottom) != 0) { intPlacement = (intPlacement & ~PopUpWindow.PlacementType.Bottom) | PopUpWindow.PlacementType.Top; } } else if (pntNormalPos.Y < rctWorkingArea.Top) { if ((intPlacement & PopUpWindow.PlacementType.Top) != 0) { intPlacement = (intPlacement & ~PopUpWindow.PlacementType.Top) | PopUpWindow.PlacementType.Bottom; } } if (intPlacement != wndParent.Placement) { ReLocate(); } // Check if the form is still out of the screen // if (yes just move it back into the screen without changing Placement if (pntNormalPos.X + sizWindow.Width > rctWorkingArea.Right) { pntNormalPos.X = rctWorkingArea.Right - sizWindow.Width; } else if (pntNormalPos.X < rctWorkingArea.Left) { pntNormalPos.X = rctWorkingArea.Left; } if (pntNormalPos.Y + sizWindow.Height > rctWorkingArea.Bottom) { pntNormalPos.Y = rctWorkingArea.Bottom - sizWindow.Height; } else if (pntNormalPos.Y < rctWorkingArea.Top) { pntNormalPos.Y = rctWorkingArea.Top; } // Initialize the animation dblProgress = 0; if (wndParent.AnimationSpeed > 0) { trmTimer = new Timer(); // I always aim 25 images per seconds.. seems to be a good value // it looks smooth enough on fast computers and do not drain slower one trmTimer.Interval = 1000 / 25; dtmTimerStarted = DateTime.Now; trmTimer.Tick += new EventHandler(Showing); trmTimer.Start(); Showing(null, null); } else { SetFinalLocation(); } Show(); if (OnDropDown != null) { OnDropDown(wndParent.Parent, new EventArgs()); } }
private void ShowDropDownControl(Control control, bool resizeable) { dropdown_form.Size = control.Size; control.Dock = DockStyle.Fill; if (resizeable) { dropdown_form.Padding = dropdown_form_padding; dropdown_form.Width += dropdown_form_padding.Right; dropdown_form.Height += dropdown_form_padding.Bottom; dropdown_form.FormBorderStyle = FormBorderStyle.Sizable; dropdown_form.SizeGripStyle = SizeGripStyle.Show; } else { dropdown_form.FormBorderStyle = FormBorderStyle.None; dropdown_form.SizeGripStyle = SizeGripStyle.Hide; dropdown_form.Padding = Padding.Empty; } dropdown_form.Controls.Add(control); dropdown_form.Width = Math.Max(ClientRectangle.Width - SplitterLocation - (vbar.Visible ? vbar.Width : 0), control.Width); dropdown_form.Location = PointToScreen(new Point(grid_textbox.Right - dropdown_form.Width, grid_textbox.Location.Y + row_height)); RepositionInScreenWorkingArea(dropdown_form); Point location = dropdown_form.Location; Form owner = FindForm(); owner.AddOwnedForm(dropdown_form); dropdown_form.Show(); if (dropdown_form.Location != location) { dropdown_form.Location = location; } System.Windows.Forms.MSG msg = new MSG(); object queue_id = XplatUI.StartLoop(Thread.CurrentThread); control.Focus(); while (dropdown_form.Visible && XplatUI.GetMessage(queue_id, ref msg, IntPtr.Zero, 0, 0)) { switch (msg.message) { case Msg.WM_NCLBUTTONDOWN: case Msg.WM_NCMBUTTONDOWN: case Msg.WM_NCRBUTTONDOWN: case Msg.WM_LBUTTONDOWN: case Msg.WM_MBUTTONDOWN: case Msg.WM_RBUTTONDOWN: if (!HwndInControl(dropdown_form, msg.hwnd)) { CloseDropDown(); } break; case Msg.WM_ACTIVATE: case Msg.WM_NCPAINT: if (owner.window.Handle == msg.hwnd) { CloseDropDown(); } break; } XplatUI.TranslateMessage(ref msg); XplatUI.DispatchMessage(ref msg); } XplatUI.EndLoop(Thread.CurrentThread); }
/// <summary> /// /// </summary> /// <param name="parameters"></param> public StereoDualHeadDisplay(Game game, GraphicsDevice device, GameParameters parameters) : base(game, device, parameters) { try { NvApi.Initialize(); NvApi.Stereo_Disable(); } catch (NVException nvex) { Log.Debug(nvex.Message); } var featureLevel = HardwareProfileChecker.GetFeatureLevel(parameters.GraphicsProfile); Adapter adapter; Output leftOut, rightOut; GetDualHeadAdapter(featureLevel, out adapter, out leftOut, out rightOut); window1 = CreateForm(parameters, leftOut); window2 = CreateForm(parameters, rightOut); window1.Tag = leftOut.Description; window2.Tag = rightOut.Description; window1.AddOwnedForm(window2); window2.Show(); window1.Show(); window1.Resize += window_Resize; window2.Resize += window_Resize; window1.Move += window_Move; window2.Move += window_Move; window1.Activated += window_Activated; window2.Activated += window_Activated; targetForm = window1; var deviceFlags = DeviceCreationFlags.None; deviceFlags |= parameters.UseDebugDevice ? DeviceCreationFlags.Debug : DeviceCreationFlags.None; swapChainDesc1 = new SwapChainDescription() { BufferCount = 1, ModeDescription = new ModeDescription(parameters.Width, parameters.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm), IsWindowed = true, OutputHandle = window1.Handle, SampleDescription = new SampleDescription(parameters.MsaaLevel, 0), SwapEffect = SwapEffect.Discard, Usage = Usage.RenderTargetOutput, Flags = SwapChainFlags.None, }; swapChainDesc2 = new SwapChainDescription() { BufferCount = 1, ModeDescription = new ModeDescription(parameters.Width, parameters.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm), IsWindowed = true, OutputHandle = window2.Handle, SampleDescription = new SampleDescription(parameters.MsaaLevel, 0), SwapEffect = SwapEffect.Discard, Usage = Usage.RenderTargetOutput, Flags = SwapChainFlags.None, }; d3dDevice = new D3D.Device(adapter, deviceFlags, featureLevel); using (var factory = adapter.GetParent <Factory>()) { swapChain1 = new SwapChain(factory, d3dDevice, swapChainDesc1); swapChain2 = new SwapChain(factory, d3dDevice, swapChainDesc2); //factory.MakeWindowAssociation( new IntPtr(0), WindowAssociationFlags.None ); factory.MakeWindowAssociation(window1.Handle, WindowAssociationFlags.IgnoreAll | WindowAssociationFlags.IgnoreAltEnter); factory.MakeWindowAssociation(window2.Handle, WindowAssociationFlags.IgnoreAll | WindowAssociationFlags.IgnoreAltEnter); } clientWidth = window1.ClientSize.Width; clientHeight = window1.ClientSize.Height; }
private void AddWindow(InfoWindow window) { windows.Add(window.ID, window); parent.AddOwnedForm(window); dropDown.DropDownItems.Add(new ToolStripMenuItem(window.Text, null, (sender, e) => window.Show())); }
public PopupForm(Popup popup) { mPopup = popup; SetStyle(ControlStyles.ResizeRedraw, true); FormBorderStyle = FormBorderStyle.None; StartPosition = FormStartPosition.Manual; this.ShowInTaskbar = false; this.DockPadding.All = BORDER_MARGIN; mControlSize = mPopup.mUserControl.Size; mPopup.mUserControl.Dock = DockStyle.Fill; Controls.Add(mPopup.mUserControl); mWindowSize.Width = mControlSize.Width + 2 * BORDER_MARGIN; mWindowSize.Height = mControlSize.Height + 2 * BORDER_MARGIN; this.Opacity = popup.mOpacity; //These are here to suppress warnings. this.DropDown += new System.EventHandler(DoNothing); this.DropDownClosed += new System.EventHandler(DoNothing); Form parentForm = mPopup.mParent.FindForm(); if (parentForm != null) { parentForm.AddOwnedForm(this); } if (mPopup.mResizable) { mResizingPanel = new Panel(); if (mBackgroundImage == null) { var resources = new System.Resources.ResourceManager(typeof(Popup)); mBackgroundImage = (System.Drawing.Image)resources.GetObject("CornerPicture.Image"); } mResizingPanel.BackgroundImage = mBackgroundImage; mResizingPanel.Width = 12; mResizingPanel.Height = 12; mResizingPanel.BackColor = Color.Red; mResizingPanel.Left = mPopup.mUserControl.Width - 15; mResizingPanel.Top = mPopup.mUserControl.Height - 15; mResizingPanel.Cursor = Cursors.SizeNWSE; mResizingPanel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; mResizingPanel.Parent = this; mResizingPanel.BringToFront(); this.mResizingPanel.MouseUp += new MouseEventHandler(mResizingPanel_MouseUp); this.mResizingPanel.MouseDown += new MouseEventHandler(mResizingPanel_MouseDown); this.mResizingPanel.MouseMove += new MouseEventHandler(mResizingPanel_MouseMove); } mPlacement = mPopup.mPlacement; // Try to place the popup at the asked location ReLocate(); // Check if the form is out of the screen // And if yes try to adapt the placement Rectangle workingArea = Screen.FromControl(mPopup.mParent).WorkingArea; if (mNormalPos.X + this.Width > workingArea.Right) { if ((mPlacement & ePlacement.Right) != 0) { mPlacement = (mPlacement & ~ePlacement.Right) | ePlacement.Left; } } else { if (mNormalPos.X < workingArea.Left) { if ((mPlacement & ePlacement.Left) != 0) { mPlacement = (mPlacement & ~ePlacement.Left) | ePlacement.Right; } } } if (mNormalPos.Y + this.Height > workingArea.Bottom) { if ((mPlacement & ePlacement.Bottom) != 0) { mPlacement = (mPlacement & ~ePlacement.Bottom) | ePlacement.Top; } } else { if (mNormalPos.Y < workingArea.Top) { if ((mPlacement & ePlacement.Top) != 0) { mPlacement = (mPlacement & ~ePlacement.Top) | ePlacement.Bottom; } } } if (mPlacement != mPopup.mPlacement) { ReLocate(); } // Check if the form is still out of the screen // If yes just move it back into the screen without changing Placement if (mNormalPos.X + mWindowSize.Width > workingArea.Right) { mNormalPos.X = workingArea.Right - mWindowSize.Width; } else { if (mNormalPos.X < workingArea.Left) { mNormalPos.X = workingArea.Left; } } if (mNormalPos.Y + mWindowSize.Height > workingArea.Bottom) { mNormalPos.Y = workingArea.Bottom - mWindowSize.Height; } else { if (mNormalPos.Y < workingArea.Top) { mNormalPos.Y = workingArea.Top; } } // Initialize the animation mProgress = 0; if (mPopup.mAnimationSpeed > 0) { mTimer = new Timer(); // I always aim 25 images per seconds.. seems to be a good value // it looks smooth enough on fast computers and do not drain slower one mTimer.Interval = 1000 / 25; mTimerStarted = System.DateTimeOffset.Now; mTimer.Tick += new System.EventHandler(Showing); mTimer.Start(); Showing(null, null); } else { SetFinalLocation(); } Show(); mPopup.OnDropDown(mPopup.mParent, new System.EventArgs()); }
public void TestPublicMethods() { // Public Methods that force Handle creation: // - CreateGraphics () // - GetChildAtPoint () // - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created // - PointToClient () // - PointToScreen () // - RectangleToClient () // - RectangleToScreen () // - Select () // - Show (IWin32Window) // Notes: // - CreateControl does NOT force Handle creation! Form c = new Form(); c.BringToFront(); Assert.IsFalse(c.IsHandleCreated, "A1"); c.Contains(new Form()); Assert.IsFalse(c.IsHandleCreated, "A2"); c.CreateControl(); Assert.IsFalse(c.IsHandleCreated, "A3"); c = new Form(); Graphics g = c.CreateGraphics(); g.Dispose(); Assert.IsTrue(c.IsHandleCreated, "A4"); c.Dispose(); c = new Form(); c.Dispose(); Assert.IsFalse(c.IsHandleCreated, "A5"); c = new Form(); // This is weird, it causes a form to appear that won't go away until you move the mouse over it, // but it doesn't create a handle?? //DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None); //Assert.IsFalse (c.IsHandleCreated, "A6"); //Assert.AreEqual (DragDropEffects.None, d, "A6b"); //Bitmap b = new Bitmap (100, 100); //c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100)); //Assert.IsFalse (c.IsHandleCreated, "A7"); //b.Dispose (); c.FindForm(); Assert.IsFalse(c.IsHandleCreated, "A8"); c.Focus(); Assert.IsFalse(c.IsHandleCreated, "A9"); c.GetChildAtPoint(new Point(10, 10)); Assert.IsTrue(c.IsHandleCreated, "A10"); c.Dispose(); c = new Form(); c.GetContainerControl(); Assert.IsFalse(c.IsHandleCreated, "A11"); c.Dispose(); c = new Form(); c.GetNextControl(new Control(), true); Assert.IsFalse(c.IsHandleCreated, "A12"); c.GetPreferredSize(Size.Empty); Assert.IsFalse(c.IsHandleCreated, "A13"); c.Hide(); Assert.IsFalse(c.IsHandleCreated, "A14"); c.Invalidate(); Assert.IsFalse(c.IsHandleCreated, "A15"); //c.Invoke (new InvokeDelegate (InvokeMethod)); //Assert.IsFalse (c.IsHandleCreated, "A16"); c.PerformLayout(); Assert.IsFalse(c.IsHandleCreated, "A17"); c.PointToClient(new Point(100, 100)); Assert.IsTrue(c.IsHandleCreated, "A18"); c.Dispose(); c = new Form(); c.PointToScreen(new Point(100, 100)); Assert.IsTrue(c.IsHandleCreated, "A19"); c.Dispose(); c = new Form(); //c.PreProcessControlMessage ??? //c.PreProcessMessage ??? c.RectangleToClient(new Rectangle(0, 0, 100, 100)); Assert.IsTrue(c.IsHandleCreated, "A20"); c.Dispose(); c = new Form(); c.RectangleToScreen(new Rectangle(0, 0, 100, 100)); Assert.IsTrue(c.IsHandleCreated, "A21"); c.Dispose(); c = new Form(); c.Refresh(); Assert.IsFalse(c.IsHandleCreated, "A22"); c.ResetBackColor(); Assert.IsFalse(c.IsHandleCreated, "A23"); c.ResetBindings(); Assert.IsFalse(c.IsHandleCreated, "A24"); c.ResetCursor(); Assert.IsFalse(c.IsHandleCreated, "A25"); c.ResetFont(); Assert.IsFalse(c.IsHandleCreated, "A26"); c.ResetForeColor(); Assert.IsFalse(c.IsHandleCreated, "A27"); c.ResetImeMode(); Assert.IsFalse(c.IsHandleCreated, "A28"); c.ResetRightToLeft(); Assert.IsFalse(c.IsHandleCreated, "A29"); c.ResetText(); Assert.IsFalse(c.IsHandleCreated, "A30"); c.SuspendLayout(); Assert.IsFalse(c.IsHandleCreated, "A31"); c.ResumeLayout(); Assert.IsFalse(c.IsHandleCreated, "A32"); c.Scale(new SizeF(1.5f, 1.5f)); Assert.IsFalse(c.IsHandleCreated, "A33"); c.Select(); Assert.IsTrue(c.IsHandleCreated, "A34"); c.Dispose(); c = new Form(); c.SelectNextControl(new Control(), true, true, true, true); Assert.IsFalse(c.IsHandleCreated, "A35"); c.SetBounds(0, 0, 100, 100); Assert.IsFalse(c.IsHandleCreated, "A36"); c.Update(); Assert.IsFalse(c.IsHandleCreated, "A37"); // Form c.Activate(); Assert.IsFalse(c.IsHandleCreated, "F1"); c.AddOwnedForm(new Form()); Assert.IsFalse(c.IsHandleCreated, "F2"); c.Close(); Assert.IsFalse(c.IsHandleCreated, "F3"); c.Hide(); Assert.IsFalse(c.IsHandleCreated, "F4"); c.LayoutMdi(MdiLayout.Cascade); Assert.IsFalse(c.IsHandleCreated, "F5"); #if !__MonoCS__ c.PerformAutoScale(); Assert.IsFalse(c.IsHandleCreated, "F6"); #endif c.PerformLayout(); Assert.IsFalse(c.IsHandleCreated, "F7"); c.AddOwnedForm(new Form()); c.RemoveOwnedForm(c.OwnedForms [c.OwnedForms.Length - 1]); Assert.IsFalse(c.IsHandleCreated, "F8"); c.ScrollControlIntoView(null); Assert.IsFalse(c.IsHandleCreated, "F9"); c.SetAutoScrollMargin(7, 13); Assert.IsFalse(c.IsHandleCreated, "F10"); c.SetDesktopBounds(-1, -1, 144, 169); Assert.IsFalse(c.IsHandleCreated, "F11"); c.SetDesktopLocation(7, 13); Assert.IsFalse(c.IsHandleCreated, "F12"); c = new Form(); c.Show(null); Assert.IsTrue(c.IsHandleCreated, "F13"); c.Close(); c = new Form(); //c.ShowDialog () c.ToString(); Assert.IsFalse(c.IsHandleCreated, "F14"); c.Validate(); Assert.IsFalse(c.IsHandleCreated, "F15"); #if !__MonoCS__ c.ValidateChildren(); Assert.IsFalse(c.IsHandleCreated, "F16"); #endif c.Close(); }
private ModelessMessageBox(Form owner, string text, string caption, string okText, string cancelText) { var okButton = new Button(); okButton.DialogResult = DialogResult.OK; okButton.UseVisualStyleBackColor = true; okButton.AutoSize = true; okButton.AutoSizeMode = AutoSizeMode.GrowAndShrink; okButton.Text = okText; okButton.Click += ButtonClicked; var cancelButton = new Button(); cancelButton.DialogResult = DialogResult.Cancel; cancelButton.UseVisualStyleBackColor = true; cancelButton.AutoSize = true; cancelButton.AutoSizeMode = AutoSizeMode.GrowAndShrink; cancelButton.Text = cancelText; cancelButton.Click += ButtonClicked; var buttonPanel = new FlowLayoutPanel(); buttonPanel.SuspendLayout(); buttonPanel.FlowDirection = FlowDirection.RightToLeft; buttonPanel.AutoSize = true; buttonPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink; buttonPanel.Dock = DockStyle.Bottom; buttonPanel.Controls.Add(cancelButton); buttonPanel.Controls.Add(okButton); var bodyText = new Label(); bodyText.SuspendLayout(); bodyText.AutoSize = true; bodyText.MaximumSize = new Size(400, 400); bodyText.Padding = new Padding(10); bodyText.Dock = DockStyle.Fill; bodyText.Text = text; this.SuspendLayout(); this.AutoScaleMode = AutoScaleMode.Font; this.AutoSize = true; this.AutoSizeMode = AutoSizeMode.GrowAndShrink; this.AcceptButton = okButton; this.CancelButton = cancelButton; this.ControlBox = false; this.Controls.Add(bodyText); this.Controls.Add(buttonPanel); this.FormBorderStyle = FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = FormStartPosition.CenterScreen; this.Text = caption; buttonPanel.ResumeLayout(false); buttonPanel.PerformLayout(); bodyText.ResumeLayout(false); bodyText.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); owner.AddOwnedForm(this); this.Show(owner); this.Invalidate(); }