public Everything() { var cp = new CreateParams { Caption = "PSEverything IPC Window", ClassName = "Static", ClassStyle = 0, Style = 0, ExStyle = 0, X = 0, Y = 0, Height = 1, Width = 1, Parent = IntPtr.Zero, Param = null }; CreateHandle(cp); var cs = new ChangeFilterStruct { Size = (uint) Marshal.SizeOf(typeof (ChangeFilterStruct)) }; if (!Win32.ChangeWindowMessageFilterEx(Handle, WindowMessage.CopyData, ChangeWindowMessageFilterExAction.Allow, ref cs)) { throw new Win32Exception(Marshal.GetLastWin32Error(), "Error allowing WM_COPYDATA mesasage from lower privilege processes."); } }
public DeviceWatcherWindow(string Caption) { CreateParams cp = new CreateParams(); cp.Caption = Caption; this.CreateHandle(cp); }
public ShellHook(IntPtr hWnd) { CreateParams cp = new CreateParams(); /*// Fill in the CreateParams details. cp.Caption = "Click here"; cp.ClassName = "Button"; // Set the position on the form cp.X = 100; cp.Y = 100; cp.Height = 100; cp.Width = 100; // Specify the form as the parent. cp.Parent = User32.GetDesktopWindow(); // Create as a child of the specified parent cp.Style = (int) WindowStyle.WS_POPUP;// WS_CHILD | WS_VISIBLE; cp.ExStyle = (int)WindowStyleEx.WS_EX_TOOLWINDOW;*/ // Create the actual window this.CreateHandle(cp); // User32.SetShellWindow(hWnd); User32.SetTaskmanWindow(hWnd); if (User32.RegisterShellHookWindow(this.Handle)) { WM_ShellHook = User32.RegisterWindowMessage("SHELLHOOK"); #if DEBUG Console.WriteLine("WM_ShellHook: " + WM_ShellHook.ToString()); #endif } }
public DeviceChangeNotificationWindow() { CreateParams Params = new CreateParams(); Params.ExStyle = WS_EX_TOOLWINDOW; Params.Style = WS_POPUP; CreateHandle(Params); }
/// <summary> /// Create new message window thread. /// 新しいメッセージウィンドウを作る /// </summary> public MessageWindow() { MessageHandlers = new Dictionary<int, MessageHandler>(); System.Windows.Forms.CreateParams cp = new System.Windows.Forms.CreateParams(); cp.ClassName = "Message"; CreateHandle(cp); }
/// <summary> /// Create a Windows Message receiving window object. /// </summary> public ReceiverWindow() { CreateParams createParams = new CreateParams(); createParams.ExStyle = 0x80; createParams.Style = unchecked((int) 0x80000000); base.CreateHandle(createParams); }
internal void Create() { CreateParams _CP = new CreateParams(); if (System.Environment.OSVersion.Version.Major >= 5) _CP.Parent = (IntPtr)HWND_MESSAGE; CreateHandle(_CP); }
internal void StartListening() { ApplicationContext ctx = new ApplicationContext(); CreateParams cp = new CreateParams(); cp.Parent = (IntPtr)(-3); //Without this, WndProc will also intercept messages delivered to regular windows forms this.CreateHandle(cp); Application.Run(ctx); }
/// <summary> /// Create a Windows Message receiving window object. /// </summary> /// <param name="windowTitle">Window title for receiver object.</param> public ReceiverWindow(string windowTitle) { CreateParams createParams = new CreateParams(); createParams.Caption = windowTitle; createParams.ExStyle = 0x80; createParams.Style = unchecked((int) 0x80000000); base.CreateHandle(createParams); }
internal CallbackWindow(CallbackWindowControlChangeHandler ptrMixerControlChange, CallbackWindowLineChangeHandler ptrMixerLineChange) { CreateParams cp = new CreateParams(); mPtrMixerControlChange = ptrMixerControlChange; mPtrMixerLineChange = ptrMixerLineChange; this.CreateHandle(cp); }
public void Start() { CreateParams createParams = new CreateParams(); createParams.ExStyle = 0x08000000; createParams.Style = unchecked((int)0x80000000); CreateHandle(createParams); }
/// <summary> /// Initialize tracking tooltip control /// </summary> public TrackingToolTip() { // create params for a tracking tooltip window CreateParams cp = new CreateParams(); cp.ExStyle = (int)WS.EX_TOPMOST; cp.ClassName = WINDOW_CLASS.TOOLTIPS; cp.Style = unchecked((int)(WS.POPUP | TTS.ALWAYSTIP | TTS.NOPREFIX)); // create the winow CreateHandle(cp); }
internal DevNotifyNativeWindow(OnHandleChangeDelegate delHandleChanged, OnDeviceChangeDelegate delDeviceChange) { mDelHandleChanged = delHandleChanged; mDelDeviceChange = delDeviceChange; CreateParams cp = new CreateParams(); cp.Caption = WINDOW_CAPTION; cp.X = -100; cp.Y = -100; cp.Width = 50; cp.Height = 50; CreateHandle(cp); }
public SettingsDlg(IntPtr parent) { CreateParams cp = new CreateParams(); cp.ClassName = "Button"; cp.Style = WS_VISIBLE | WS_CHILD; cp.Parent = parent; cp.Width = 300; cp.Height = 300; cp.X = 100; cp.Y = 100; this.CreateHandle(cp); }
/// <summary> /// Adds a shadow to the create params if it is supported by the operating system. /// </summary> public static void AddShadowToWindow(CreateParams createParams) { if (shadowStatus == 0) { // Test OS version shadowStatus = -1; // shadow not supported if (Environment.OSVersion.Platform == PlatformID.Win32NT) { Version ver = Environment.OSVersion.Version; if (ver.Major > 5 || ver.Major == 5 && ver.Minor >= 1) { shadowStatus = 1; } } } if (shadowStatus == 1) { createParams.ClassStyle |= 0x00020000; // set CS_DROPSHADOW } }
public NativeUpDown(UpDown OwnerControl) { CreateParams cp = new CreateParams(); cp.ClassName = "msctls_updown32"; cp.X = cp.Y = 0; cp.Width = OwnerControl.Width; cp.Height = OwnerControl.Height; cp.Parent = OwnerControl.Handle; cp.Style = 0x50000040; CreateHandle(cp); fTrackMouseEvent = true; TME = new TRACKMOUSEEVENT(); TME.cbSize = Marshal.SizeOf(TME); TME.dwFlags = 2; TME.hwndTrack = Handle; }
public NativeUpDown(UpDown OwnerControl) { CreateParams cp = new CreateParams(); cp.ClassName = "msctls_updown32"; cp.X = cp.Y = 0; cp.Width = OwnerControl.Width; cp.Height = OwnerControl.Height; cp.Parent = OwnerControl.Handle; cp.Style = 0x50000040; this.CreateHandle(cp); this.fTrackMouseEvent = true; this.TME = new QTTabBarLib.Interop.TRACKMOUSEEVENT(); this.TME.cbSize = Marshal.SizeOf(this.TME); this.TME.dwFlags = 2; this.TME.hwndTrack = base.Handle; }
/// <summary> /// The non-obsolete constructor used internally for creating new instances of XDListener. /// </summary> /// <param name="nonObsolete"></param> internal XDListener(bool nonObsolete) { // create a top-level native window CreateParams p = new CreateParams(); p.Width = 0; p.Height = 0; p.X = 0; p.Y = 0; p.Caption = string.Concat("TheCodeKing.Net.XDServices.",Guid.NewGuid().ToString()); p.Parent = IntPtr.Zero; base.CreateHandle(p); this.networkRelay = new NetworkRelayListener(XDBroadcast.CreateBroadcast(XDTransportMode.WindowsMessaging), XDListener.CreateListener(XDTransportMode.MailSlot)); }
private ShowDesktop() { // create a reference window to detect show desktop referenceWindow = new NativeWindow(); CreateParams cp = new CreateParams(); cp.ExStyle = GadgetWindow.WS_EX_TOOLWINDOW; cp.Caption = referenceWindowCaption; referenceWindow.CreateHandle(cp); NativeMethods.SetWindowPos(referenceWindow.Handle, GadgetWindow.HWND_BOTTOM, 0, 0, 0, 0, GadgetWindow.SWP_NOMOVE | GadgetWindow.SWP_NOSIZE | GadgetWindow.SWP_NOACTIVATE | GadgetWindow.SWP_NOSENDCHANGING); // start a repeated timer to detect "Show Desktop" events timer = new System.Threading.Timer(OnTimer, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); }
internal void CreateParamsInternal(IntPtr hWnd, Rectangle rect) { IntPtr parent = Win32.NativeMethods.GetParent(hWnd); int num = 0x5400000d; int num2 = 0x88; this._createParams = new System.Windows.Forms.CreateParams(); this._createParams.Parent = parent; this._createParams.ClassName = "STATIC"; this._createParams.Caption = null; this._createParams.Style = num; this._createParams.ExStyle = num2; this._createParams.X = rect.X; this._createParams.Y = rect.Y; this._createParams.Width = rect.Width; this._createParams.Height = rect.Height; }
internal XDWinMsgListener(ISerializer serializer) { serializer.Requires("serializer").IsNotNull(); this.serializer = serializer; var p = new CreateParams { Width = 0, Height = 0, X = 0, Y = 0, Caption = string.Concat("TheCodeKing.Net.XDServices.", Guid.NewGuid().ToString()), Parent = IntPtr.Zero }; CreateHandle(p); }
/// <summary> /// The constructor used internally for creating new instances of XDListener. /// </summary> internal XDWinMsgListener(ISerializer serializer) { Validate.That(serializer).IsNotNull(); this.serializer = serializer; // create a top-level native window var p = new CreateParams { Width = 0, Height = 0, X = 0, Y = 0, Caption = string.Concat("TheCodeKing.Net.XDServices.", Guid.NewGuid().ToString()), Parent = IntPtr.Zero }; CreateHandle(p); }
/// <summary> /// Initialize a new instance of the DropDockingIndicatorsRounded class. /// </summary> /// <param name="paletteDragDrop">Drawing palette.</param> /// <param name="renderer">Drawing renderer.</param> /// <param name="showLeft">Show left hot area.</param> /// <param name="showRight">Show right hot area.</param> /// <param name="showTop">Show top hot area.</param> /// <param name="showBottom">Show bottom hot area.</param> /// <param name="showMiddle">Show middle hot area.</param> public DropDockingIndicatorsRounded(IPaletteDragDrop paletteDragDrop, IRenderer renderer, bool showLeft, bool showRight, bool showTop, bool showBottom, bool showMiddle) { _paletteDragDrop = paletteDragDrop; _renderer = renderer; // Initialize the drag data that indicators which docking indicators are needed _dragData = new RenderDragDockingData(showLeft, showRight, showTop, showBottom, showMiddle); // Ask the renderer to measure the sizing of the indicators that are displayed _renderer.RenderGlyph.MeasureDragDropDockingGlyph(_dragData, _paletteDragDrop, PaletteDragFeedback.Rounded); _showRect = new Rectangle(Point.Empty, _dragData.DockWindowSize); // Any old title will do as it will not be shown CreateParams cp = new CreateParams(); cp.Caption = "DropDockingIndicatorsRounded"; // Define the screen position/size cp.X = _showRect.X; cp.Y = _showRect.Y; cp.Height = _showRect.Width; cp.Width = _showRect.Height; // As a top-level window it has no parent cp.Parent = IntPtr.Zero; // Appear as a top-level window cp.Style = unchecked((int)(uint)PI.WS_POPUP); // Set styles so that it does not have a caption bar and is above all other // windows in the ZOrder, i.e. TOPMOST cp.ExStyle = (int)PI.WS_EX_TOPMOST + (int)PI.WS_EX_TOOLWINDOW; // We are going to use per-pixrl alpha blending and so need a layered window cp.ExStyle += (int)PI.WS_EX_LAYERED; // Create the actual window this.CreateHandle(cp); }
// will ensure that the toolTip window was created public void CreateToolTipHandle() { if (tipWindow == null || tipWindow.Handle == IntPtr.Zero) { NativeMethods.INITCOMMONCONTROLSEX icc = new NativeMethods.INITCOMMONCONTROLSEX(); icc.dwICC = NativeMethods.ICC_TAB_CLASSES; icc.dwSize = Marshal.SizeOf(icc); SafeNativeMethods.InitCommonControlsEx(icc); CreateParams cparams = new CreateParams(); cparams.Parent = dataGrid.Handle; cparams.ClassName = NativeMethods.TOOLTIPS_CLASS; cparams.Style = NativeMethods.TTS_ALWAYSTIP; tipWindow = new NativeWindow(); tipWindow.CreateHandle(cparams); UnsafeNativeMethods.SendMessage(new HandleRef(tipWindow, tipWindow.Handle), NativeMethods.TTM_SETMAXTIPWIDTH, 0, SystemInformation.MaxWindowTrackSize.Width); SafeNativeMethods.SetWindowPos(new HandleRef(tipWindow, tipWindow.Handle), NativeMethods.HWND_NOTOPMOST, 0, 0, 0, 0, NativeMethods.SWP_NOSIZE | NativeMethods.SWP_NOMOVE | NativeMethods.SWP_NOACTIVATE); UnsafeNativeMethods.SendMessage(new HandleRef(tipWindow, tipWindow.Handle), NativeMethods.TTM_SETDELAYTIME, NativeMethods.TTDT_INITIAL, 0); } }
internal WmCopyDataWindow(string wndName) { _wndName = wndName + "_WMCOPYDATA"; CreateParams cp = new CreateParams(); cp.ClassName = "Message"; cp.Caption = _wndName; cp.Width = cp.Height = 0; cp.X = cp.Y = 10000; try { CreateHandle(cp); Logger.LogTrace("WmCopyDataWindow created, wndName: {0}", cp.Caption); } catch { int err = Kernel32.GetLastError(); } }
protected Director(string applicationPath) : base() { _ApplicationPath = applicationPath; _DirectorWindow = FindDirectorWindow(); _EditorWindow = FindEditorWindow(); var cp = new CreateParams { Caption = "NDexer.Director.ListenerWindow", X = 0, Y = 0, Width = 0, Height = 0, Style = 0, ExStyle = WS_EX_NOACTIVATE, Parent = new IntPtr(-3) }; CreateHandle(cp); }
internal void CreateParamsInternal(IntPtr hWnd) { IntPtr parent = Win32.NativeMethods.GetParent(hWnd); Win32.Struct.RECT lpRect = new Win32.Struct.RECT(); Win32.NativeMethods.Point lpPoint = new Win32.NativeMethods.Point(); Win32.NativeMethods.GetWindowRect(hWnd, ref lpRect); lpPoint.x = lpRect.Left; lpPoint.y = lpRect.Top; Win32.NativeMethods.ScreenToClient(parent, ref lpPoint); int num = 0x5400000d; int num2 = 0x88; this._createParams = new System.Windows.Forms.CreateParams(); this._createParams.Parent = parent; this._createParams.ClassName = "STATIC"; this._createParams.Caption = null; this._createParams.Style = num; this._createParams.ExStyle = num2; this._createParams.X = lpPoint.x; this._createParams.Y = lpPoint.y; this._createParams.Width = lpRect.Right - lpRect.Left; this._createParams.Height = lpRect.Bottom - lpRect.Top; }
public WindowSide(Window owner, Size surfaceSize) { // ... Owner = owner; // Creating surface Surface = new Surface(); Surface.CreateDeviceContext(); Surface.CreateSurface(surfaceSize.Width, surfaceSize.Height, PixelFormat.Format32bppArgb); Surface.SelectSurface(); // ... var createParams = new CreateParams { ExStyle = (int)(ExtendedWindowStyles.WS_EX_LAYERED | ExtendedWindowStyles.WS_EX_TRANSPARENT | ExtendedWindowStyles.WS_EX_TOOLWINDOW) }; // Creating handle CreateHandle(createParams); // Clearing base style, since we need plane rectangle without anything NativeMethods.SetWindowLong(Handle, (int)WindowLongFlags.GWL_STYLE, 0); }
public void CreateToolTipHandle() { if ((this.tipWindow == null) || (this.tipWindow.Handle == IntPtr.Zero)) { System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX initcommoncontrolsex; initcommoncontrolsex = new System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX { dwICC = 8, dwSize = Marshal.SizeOf(initcommoncontrolsex) }; System.Windows.Forms.SafeNativeMethods.InitCommonControlsEx(initcommoncontrolsex); CreateParams cp = new CreateParams { Parent = this.dataGrid.Handle, ClassName = "tooltips_class32", Style = 1 }; this.tipWindow = new NativeWindow(); this.tipWindow.CreateHandle(cp); System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this.tipWindow, this.tipWindow.Handle), 0x418, 0, SystemInformation.MaxWindowTrackSize.Width); System.Windows.Forms.SafeNativeMethods.SetWindowPos(new HandleRef(this.tipWindow, this.tipWindow.Handle), System.Windows.Forms.NativeMethods.HWND_NOTOPMOST, 0, 0, 0, 0, 0x13); System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this.tipWindow, this.tipWindow.Handle), 0x403, 3, 0); } }
public FocusCatcher(IntPtr hParent) { CreateParams cp = new CreateParams(); // Any old title will do as it will not be shown cp.Caption = "NativeFocusCatcher"; // Set the position off the screen so it will not be seen cp.X = -1; cp.Y = -1; cp.Height = 0; cp.Width = 0; // As a top-level window it has no parent cp.Parent = hParent; // Create as a child of the specified parent cp.Style = unchecked((int)(uint)Win32.WindowStyles.WS_CHILD + (int)(uint)Win32.WindowStyles.WS_VISIBLE); // Create the actual window this.CreateHandle(cp); }
public static Rectangle GetWindowRectangle(CreateParams cp, Menu menu) { return(GetWindowRectangle(cp, menu, Rectangle.Empty)); }
internal abstract void SetWindowStyle(IntPtr handle, CreateParams cp);
/// <summary> /// Creates a window handle for this window. /// </summary> public virtual void CreateHandle(CreateParams cp) { lock (this) { CheckReleased(); WindowClass windowClass = WindowClass.Create(cp.ClassName, (User32.CS)cp.ClassStyle); lock (s_createWindowSyncObject) { // The CLR will sometimes pump messages while we're waiting on the lock. // If a message comes through (say a WM_ACTIVATE for the parent) which // causes the handle to be created, we can try to create the handle twice // for NativeWindow. Check the handle again to avoid this. if (Handle != IntPtr.Zero) { return; } IntPtr createResult = IntPtr.Zero; int lastWin32Error = 0; NativeWindow?prevTargetWindow = windowClass._targetWindow; try { windowClass._targetWindow = this; // Parking window dpi awareness context need to match with dpi awareness context of control being // parented to this parking window. Otherwise, reparenting of control will fail. using (DpiHelper.EnterDpiAwarenessScope(DpiAwarenessContext)) { IntPtr modHandle = Kernel32.GetModuleHandleW(null); // Older versions of Windows AV rather than returning E_OUTOFMEMORY. // Catch this and then we re-throw an out of memory error. try { // CreateWindowEx throws if WindowText is greater than the max // length of a 16 bit int (32767). // If it exceeds the max, we should take the substring.... if (cp.Caption is not null && cp.Caption.Length > short.MaxValue) { cp.Caption = cp.Caption.Substring(0, short.MaxValue); } createResult = User32.CreateWindowExW( (User32.WS_EX)cp.ExStyle, windowClass._windowClassName, cp.Caption, (User32.WS)cp.Style, cp.X, cp.Y, cp.Width, cp.Height, cp.Parent, IntPtr.Zero, modHandle, cp.Param); lastWin32Error = Marshal.GetLastWin32Error(); } catch (NullReferenceException e) { throw new OutOfMemoryException(SR.ErrorCreatingHandle, e); } } } finally { windowClass._targetWindow = prevTargetWindow; } Debug.WriteLineIf(CoreSwitches.PerfTrack.Enabled, "Handle created of type '" + cp.ClassName + "' with caption '" + cp.Caption + "' from NativeWindow of type '" + GetType().FullName + "'"); if (createResult == IntPtr.Zero) { throw new Win32Exception(lastWin32Error, SR.ErrorCreatingHandle); } _ownHandle = true; } } }
/// <summary> /// Shows the ballon tooltip /// </summary> /// <param name="timeout"></param> public void ShowBalloonTip(int timeout) { //Check if a balloon already is shown or no user control was defined if (moNativeWindow.Handle != IntPtr.Zero || moPanel == null) return; //Get a handle for the notify icon IntPtr loNotifyIconHandle = GetHandler(moNotifyIcon); if (loNotifyIconHandle == IntPtr.Zero) return; //Trying to find notify icon rectangle on a desktop if (!GetNotifyIconScreenRect(loNotifyIconHandle)) return; //Create parameters for a new tooltip window System.Windows.Forms.CreateParams moCreateParams = new System.Windows.Forms.CreateParams(); // New window is a tooltip and a balloon moCreateParams.ClassName = WINAPI.TOOLTIPS_CLASS; moCreateParams.Style = WINAPI.WS_POPUP | WINAPI.TTS_NOPREFIX | WINAPI.TTS_ALWAYSTIP | WINAPI.TTS_BALLOON; moCreateParams.Parent = loNotifyIconHandle; // Create the tooltip window moNativeWindow.CreateHandle(moCreateParams); //We save old window proc to be used later and replac it our own IntPtr loNativeProc = WINAPI.SetWindowLong(moNativeWindow.Handle, WINAPI.GWL_WNDPROC, wpcallback); if (loNativeProc == IntPtr.Zero) return; if (WINAPI.SetProp(moNativeWindow.Handle, "NATIVEPROC", loNativeProc) == 0) return; // Make tooltip the top level window if (!WINAPI.SetWindowPos(moNativeWindow.Handle, WINAPI.HWND_TOPMOST, 0, 0, 0, 0, WINAPI.SWP_NOACTIVATE | WINAPI.SWP_NOSIZE)) return; // Tool tip info. Set a TRACK flag to show it in specified position WINAPI.TOOLINFO ti = new WINAPI.TOOLINFO(); ti.cbSize = Marshal.SizeOf(ti); ti.uFlags = WINAPI.TTF_TRACK; ti.hwnd = loNotifyIconHandle; //Approximating window size by use of char size WINAPI.SIZE size = new WINAPI.SIZE(); IntPtr hDC = WINAPI.GetDC(moNativeWindow.Handle); if (hDC == IntPtr.Zero) return; if (WINAPI.GetTextExtentPoint32(hDC, ".", 1, ref size) == 0) return; int lines = 1 + moPanel.Height / size.cy; int cols = moPanel.Width / size.cx; ti.lpszText = "."; for (int i = 0; i < lines; i++) { for (int j = 0; j < cols; j++) ti.lpszText += "."; ti.lpszText += "\r\n"; } //Add tool to the notify icon if (WINAPI.SendMessage(moNativeWindow.Handle, WINAPI.TTM_ADDTOOL, 0, ref ti) == 0) return; WINAPI.SendMessage(moNativeWindow.Handle, WINAPI.TTM_SETTIPBKCOLOR, ColorTranslator.ToWin32(Color.LightYellow), ref ti); WINAPI.SendMessage(moNativeWindow.Handle, WINAPI.TTM_SETTIPTEXTCOLOR, ColorTranslator.ToWin32(Color.Black), ref ti); WINAPI.SendMessage(moNativeWindow.Handle, WINAPI.TTM_SETDELAYTIME, Duration.AutoPop, 1000); WINAPI.SendMessage(moNativeWindow.Handle, WINAPI.TTM_TRACKPOSITION, 0, (moPosition.Y << 16) + moPosition.X); WINAPI.SendMessage(moNativeWindow.Handle, WINAPI.TTM_SETTITLE, (int)BalloonTipIcon, BalloonTipTitle); WINAPI.SendMessage(moNativeWindow.Handle, WINAPI.TTM_TRACKACTIVATE, 1, ref ti); // Raise shown event OnBalloonTipShown(this, EventArgs.Empty); // Timeout for the tooltip moTimer.Interval = timeout; moTimer.Start(); }
internal abstract IntPtr CreateWindow(CreateParams cp);
internal static bool CalculateWindowRect(ref Rectangle ClientRect, CreateParams cp, Menu menu, out Rectangle WindowRect) { DriverDebug("CalculateWindowRect ({0}, {1}, {2}): Called", ClientRect, cp, menu); return(driver.CalculateWindowRect(ref ClientRect, cp, menu, out WindowRect)); }
public static Borders GetBorderWidth(CreateParams cp) { Borders border_size = new Borders(); Size windowborder = ThemeEngine.Current.BorderSize; /*new Size (1, 1);*/ // This is the only one that can be changed from the display properties in windows. Size border = ThemeEngine.Current.BorderStaticSize; /*new Size (1, 1);*/ Size clientedge = ThemeEngine.Current.Border3DSize; /*new Size (2, 2);*/ Size thickframe = new Size(2 + windowborder.Width, 2 + windowborder.Height); Size dialogframe = ThemeEngine.Current.BorderSizableSize; /* new Size (3, 3);*/ if (cp.IsSet(WindowStyles.WS_CAPTION)) { border_size.Inflate(dialogframe); } else if (cp.IsSet(WindowStyles.WS_BORDER)) { if (cp.IsSet(WindowExStyles.WS_EX_DLGMODALFRAME)) { if (cp.IsSet(WindowStyles.WS_THICKFRAME) && (cp.IsSet(WindowExStyles.WS_EX_STATICEDGE) || cp.IsSet(WindowExStyles.WS_EX_CLIENTEDGE))) { border_size.Inflate(border); } } else { border_size.Inflate(border); } } else if (cp.IsSet(WindowStyles.WS_DLGFRAME)) { border_size.Inflate(dialogframe); } if (cp.IsSet(WindowStyles.WS_THICKFRAME)) { if (cp.IsSet(WindowStyles.WS_DLGFRAME)) { border_size.Inflate(border); } else { border_size.Inflate(thickframe); } } bool only_small_border; Size small_border = Size.Empty; only_small_border = cp.IsSet(WindowStyles.WS_THICKFRAME) || cp.IsSet(WindowStyles.WS_DLGFRAME); if (only_small_border && cp.IsSet(WindowStyles.WS_THICKFRAME) && !cp.IsSet(WindowStyles.WS_BORDER) && !cp.IsSet(WindowStyles.WS_DLGFRAME)) { small_border = border; } if (cp.IsSet(WindowExStyles.WS_EX_CLIENTEDGE | WindowExStyles.WS_EX_DLGMODALFRAME)) { border_size.Inflate(clientedge + (only_small_border ? small_border : dialogframe)); } else if (cp.IsSet(WindowExStyles.WS_EX_STATICEDGE | WindowExStyles.WS_EX_DLGMODALFRAME)) { border_size.Inflate(only_small_border ? small_border : dialogframe); } else if (cp.IsSet(WindowExStyles.WS_EX_STATICEDGE | WindowExStyles.WS_EX_CLIENTEDGE)) { border_size.Inflate(border + (only_small_border ? Size.Empty : clientedge)); } else { if (cp.IsSet(WindowExStyles.WS_EX_CLIENTEDGE)) { border_size.Inflate(clientedge); } if (cp.IsSet(WindowExStyles.WS_EX_DLGMODALFRAME) && !cp.IsSet(WindowStyles.WS_DLGFRAME)) { border_size.Inflate(cp.IsSet(WindowStyles.WS_THICKFRAME) ? border : dialogframe); } if (cp.IsSet(WindowExStyles.WS_EX_STATICEDGE)) { if (cp.IsSet(WindowStyles.WS_THICKFRAME) || cp.IsSet(WindowStyles.WS_DLGFRAME)) { border_size.Inflate(new Size(-border.Width, -border.Height)); } else { border_size.Inflate(border); } } } return(border_size); }
internal abstract bool CalculateWindowRect(ref Rectangle ClientRect, CreateParams cp, Menu menu, out Rectangle WindowRect);
internal static void SetWindowStyle(IntPtr handle, CreateParams cp) { DriverDebug("SetWindowStyle ({0}): Called", Window(handle)); driver.SetWindowStyle(handle, cp); }
public static Point GetNextStackedFormLocation(CreateParams cp, Hwnd parent_hwnd) { if (cp.control == null) { return(Point.Empty); } int X = cp.X; int Y = cp.Y; Point previous, next; Rectangle within; if (parent_hwnd != null) { Control parent = cp.control.Parent; previous = parent_hwnd.previous_child_startup_location; if (parent_hwnd.client_rectangle == Rectangle.Empty && parent != null) { within = parent.ClientRectangle; } else { within = parent_hwnd.client_rectangle; } } else { previous = Hwnd.previous_main_startup_location; within = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea; } if (previous.X == int.MinValue || previous.Y == int.MinValue) { next = Point.Empty; } else { next = new Point(previous.X + 22, previous.Y + 22); } if (!within.Contains(next.X * 3, next.Y * 3)) { next = Point.Empty; } if (next == Point.Empty && cp.Parent == IntPtr.Zero) { next = new Point(22, 22); } if (parent_hwnd != null) { parent_hwnd.previous_child_startup_location = next; } else { Hwnd.previous_main_startup_location = next; } if (X == int.MinValue && Y == int.MinValue) { X = next.X; Y = next.Y; } return(new Point(X, Y)); }