/****** End For DEBUG & TEST PURPOSES ***/ public FormFURSCommunication(usrc_FVI_SLO Parent, Thread_FVI_Message msg) { InitializeComponent(); if (Parent.FursTESTEnvironment) { lbl_TEST_Environment.Visible = true; } else { lbl_TEST_Environment.Visible = false; } m_usrc_FVI_SLO = Parent; m_msg = msg; iForm_Default_Height = this.Height; iForm_Default_Width = this.Width; /****** For DEBUG & TEST PURPOSES ***/ if (m_usrc_FVI_SLO.DEBUG) { default_FormBorderStyle = this.FormBorderStyle; Show_usrc_DEBUG_MessagePreview(); } /****** End For DEBUG & TEST PURPOSES ***/ // this.Location = m_parent.ParentForm.Location; // Point p = new Point(m_parent.ParentForm.Width / 2 - this.Width / 2, m_parent.ParentForm.Height / 2 - this.Height / 2); // this.Location = p; }
public override void BeginScreenDeviceChange(bool willBeFullScreen) { if (willBeFullScreen && !isFullScreenMaximized && form != null) { savedFormBorderStyle = form.FormBorderStyle; } if (willBeFullScreen != isFullScreenMaximized) { deviceChangeChangedVisible = true; oldVisible = Visible; Visible = false; if (form != null) form.SendToBack(); } else { deviceChangeChangedVisible = false; } if (!willBeFullScreen && isFullScreenMaximized && form != null) { form.TopMost = false; form.FormBorderStyle = savedFormBorderStyle; } deviceChangeWillBeFullScreen = willBeFullScreen; }
public c000081(Game p0, GraphicsDeviceManager p1) { this.f0000b5 = TextureFilter.Point; this.f00000a = false; this.f000051 = Color.Black; this.f0000b6 = FormBorderStyle.Fixed3D; this.f0000a1 = false; this.f0000b5 = TextureFilter.Linear; this.f00000b = 800; this.f00000f = 600; this.f000057 = false; this.f0000b7 = MultiSampleType.TwoSamples; if (p1 != null) { this.f000056 = p1.IsFullScreen; } this.m000001(); if (p0 != null) { this.m000004(p0.Window.ClientBounds.Width); this.m00004b(p0.Window.ClientBounds.Height); } if ((p1 != null) && !p1.GraphicsDevice.CreationParameters.Adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, SurfaceFormat.Color, this.m000008(), this.m0000ed())) { this.m0000ee(MultiSampleType.None); } this.m000003(); }
private void Launcher_Load(object sender, EventArgs e) { this.Icon = DnDCS.Win.Libs.Assets.AssetsLoader.LauncherIcon; initialFormTopMost = this.TopMost; initialFormBorderStyle = this.FormBorderStyle; initialFormWindowState = this.WindowState; if (this.runMode.HasValue) { switch (this.runMode.Value) { case Constants.RunMode.Client: this.btnClient.PerformClick(); break; case Constants.RunMode.Server: this.btnServer.PerformClick(); break; default: break; } } }
public void Save(Form targetForm) { winState = targetForm.WindowState; brdStyle = targetForm.FormBorderStyle; topMost = targetForm.TopMost; bounds = targetForm.Bounds; }
public WidgetModeManager(Form form) { this._form = form; _defBackColor = form.BackColor; _defTransparencyKey = form.TransparencyKey; _defBorderStyle = form.FormBorderStyle; //set middle-mouse form-wide for toggling modes SetMouseEvents(form); }
public static Form OpenShowForm(Control pControl, FormBorderStyle pFormBorderStyle, FormStartPosition pFormStartPosition) { var frm = new Form(); frm.Width = pControl.Width; frm.Height = pControl.Height; frm.FormBorderStyle = pFormBorderStyle; frm.StartPosition = pFormStartPosition; frm.Controls.Add(pControl); frm.ShowDialog(); return frm; }
/// <summary> /// Create a new window for ThemeColorPicker. /// </summary> /// <param name="startLocation">The starting position on screen. Note: This is not location in Form.</param> /// <param name="borderStyle">How the border should displayed.</param> /// <param name="actionAfterColorSelected">The form action of 0o-.</param> /// <param name="actionAfterLostFocus"></param> public ThemeColorPickerWindow(Point startLocation, FormBorderStyle borderStyle, Action actionAfterColorSelected, Action actionAfterLostFocus) { InitializeComponent(); this.StartPosition = FormStartPosition.Manual; this.Location = startLocation; this.FormBorderStyle = borderStyle; this.ActionAfterColorSelected = actionAfterColorSelected; this.ActionAfterLostFocus = actionAfterLostFocus; this.LostFocus += new EventHandler(ThemeColorPickerWindow_LostFocus); this.Deactivate += new EventHandler(ThemeColorPickerWindow_Deactivate); themeColorPicker1.ShowCustomMoreColorWindow += new ThemeColorPicker.moreColorWindowShow(themeColorPicker1_ShowCustomMoreColorWindow); }
public void SetUpFixture() { doc = new WixDocument(); doc.LoadXml(GetWixXml()); WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader()); using (Form simpleDialog = wixDialog.CreateDialog()) { dialogName = simpleDialog.Name; borderStyle = simpleDialog.FormBorderStyle; clientSize = simpleDialog.ClientSize; minimizeBox = simpleDialog.MinimizeBox; maximizeBox = simpleDialog.MaximizeBox; } }
// Constructor. public Form() { visible = false; autoScale = true; topLevel = true; loaded=false; borderStyle = FormBorderStyle.Sizable; mdiChildren = new Form [0]; ownedForms = new Form [0]; opacity = 1.0; windowFlags = ToolkitWindowFlags.Default; formStartPosition = FormStartPosition.WindowsDefaultLocation; windowState = FormWindowState.Normal; }
public FormRtlLayout(FormBorderStyle borderStyle, Size minSize, Icon icon, Color bgColor, string text) { InitializeComponent(); FormBorderStyle = borderStyle; _minSize = minSize; //_maxSize = maxSize; Icon = icon; _bgColor = bgColor; _text = text; //RightToLeft = RightToLeft.Yes; //RightToLeftLayout = true; }
public void Read(Form form) { windowState = form.WindowState; form.WindowState = FormWindowState.Normal; clientSize = form.ClientSize; left = form.Left; top = form.Top; topMost = form.TopMost; borderStyle = form.FormBorderStyle; form.WindowState = windowState; }
/// <summary> /// Creates the form that contains the invoking user control as its only child component. /// </summary> public static Form createContainingForm(this UserControl ctrl, FormBorderStyle borderStyle = FormBorderStyle.Sizable) { Form obj = new Form(); Panel pane = new Panel(); pane.Parent = obj; pane.Dock = DockStyle.Fill; pane.MinimumSize = ctrl.MinimumSize; pane.MaximumSize = ctrl.MaximumSize; // determine minimum size for the form if (!pane.MinimumSize.IsEmpty) { pane.Size = pane.MinimumSize; obj.ClientSize = pane.Size; obj.MinimumSize = obj.Size; } // determine maximum size for the form if (!pane.MaximumSize.IsEmpty) { pane.Size = pane.MaximumSize; obj.ClientSize = pane.Size; obj.MaximumSize = obj.Size; } // set normal pane.Size = ctrl.Size; obj.ClientSize = pane.Size; // make it. ctrl.Parent = pane; ctrl.Dock = DockStyle.Fill; obj.FormBorderStyle = borderStyle; obj.Text = ctrl.Text; // keyboard events should be passed to the form now. obj.KeyPreview = true; return obj; }
public static ShowForm Show(Control c_,FormBorderStyle borderStyle_,Icon icon_, string title_) { ShowForm sf = new ShowForm(); sf.FormBorderStyle = borderStyle_; sf.Text = title_; sf.Create(c_); sf.Icon = icon_; if (icon_ == null && c_ is IFormIconProvider) sf.Icon = ((IFormIconProvider)c_).FormIcon; else sf.Icon = DefaultIcon; sf.Show(); sf.BringToFront(); return sf; }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this.gameForm = (Form)Form.FromHandle(this.Window.Handle); this.defaultBorderStyle = this.gameForm.FormBorderStyle; this.SetBorderStyle(null, null); UserControl1.ToggleMenuWindowControlButtons += SetBorderStyle; this.CreateNotifyicon(); graphics.PreferredBackBufferWidth = 400; graphics.PreferredBackBufferHeight = 500; // Create the screen manager component. screenManager = new ScreenManager(this); Components.Add(screenManager); // Activate the first screens. screenManager.AddScreen(new GamesMenuScreen(), null); }
public void SwitchFullscreen(FullscreenMode mode) { if (IsFullscreen) { MoveToFullscreenMode(mode); return; } if (!_mainForm.ThumbnailPanel.IsShowingThumbnail) return; //On switch, always hide side panels _mainForm.CloseSidePanel(); //Store state _preFullscreenLocation = _mainForm.Location; _preFullscreenSize = _mainForm.ClientSize; _preFullscreenBorderStyle = _mainForm.FormBorderStyle; //Change state to fullscreen _mainForm.FormBorderStyle = FormBorderStyle.None; MoveToFullscreenMode(mode); CommonCompleteSwitch(true); }
protected virtual bool ShouldRemoveWindowManager (FormBorderStyle style) { return style != FormBorderStyle.FixedToolWindow && style != FormBorderStyle.SizableToolWindow; }
public Form ShowPopup(Control host, Control content, FormBorderStyle style) { return(ShowPopup(host, content, style, false)); }
public static DialogResult Show(IWin32Window owner, string caption, Control content, FormBorderStyle borderStyle, MessageBoxButtons buttons = MessageBoxButtons.OKCancel) { return(new UserDialog(owner, content, buttons) { Text = caption, FormBorderStyle = borderStyle }.ShowDialog(owner)); }
/// <inheritdoc /> public override void BeginScreenDeviceChange(bool willBeFullScreen) { if (gameForm != null) oldClientSize = gameForm.ClientSize; if (willBeFullScreen && !isFullScreenMaximized && gameForm != null) { savedFormBorderStyle = gameForm.FormBorderStyle; savedWindowState = gameForm.WindowState; savedBounds = gameForm.Bounds; if (gameForm.WindowState == FormWindowState.Maximized) savedRestoreBounds = gameForm.RestoreBounds; } if (willBeFullScreen != isFullScreenMaximized) { deviceChangeChangedVisible = true; oldVisible = Visible; Visible = false; if (gameForm != null) gameForm.SendToBack(); } else { deviceChangeChangedVisible = false; } if (!willBeFullScreen && isFullScreenMaximized && gameForm != null) { gameForm.TopMost = false; gameForm.FormBorderStyle = savedFormBorderStyle; } deviceChangeWillBeFullScreen = willBeFullScreen; }
/// <summary> /// Saves the state before maximizing /// </summary> public void Save(Form form) { this.winState = form.WindowState; this.borderStyle = form.FormBorderStyle; this.windowBounds = form.Bounds; }
public FormParameters(FormWindowState windowState, FormBorderStyle borderStyle, Point location, Size size, bool visible, bool showIcon, bool topMost) : this() { WindowState = windowState; BorderStyle = borderStyle; Location = location; Size = size; Visible = visible; ShowIcon = showIcon; TopMost = topMost; }
protected override bool ShouldRemoveWindowManager (FormBorderStyle style) { return false; }
/// <summary> /// 最大化 最小化设置 /// </summary> /// <param name="maximizeBox"></param> /// <param name="minimizeBox"></param> /// <param name="borderStyle">边框样式</param> public FormWindowProp(bool maximizeBox, bool minimizeBox, FormBorderStyle borderStyle) { this.maximizeBox = maximizeBox; this.minimizeBox = minimizeBox; FormBorderStyle = borderStyle; }
internal static void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) { DriverDebug("SetBorderStyle ({0}, {1}): Called", Window(handle), border_style); driver.SetBorderStyle(handle, border_style); }
private void Save(Form targetForm) { _brdStyle = targetForm.FormBorderStyle; _topMost = targetForm.TopMost; _bounds = targetForm.Bounds; }
public Win32Context(FormBorderStyle borderStyle = FormBorderStyle.Sizable) : base(new Win32Platform()) { /*displayMode = new DisplayMode(640, 480, 60); * * // Determine the desired version from the type of this generic. * Version desiredVersion; * if (this is GLContext<GL30>) * desiredVersion = new Version(3, 0); * else if (this is GLContext<GL31>) * desiredVersion = new Version(3, 1); * else if (this is GLContext<GL32>) * desiredVersion = new Version(3, 2); * else if (this is GLContext<GL33>) * desiredVersion = new Version(3, 3); * else if (this is GLContext<GL40>) * desiredVersion = new Version(4, 0); * else if (this is GLContext<GL41>) * desiredVersion = new Version(4, 1); * else if (this is GLContext<GL42>) * desiredVersion = new Version(4, 2); * else if (this is GLContext<GL43>) * desiredVersion = new Version(4, 3); * else if (this is GLContext<GLES20>) * desiredVersion = new Version(3, 0); * else if (this is GLContext<GLES30>) * desiredVersion = new Version(3, 0); * else * throw new InitialisationFailedException("OpenGL version is not supported by this library."); * * // Create the form and setup event handlers needed by the context. * var form = new Form(); * form.FormBorderStyle = borderStyle; * form.ClientSize = new System.Drawing.Size(displayMode.Width, displayMode.Height); * // Handling LostFocus and GotFocus allows us to properly handle * // tabbing in and out of full screen. * form.LostFocus += form_LostFocus; * form.GotFocus += form_GotFocus; * // Changing the window size while in windowed mode will update the * // current display mode. * form.SizeChanged += form_SizeChanged; * form.Show(); * * // Set properties that can't be set through the Form class. * // Popup window, clip children, clip siblings. * Win32.SetWindowLong(form.Handle, GetWindowLongOffsets.STYLE, 0x80000000L | 0x02000000L | 0x04000000L); * // Ensure that the window covers the task bar when full screen. * Win32.SetWindowLong(form.Handle, GetWindowLongOffsets.EXSTYLE, 0x00040000L); * * // Create the Win32Window container class for this form. * this.window = new Win32Window(form); * * // Create the pixel format to use * PixelFormatDescriptor pfd = new PixelFormatDescriptor(); * pfd.nSize = (short)System.Runtime.InteropServices.Marshal.SizeOf(pfd); * pfd.nVersion = 1; * pfd.dwFlags = PixelFormatFlags.DoubleBuffer | PixelFormatFlags.DrawToWindow | PixelFormatFlags.SupportOpenGL; | pfd.iPixelType = 0; | pfd.cColorBits = 32; | pfd.cRedBits = 0; | pfd.cRedShift = 0; | pfd.cGreenBits = 0; | pfd.cGreenShift = 0; | pfd.cBlueBits = 0; | pfd.cBlueShift = 0; | pfd.cAlphaBits = 0; | pfd.cAlphaShift = 0; | pfd.cAccumBits = 0; | pfd.cAccumRedBits = 0; | pfd.cAccumGreenBits = 0; | pfd.cAccumBlueBits = 0; | pfd.cAccumAlphaBits = 0; | pfd.cDepthBits = 32; | pfd.cStencilBits = 0; | pfd.cAuxBuffers = 0; | pfd.iLayerType = 0; | pfd.bReserved = 0; | pfd.dwLayerMask = 0; | pfd.dwDamageMask = 0; | pfd.dwVisibleMask = 0; | | // Create the device context, ensure that the requested pixel format | // is supported by that device context, and then set the pixel format. | deviceContext = Win32.GetDC((IntPtr)this.Window.Handle); | if (deviceContext == IntPtr.Zero) | throw new InitialisationFailedException("Could not obtain device context."); | | int pixelFormat = Win32.ChoosePixelFormat(deviceContext, ref pfd); | if (pixelFormat == 0) | throw new InitialisationFailedException("Pixel format is invalid."); | | if (!Win32.SetPixelFormat(deviceContext, pixelFormat, ref pfd)) | throw new InitialisationFailedException("Could not set pixel format.");*/ // Load the core wgl functions. wgl.LoadInitialDelegates(); // Create a temporary context to get function pointers. We must do this to get the function // pointers we need to create an OpenGL 3.2+ context. /*IntPtr tempRC = wgl.CreateContext(deviceContext); * if (tempRC == IntPtr.Zero) * throw new InitialisationFailedException("Unable to create the temporary OpenGL context."); * * wgl.MakeCurrent(deviceContext, tempRC); * * // Create a temporary GL30 object so that we have access to the * // functions necessary to get the gl extension list. * GL30 tempGL = new GL30(this);*/ //wgl.LoadExtensions(deviceContext); // If wgl.CreateContextAttribs is null, then the extension needed to create // and OpenGL 3.2 or higher context is not available. If the requested version // is greater than or equal to 3.2, throw and error. //if (wgl.CreateContextAttribs == null && desiredVersion >= new Version(3, 2)) // throw new InitialisationFailedException("OpenGL 3.2 and up is not supported by the hardware."); // If the extension is not available, but the requested version is 3.0 or 3.1, // use the temporary rendering context. //else if (wgl.CreateContextAttribs == null && this.Version >= new Version(3,0)) // renderingContext = tempRC; //else // Context is available, >= 3.2 is requested //{ // Specifying a profile mask causes CreateContextAttribs to fail with invalid profile on my geforce 560? /* int[] glAttribs = * { * (int)Attrib.ContextMajorVersion, desiredVersion.Major, * (int)Attrib.ContextMinorVersion, desiredVersion.Minor, * (int)Attrib.ContextFlags, 0, * 0 * }; * * // Create a 3.2+ context with the requested context flags. * renderingContext = wgl.CreateContextAttribs(deviceContext, IntPtr.Zero, glAttribs); * if (renderingContext == IntPtr.Zero) * throw new InitialisationFailedException("Unable to create an OpenGL " + desiredVersion + " context."); * * // Replace the temporary rendering context with the new one. * wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero); * wgl.DeleteContext(tempRC); * wgl.MakeCurrent(deviceContext, renderingContext);*/ // } // Create a GL object for the chosen version. if (this is GLContext <GL30> ) { this.GL = (T)((GLBase) new GL30(this)); } if (this is GLContext <GL31> ) { this.GL = (T)((GLBase) new GL31(this)); } if (this is GLContext <GL32> ) { this.GL = (T)((GLBase) new GL32(this)); } if (this is GLContext <GL33> ) { this.GL = (T)((GLBase) new GL33(this)); } if (this is GLContext <GL40> ) { this.GL = (T)((GLBase) new GL40(this)); } if (this is GLContext <GL41> ) { this.GL = (T)((GLBase) new GL41(this)); } if (this is GLContext <GL42> ) { this.GL = (T)((GLBase) new GL42(this)); } if (this is GLContext <GL43> ) { this.GL = (T)((GLBase) new GL43(this)); } if (this is GLContext <GLES20> ) { this.GL = (T)((GLBase) new GLES20(this)); } if (this is GLContext <GLES30> ) { this.GL = (T)((GLBase) new GLES30(this)); } }
/// <summary> /// Constructor /// </summary> /// <param name="dockMode">dock mode of this panel</param> /// <param name="toolWindowsBorder">border of the tool windows from this panel</param> public DockPanel(zDockMode dockMode, FormBorderStyle toolWindowsBorder) { _dockMode = dockMode; _toolWindowsBorderStyle = toolWindowsBorder; }
internal abstract void SetBorderStyle(IntPtr handle, FormBorderStyle border_style);
private void ToggleFullscreen(object sender = null, EventArgs e = null) { if (_isFullscreen) { FormBorderStyle = _previousBorderStyle; WindowState = _previousWindowState; _isFullscreen = false; fullscreenbtn.Text = Resources.FullScreen; } else { _previousBorderStyle = FormBorderStyle; _previousWindowState = WindowState; FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; _isFullscreen = true; fullscreenbtn.Text = Resources.Restore; } }
void DeriveStyles(int Style, int ExStyle, out FormBorderStyle border_style, out bool border_static, out TitleStyle title_style, out int caption_height, out int tool_caption_height) { caption_height = 0; tool_caption_height = 19; border_static = false; if (StyleSet (Style, WindowStyles.WS_CHILD)) { if (ExStyleSet (ExStyle, WindowExStyles.WS_EX_CLIENTEDGE)) { border_style = FormBorderStyle.Fixed3D; } else if (ExStyleSet (ExStyle, WindowExStyles.WS_EX_STATICEDGE)) { border_style = FormBorderStyle.Fixed3D; border_static = true; } else if (!StyleSet (Style, WindowStyles.WS_BORDER)) { border_style = FormBorderStyle.None; } else { border_style = FormBorderStyle.FixedSingle; } title_style = TitleStyle.None; if (StyleSet (Style, WindowStyles.WS_CAPTION)) { caption_height = 19; if (ExStyleSet (ExStyle, WindowExStyles.WS_EX_TOOLWINDOW)) { title_style = TitleStyle.Tool; } else { title_style = TitleStyle.Normal; } } if (ExStyleSet (ExStyle, WindowExStyles.WS_EX_MDICHILD)) { caption_height = 19; if (StyleSet (Style, WindowStyles.WS_OVERLAPPEDWINDOW) || ExStyleSet (ExStyle, WindowExStyles.WS_EX_TOOLWINDOW)) { border_style = (FormBorderStyle) 0xFFFF; } else { border_style = FormBorderStyle.None; } } } else { title_style = TitleStyle.None; if (StyleSet (Style, WindowStyles.WS_CAPTION)) { if (ExStyleSet (ExStyle, WindowExStyles.WS_EX_TOOLWINDOW)) { title_style = TitleStyle.Tool; } else { title_style = TitleStyle.Normal; } } border_style = FormBorderStyle.None; if (StyleSet (Style, WindowStyles.WS_THICKFRAME)) { if (ExStyleSet (ExStyle, WindowExStyles.WS_EX_TOOLWINDOW)) { border_style = FormBorderStyle.SizableToolWindow; } else { border_style = FormBorderStyle.Sizable; } } else { if (StyleSet (Style, WindowStyles.WS_CAPTION)) { if (ExStyleSet (ExStyle, WindowExStyles.WS_EX_CLIENTEDGE)) { border_style = FormBorderStyle.Fixed3D; } else if (ExStyleSet (ExStyle, WindowExStyles.WS_EX_STATICEDGE)) { border_style = FormBorderStyle.Fixed3D; border_static = true; } else if (ExStyleSet (ExStyle, WindowExStyles.WS_EX_DLGMODALFRAME)) { border_style = FormBorderStyle.FixedDialog; } else if (ExStyleSet (ExStyle, WindowExStyles.WS_EX_TOOLWINDOW)) { border_style = FormBorderStyle.FixedToolWindow; } else if (StyleSet (Style, WindowStyles.WS_BORDER)) { border_style = FormBorderStyle.FixedSingle; } } else { if (StyleSet (Style, WindowStyles.WS_BORDER)) { border_style = FormBorderStyle.FixedSingle; } } } } }
public static DialogResult Show (IWin32Window owner, string caption, Control content, FormBorderStyle borderStyle, MessageBoxButtons buttons = MessageBoxButtons.OKCancel) { return new UserDialog(owner, content, buttons) { Text = caption, FormBorderStyle = borderStyle }.ShowDialog(owner); }
public Form () { SizeF current_scale = GetAutoScaleSize (Font); autoscale = true; autoscale_base_size = new Size ((int)Math.Round (current_scale.Width), (int)Math.Round(current_scale.Height)); allow_transparency = false; closing = false; is_modal = false; dialog_result = DialogResult.None; start_position = FormStartPosition.WindowsDefaultLocation; form_border_style = FormBorderStyle.Sizable; window_state = FormWindowState.Normal; key_preview = false; opacity = 1D; menu = null; icon = default_icon; minimum_size = Size.Empty; maximum_size = Size.Empty; clientsize_set = Size.Empty; control_box = true; minimize_box = true; maximize_box = true; help_button = false; show_in_taskbar = true; is_visible = false; is_toplevel = true; size_grip_style = SizeGripStyle.Auto; maximized_bounds = Rectangle.Empty; default_maximized_bounds = Rectangle.Empty; owned_forms = new Form.ControlCollection(this); transparency_key = Color.Empty; CreateDockPadding (); InternalClientSize = new Size (this.Width - (SystemInformation.FrameBorderSize.Width * 2), this.Height - (SystemInformation.FrameBorderSize.Height * 2) - SystemInformation.CaptionHeight); restore_bounds = Bounds; }
public void Form2_Load() { // When Form2 is loaded string tmp1 = Path.GetTempFileName(); File.Delete(tmp1); string[] tmp2 = tmp1.Split('\\'); tmp2[tmp2.Length - 1] = ""; string tmp = String.Join("\\", tmp2); tmp += "jc3mpuipackagesandbox\\"; string appData = this.GetAppDataPath(); if (!Directory.Exists(appData)) { Directory.CreateDirectory(appData); } if (!Directory.Exists(tmp)) { Directory.CreateDirectory(tmp); } this.pathToHomepage = appData + "homepage.html"; this.pathToTempIAS = tmp + "index.html"; this.pathToTempAS = tmp + "as.js"; if (!File.Exists(this.pathToHomepage)) { File.WriteAllText(this.pathToHomepage, Properties.Resources.home); } if (!File.Exists(this.pathToTempIAS) || File.ReadAllText(this.pathToTempIAS) != Properties.Resources.ias) { File.WriteAllText(this.pathToTempIAS, Properties.Resources.ias); } if (!File.Exists(this.pathToTempAS) || File.ReadAllText(this.pathToTempAS) != Properties.Resources._as) { File.WriteAllText(this.pathToTempAS, Properties.Resources._as); } this.aScripts = new AuxiliaryScripts(this); this.aScripts.Load(); panel1.Size = new Size(this.ClientSize.Width, this.ClientSize.Height); this.SetURI(this.pathToHomepage); this.DefaultFormBorderStyle = this.FormBorderStyle; this.DefaultWindowState = this.WindowState; CefSettings uiSettings = new CefSettings(); uiSettings.RemoteDebuggingPort = 13173; BrowserSettings browserSettings = new BrowserSettings(); browserSettings.BackgroundColor = ColorToUint(defaultColor); Cef.Initialize(uiSettings); ui = new ChromiumWebBrowser(this.uri); ui.BrowserSettings = browserSettings; panel1.Controls.Add(ui); ui.Dock = DockStyle.Fill; BindingOptions options = new BindingOptions(); options.CamelCaseJavascriptNames = false; this.jcmp = new JCMPNamespace(this, this.control); this.jcmpsc = new JCMPServerClient(this); ui.RegisterJsObject("jcmp", this.jcmp, options); this.as_ = new Form4(this); this.as_.Show(); }
//Initialization public ChatForm() { InitializeComponent(); defaultBorderStyle = FormBorderStyle; }
/// <summary> /// Initialize the graphics environment /// </summary> void InitializeEnvironment(bool fullScreen) { // Save normal form settings (or initial settings when starting up minimized/maximized) if (!mFullScreen) { // Save form setting only when window state is normal if (ParentForm.WindowState == FormWindowState.Normal || mFormRectangle.Size == new Size()) { mFormBorderStyle = ParentForm.FormBorderStyle; mFormRectangle.Location = ParentForm.Location; mFormRectangle.Size = ParentForm.Size; mFormMainMenu = ParentForm.Menu; mFormVisible = ParentForm.Visible; } // Always save control settings before entering full screen mode mControlRectangle.Location = this.Location; mControlRectangle.Size = this.Size; mControlVisible = this.Visible; } // Delete old Dx object DeleteDirectxDevice(); // If switching from full screen mode to windowed mode, restore control and form scale if (mFullScreen && !fullScreen) { // We need to force a redraw so the form is the correct size, // and is not hidden by the task bar. Display a black form // while doing this, so there is not as much annoying flicker. Form blackForm = new Form(); blackForm.WindowState = FormWindowState.Maximized; blackForm.ControlBox = false; blackForm.MinimizeBox = false; blackForm.MinimizeBox = false; blackForm.ShowInTaskbar = false; blackForm.BackColor = Color.Black; blackForm.Show(); ParentForm.Visible = false; // Restore form parameters ParentForm.FormBorderStyle = mFormBorderStyle; ParentForm.Location = mFormRectangle.Location; ParentForm.Size = mFormRectangle.Size; if (mFormMainMenu != null) ParentForm.Menu = mFormMainMenu; // Restore control parameters Location = mControlRectangle.Location; Size = mControlRectangle.Size; Visible = mControlVisible; // Restore owned forms if (mFormOwnedForms != null) for (int i = 0; i < mFormOwnedForms.Length; i++) { mFormOwnedForms[i].Owner = ParentForm; mFormOwnedForms[i].BringToFront(); } mFormOwnedForms = null; // Display this form, and close the black form ParentForm.Visible = mFormVisible; ParentForm.BringToFront(); blackForm.Close(); } GraphicsAdapterInfo adapterInfo = mGraphicsSettings.AdapterInfo; GraphicsDeviceInfo deviceInfo = mGraphicsSettings.DeviceInfo; // Set new full screen mode //bool oldFullScreenMode = mFullScreen; mFullScreen = fullScreen; mGraphicsSettings.IsWindowed = !fullScreen; // Set up presentation parameters from current settings PresentParameters presentParams = new PresentParameters(); presentParams.Windowed = mGraphicsSettings.IsWindowed; presentParams.MultiSample = mGraphicsSettings.MultisampleType; presentParams.MultiSampleQuality = mGraphicsSettings.MultisampleQuality; presentParams.SwapEffect = SwapEffect.Discard; presentParams.EnableAutoDepthStencil = mEnumerationSettings.AppUsesDepthBuffer; presentParams.AutoDepthStencilFormat = mGraphicsSettings.DepthStencilBufferFormat; // If doing 2D graphics, allow a lockable back buffer. if (this.DxRender2d == null) presentParams.PresentFlag = PresentFlag.None; else presentParams.PresentFlag = PresentFlag.LockableBackBuffer; if (!mFullScreen) { // Windowed mode parameters presentParams.BackBufferCount = 1; // One back buffer OK presentParams.BackBufferWidth = ClientRectangle.Right - ClientRectangle.Left; presentParams.BackBufferHeight = ClientRectangle.Bottom - ClientRectangle.Top; presentParams.BackBufferFormat = mGraphicsSettings.DeviceCombo.BackBufferFormat; presentParams.FullScreenRefreshRateInHz = 0; presentParams.PresentationInterval = PresentInterval.Immediate; presentParams.DeviceWindow = this; } else { // Full screen mode parameters presentParams.BackBufferCount = 2; // Two back buffers needed for full screen presentParams.BackBufferWidth = mGraphicsSettings.DisplayMode.Width; presentParams.BackBufferHeight = mGraphicsSettings.DisplayMode.Height; presentParams.BackBufferFormat = mGraphicsSettings.DeviceCombo.BackBufferFormat; presentParams.FullScreenRefreshRateInHz = mGraphicsSettings.DisplayMode.RefreshRate; presentParams.PresentationInterval = mGraphicsSettings.PresentInterval; presentParams.DeviceWindow = this.Parent; } if (mFullScreen) { // Save owned forms, and get rid of them so they can't overlap the full screen mFormOwnedForms = ParentForm.OwnedForms; for (int i = 0; i < mFormOwnedForms.Length; i++) mFormOwnedForms[i].Owner = null; // Setup form to be full screen mode if (ParentForm.WindowState == FormWindowState.Minimized) ParentForm.WindowState = FormWindowState.Normal; ParentForm.FormBorderStyle = FormBorderStyle.None; ParentForm.Menu = null; ParentForm.Visible = true; Location = new Point(0, 0); Size = new Size(presentParams.BackBufferWidth, presentParams.BackBufferHeight); Visible = true; ParentForm.BringToFront(); // This form must be on top BringToFront(); // This control must be on top } if (deviceInfo.Caps.PrimitiveMiscCaps.IsNullReference) { // Warn user about null ref device that can't render anything } CreateFlags createFlags = new CreateFlags(); if (mGraphicsSettings.VertexProcessingType == VertexProcessingType.Software) createFlags = CreateFlags.SoftwareVertexProcessing; else if (mGraphicsSettings.VertexProcessingType == VertexProcessingType.Mixed) createFlags = CreateFlags.MixedVertexProcessing; else if (mGraphicsSettings.VertexProcessingType == VertexProcessingType.Hardware) createFlags = CreateFlags.HardwareVertexProcessing; else if (mGraphicsSettings.VertexProcessingType == VertexProcessingType.PureHardware) { createFlags = CreateFlags.HardwareVertexProcessing | CreateFlags.PureDevice; } else throw new ApplicationException(); // This application can be multithreaded createFlags |= CreateFlags.MultiThreaded; try { // Create the device mDx = new Device(mGraphicsSettings.AdapterOrdinal, mGraphicsSettings.DevType, this, createFlags, presentParams); } catch { // If that failed, fall back to the reference rasterizer if (deviceInfo.DevType == DeviceType.Hardware && FindBestWindowedMode(false, true)) { InitializeEnvironment(false); return; } throw; } // Set up the cursor (doesn't work) //mDx.SetCursor(this.Cursor, true); //mDx.ShowCursor(mShowCursor); // Setup the event handlers mDx.DeviceReset += new System.EventHandler(this.DxRestoreInternal); mDx.DeviceLost += new System.EventHandler(this.DxLostInternal); mDx.DeviceResizing += new System.ComponentModel.CancelEventHandler(this.DxResizeInternal); // Initialize device-dependent objects DxResizeInternal(null, null); if (!mLoaded && DxLoaded != null) DxLoaded(this, mDx); mLoaded = true; DxRestoreInternal(null, null); }
protected virtual bool ShouldRemoveWindowManager(FormBorderStyle style) { return(style != FormBorderStyle.FixedToolWindow && style != FormBorderStyle.SizableToolWindow); }
private void _Save(Form targetForm) { _BrdStyle = targetForm.FormBorderStyle; _Bounds = targetForm.Bounds; }
public Form ShowPopup(Control host, Control content, FormBorderStyle style, bool dontShowYet) { return(ShowPopup(host, content, style, dontShowYet, "")); }
internal override void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) { Form form = Control.FromHandle (handle) as Form; if (form != null && form.window_manager == null) { CreateParams cp = form.GetCreateParams (); if (border_style == FormBorderStyle.FixedToolWindow || border_style == FormBorderStyle.SizableToolWindow || cp.IsSet (WindowExStyles.WS_EX_TOOLWINDOW)) { form.window_manager = new ToolWindowManager (form); } } RequestNCRecalc(handle); }
public Window(WindowOptions options) { if (Application.MainWindow != null && Application.RenderingBackend == RenderingBackend.ES20) { // ES20 doesn't allow multiple contexts for now, because of a bug in OpenTK throw new Lime.Exception("Attempt to create a second window for ES20 rendering backend. Use OpenGL backend instead."); } if (options.UseTimer && options.AsyncRendering) { throw new Lime.Exception("Can't use both timer and async rendering"); } if (options.ToolWindow) { form = new ToolForm(); } else { form = new Form(); } Input = new WindowInput(this); using (var graphics = form.CreateGraphics()) { PixelScale = CalcPixelScale(graphics.DpiX); } if (options.Style == WindowStyle.Borderless) { borderStyle = FormBorderStyle.None; } else { borderStyle = options.FixedSize ? FormBorderStyle.FixedSingle : FormBorderStyle.Sizable; } form.FormBorderStyle = borderStyle; form.MaximizeBox = !options.FixedSize; if (options.MinimumDecoratedSize != Vector2.Zero) { MinimumDecoratedSize = options.MinimumDecoratedSize; } if (options.MaximumDecoratedSize != Vector2.Zero) { MaximumDecoratedSize = options.MaximumDecoratedSize; } renderControl = CreateRenderControl(Application.RenderingBackend); renderControl.CreateControl(); renderControl.UnbindContext(); renderControl.Dock = DockStyle.Fill; renderControl.Paint += OnPaint; renderControl.KeyDown += OnKeyDown; renderControl.KeyUp += OnKeyUp; renderControl.KeyPress += OnKeyPress; renderControl.MouseDown += OnMouseDown; renderControl.MouseUp += OnMouseUp; renderControl.Resize += OnResize; renderControl.MouseWheel += OnMouseWheel; renderControl.MouseEnter += (sender, args) => { Application.WindowUnderMouse = this; }; renderControl.MouseLeave += (sender, args) => { if (Application.WindowUnderMouse == this) { Application.WindowUnderMouse = null; } }; renderControl.BeforeBoundsChanged += WaitForRendering; form.Move += OnMove; form.Activated += OnActivated; form.Deactivate += OnDeactivate; form.FormClosing += OnClosing; form.FormClosed += OnClosed; form.Shown += OnShown; active = Form.ActiveForm == form; if (options.UseTimer) { timer = new System.Windows.Forms.Timer { Interval = (int)(1000.0 / 65), Enabled = true, }; timer.Tick += OnTick; } else { vSync = options.VSync; renderControl.VSync = vSync; System.Windows.Forms.Application.Idle += OnTick; } form.Controls.Add(renderControl); stopwatch = new Stopwatch(); stopwatch.Start(); if (options.Icon != null) { form.Icon = (System.Drawing.Icon)options.Icon; } Cursor = MouseCursor.Default; Title = options.Title; ClientSize = options.ClientSize; if (options.Visible) { Visible = true; } if (options.Screen != null && options.Screen >= 0 && Screen.AllScreens.Length > options.Screen) { form.Location = GetCenter(Screen.AllScreens[options.Screen.Value].WorkingArea); } if (options.Centered) { Center(); } if (Application.MainWindow == null) { Application.MainWindow = this; Closing += reason => Application.DoExiting(); Closed += Application.DoExited; } else { Form.Owner = Application.MainWindow.Form; Form.StartPosition = FormStartPosition.CenterParent; } AsyncRendering = options.AsyncRendering; if (AsyncRendering) { renderThreadTokenSource = new CancellationTokenSource(); renderThreadToken = renderThreadTokenSource.Token; renderThread = new Thread(RenderLoop); renderThread.IsBackground = true; renderThread.Start(); } Application.Windows.Add(this); }
internal override void SetBorderStyle(IntPtr handle, FormBorderStyle border_style) { // Nothing to do on Win32 }
/// <summary> /// Determines whether the specified border style is fixed. /// </summary> /// <param name="borderStyle">The border style.</param> /// <returns> /// <c>true</c> if the specified border style is fixed; otherwise, <c>false</c>. /// </returns> private bool IsFormBorderStyleFixed(FormBorderStyle borderStyle) { return(borderStyle == FormBorderStyle.Fixed3D || borderStyle == FormBorderStyle.FixedDialog || borderStyle == FormBorderStyle.FixedSingle || borderStyle == FormBorderStyle.FixedToolWindow); }
/// <summary> /// Saves the state before maximizing /// </summary> public void Save(Form form) { this.winState = form.WindowState; this.borderStyle = form.FormBorderStyle; this.windowBounds = form.Bounds; }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="colorDepth"></param> /// <param name="isFullScreen"></param> /// <param name="left"></param> /// <param name="top"></param> /// <param name="depthBuffer"></param>height /// <param name="miscParams"></param> public override void Create(string name, int width, int height, bool isFullScreen, params object[] miscParams) { Control parentWindow = null; Control externalWindow = null; fsaaType = MultiSampleType.None; fsaaQuality = 0; isVSync = false; string title = name; int colorDepth = 32; int left = -1; int top = -1; bool depthBuffer = true; // Parameters that would have been set in the params list, but are not used // border, outerSize useNVPerfHUD = false; multiThreaded = false; Debug.Assert(miscParams.Length % 2 == 0); int index = 0; while (index < miscParams.Length) { string key = (string)miscParams[index++]; object value = miscParams[index++]; switch (key) { case "left": left = (int)value; break; case "top": top = (int)value; break; case "title": title = (string)value; break; case "parentWindow": parentWindow = (Control)value; break; case "externalWindow": externalWindow = (Control)value; break; case "vsync": isVSync = (bool)value; break; case "displayFrequency": displayFrequency = (int)value; break; case "colorDepth": case "colourDepth": colorDepth = (int)value; break; case "depthBuffer": depthBuffer = (bool)value; break; case "FSAA": fsaaType = (MultiSampleType)value; break; case "FSAAQuality": fsaaQuality = (int)value; break; case "useNVPerfHUD": useNVPerfHUD = (bool)value; break; case "multiThreaded": multiThreaded = (bool)value; break; case "initialLoadBitmap": initialLoadBitmap = (string)value; break; case "border": case "outerDimensions": default: log.Warn("Option not yet implemented"); break; } } if (windowHandle != null) { Destroy(); } if (externalWindow == null) { this.width = width; this.height = height; this.top = top; this.left = left; FormBorderStyle borderStyle = FormBorderStyle.None; FormWindowState windowState = FormWindowState.Normal; if (!isFullScreen) { // If RenderSystem.AllowResize is true, put a // resize border on the window. borderStyle = (Root.Instance.RenderSystem.AllowResize ? FormBorderStyle.Sizable : FormBorderStyle.FixedSingle); windowState = FormWindowState.Normal; } else { borderStyle = FormBorderStyle.None; windowState = FormWindowState.Maximized; this.top = 0; this.left = 0; } isExternal = false; form = new DefaultForm(!isFullScreen, initialLoadBitmap); // Set these two to false, or else windows get created // with different dimensions that requesting in Width // and Height! log.InfoFormat("Initial form settings: AutoSize: {0}; AutoScale: {1}", form.AutoSize, form.AutoScaleMode); form.AutoSize = false; form.AutoScaleMode = AutoScaleMode.None; form.ClientSize = new System.Drawing.Size(width, height); // TODO: I should support the maximize box once I get resize working // form.MaximizeBox = true; form.MaximizeBox = false; form.MinimizeBox = true; form.Top = this.top; form.Left = this.left; form.FormBorderStyle = borderStyle; form.WindowState = windowState; form.Text = title; form.StartPosition = FormStartPosition.CenterScreen; form.BringToFront(); if (isFullScreen) { form.TopMost = true; form.TopLevel = true; form.Width = width; form.Height = height; } // form.Target.Visible = false; form.Show(); // set the default form's renderwindow so it can access it internally form.RenderWindow = this; form.Activate(); windowHandle = form.Target; } else { windowHandle = externalWindow; isExternal = true; this.top = windowHandle.Top; this.left = windowHandle.Left; System.Drawing.Rectangle rect = windowHandle.ClientRectangle; this.width = rect.Width; this.height = rect.Height; } windowHandle.Resize += this.OnExternalWindowEvent; windowHandle.Move += this.OnExternalWindowEvent; this.name = name; this.isDepthBuffered = depthBuffer; this.isFullScreen = isFullScreen; this.colorDepth = colorDepth; CreateD3DResources(); isActive = true; // FIXME: These lines were not in Ogre, but are in Axiom. //D3D.Device device = driver.Device; // device.DeviceReset += new EventHandler(OnResetDevice); //this.OnResetDevice(device, null); }
private void Save(Form targetForm) { _brdStyle = targetForm.FormBorderStyle; _topMost = targetForm.TopMost; _bounds = targetForm.Bounds; }
public static void Set_FormBorderStyle(this FormBorderStyle _FormBorderStyle, FormBorderStyle FormBorderStyle) { throw new NotImplementedException("This is an automatic generated code, please implement the requested logic."); }