Beispiel #1
0
        private void ShowComboBoxInfo(IWin32Window control, bool showEditHandle)
        {
            NativeMethods.COMBOBOXINFO info;

            info        = new NativeMethods.COMBOBOXINFO();
            info.cbSize = Marshal.SizeOf(info);

            if (NativeMethods.GetComboBoxInfo(control.Handle, ref info))
            {
                IntPtr handle;

                handle = showEditHandle ? info.hwndEdit : info.hwndList;

                MessageBox.Show(handle == IntPtr.Zero ? "This control does not support this mode." : string.Format("The requested handle is {0}.", handle), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Failed to obtain requested information.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #2
0
        private void AttachHandle()
        {
            this.ReleaseHandle();

            if (this.IsHandleCreated && this.AllowDoubleClick && this.DropDownStyle == ComboBoxStyle.Simple)
            {
                NativeMethods.COMBOBOXINFO info;

                info        = new NativeMethods.COMBOBOXINFO();
                info.cbSize = Marshal.SizeOf(info);

                if (NativeMethods.GetComboBoxInfo(this.Handle, ref info))
                {
                    IntPtr hWnd;

                    hWnd = info.hwndList;

                    _listBoxWindow = new ListBoxNativeWindow(this);

                    _listBoxWindow.AssignHandle(hWnd);
                }
            }
        }