Esempio n. 1
0
        public static void EnableShield(Button button, bool enableShield)
        {
            IntPtr hWnd = button.Handle;

            SafeNativeMethods.SendMessageW(
                hWnd,
                NativeConstants.BCM_SETSHIELD,
                IntPtr.Zero,
                enableShield ? new IntPtr(1) : IntPtr.Zero);

            GC.KeepAlive(button);
        }
Esempio n. 2
0
        public static void ShowComboBox(ComboBox comboBox, bool show)
        {
            IntPtr hWnd = comboBox.Handle;

            SafeNativeMethods.SendMessageW(
                hWnd,
                NativeConstants.CB_SHOWDROPDOWN,
                show ? new IntPtr(1) : IntPtr.Zero,
                IntPtr.Zero);

            GC.KeepAlive(comboBox);
        }
Esempio n. 3
0
 /// <summary>
 /// Sets the control's redraw state.
 /// </summary>
 /// <param name="control">The control whose state should be modified.</param>
 /// <param name="enabled">The new state for redrawing ability.</param>
 /// <remarks>
 /// Note to implementors: This method is used by SuspendControlPainting() and ResumeControlPainting().
 /// This may be implemented as a no-op.
 /// </remarks>
 private static void SetControlRedrawImpl(Control control, bool enabled)
 {
     SafeNativeMethods.SendMessageW(control.Handle, NativeConstants.WM_SETREDRAW, enabled ? new IntPtr(1) : IntPtr.Zero, IntPtr.Zero);
     GC.KeepAlive(control);
 }