protected override void CreateHandle() { if (!base.RecreatingHandle) { IntPtr userCookie = System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Activate(); try { System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX icc = new System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX { dwICC = 0x20 }; System.Windows.Forms.SafeNativeMethods.InitCommonControlsEx(icc); } finally { System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Deactivate(userCookie); } } base.CreateHandle(); }
protected override void CreateHandle() { if (!base.RecreatingHandle) { IntPtr userCookie = System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Activate(); try { System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX icc = new System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX { dwICC = 0x100 }; System.Windows.Forms.SafeNativeMethods.InitCommonControlsEx(icc); } finally { System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Deactivate(userCookie); } } this.creationTime = DateTime.Now; base.CreateHandle(); if (this.userHasSetValue && this.validTime) { int wParam = 0; System.Windows.Forms.NativeMethods.SYSTEMTIME lParam = DateTimeToSysTime(this.Value); System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, base.Handle), 0x1002, wParam, lParam); } else if (!this.validTime) { int num2 = 1; System.Windows.Forms.NativeMethods.SYSTEMTIME systemtime2 = null; System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, base.Handle), 0x1002, num2, systemtime2); } if (this.format == DateTimePickerFormat.Custom) { base.SendMessage(System.Windows.Forms.NativeMethods.DTM_SETFORMAT, 0, this.customFormat); } this.UpdateUpDown(); this.SetAllControlColors(); this.SetControlCalendarFont(); this.SetRange(); }
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); } }
protected override void CreateHandle() { if (!base.RecreatingHandle) { IntPtr userCookie = System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Activate(); try { System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX icc = new System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX { dwICC = 4 }; System.Windows.Forms.SafeNativeMethods.InitCommonControlsEx(icc); } finally { System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Deactivate(userCookie); } } base.CreateHandle(); }
public static extern bool InitCommonControlsEx(System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX icc);
private void CreateHandle() { if (!this.GetHandleCreated()) { IntPtr userCookie = System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Activate(); try { System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX icc = new System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX { dwICC = 8 }; System.Windows.Forms.SafeNativeMethods.InitCommonControlsEx(icc); System.Windows.Forms.CreateParams createParams = this.CreateParams; if (this.GetHandleCreated()) { return; } this.window.CreateHandle(createParams); } finally { System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Deactivate(userCookie); } if (this.ownerDraw) { int windowLong = (int) ((long) System.Windows.Forms.UnsafeNativeMethods.GetWindowLong(new HandleRef(this, this.Handle), -16)); windowLong &= -8388609; System.Windows.Forms.UnsafeNativeMethods.SetWindowLong(new HandleRef(this, this.Handle), -16, new HandleRef(null, (IntPtr) windowLong)); } System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), 0x418, 0, SystemInformation.MaxWindowTrackSize.Width); if (this.auto) { this.SetDelayTime(0, this.delayTimes[0]); this.delayTimes[2] = this.GetDelayTime(2); this.delayTimes[3] = this.GetDelayTime(3); this.delayTimes[1] = this.GetDelayTime(1); } else { for (int i = 1; i < this.delayTimes.Length; i++) { if (this.delayTimes[i] >= 1) { this.SetDelayTime(i, this.delayTimes[i]); } } } System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), 0x401, this.active ? 1 : 0, 0); if (this.BackColor != SystemColors.Info) { System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), 0x413, ColorTranslator.ToWin32(this.BackColor), 0); } if (this.ForeColor != SystemColors.InfoText) { System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), 0x414, ColorTranslator.ToWin32(this.ForeColor), 0); } if ((this.toolTipIcon > System.Windows.Forms.ToolTipIcon.None) || !string.IsNullOrEmpty(this.toolTipTitle)) { string lParam = !string.IsNullOrEmpty(this.toolTipTitle) ? this.toolTipTitle : " "; System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this, this.Handle), System.Windows.Forms.NativeMethods.TTM_SETTITLE, (int) this.toolTipIcon, lParam); } } }
private bool EnsureCreated() { if (base.Handle == IntPtr.Zero) { System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX initcommoncontrolsex; if (!this.parent.IsHandleCreated) { return false; } CreateParams cp = new CreateParams { Caption = string.Empty, Style = 0x50000000, ClassStyle = 8, X = 0, Y = 0, Width = 0, Height = 0, Parent = this.parent.Handle }; this.CreateHandle(cp); initcommoncontrolsex = new System.Windows.Forms.NativeMethods.INITCOMMONCONTROLSEX { dwICC = 8, dwSize = Marshal.SizeOf(initcommoncontrolsex) }; System.Windows.Forms.SafeNativeMethods.InitCommonControlsEx(initcommoncontrolsex); cp = new CreateParams { Parent = base.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_TOP, 0, 0, 0, 0, 0x13); System.Windows.Forms.UnsafeNativeMethods.SendMessage(new HandleRef(this.tipWindow, this.tipWindow.Handle), 0x403, 3, 0); } return true; }