Beispiel #1
0
        /// <summary>
        /// Hides the border of Listbox Control
        /// </summary>
        /// <param name="listBox"> listbox control object whose border is to be hidden</param>
        internal static void hideListBoxBorder(ListBox listbox)
        {
            IntPtr handle = listbox.Handle;
            int    style  = NativeWindowCommon.GetWindowLong(handle, NativeWindowCommon.GWL_STYLE);

            style &= ~NativeWindowCommon.WS_BORDER;
            NativeWindowCommon.SetWindowLong(handle, NativeWindowCommon.GWL_STYLE, style);
            NativeWindowCommon.SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0, NativeWindowCommon.SWP_NOMOVE | NativeWindowCommon.SWP_NOSIZE | NativeWindowCommon.SWP_FRAMECHANGED);
        }
Beispiel #2
0
        // Our wndproc
        private int WindowProc(IntPtr hwnd, uint msg, uint wParam, int lParam)
        {
            // Call original proc
            int ret = NativeWindowCommon.CallWindowProc(OrigWndProc, hwnd, msg, wParam, lParam);

            // Raise the mouse down event we don't get on Mobile
            if (msg == NativeWindowCommon.WM_LBUTTONDOWN)
            {
                MouseEventArgs mouseEvents = new MouseEventArgs(MouseButtons.Left, 0,
                                                                NativeWindowCommon.LoWord(lParam), NativeWindowCommon.HiWord(lParam), 0);

                this.OnMouseDown(mouseEvents);
            }
            return(ret);
        }
Beispiel #3
0
 /// <summary> subclass the listbox - replace it's window proce
 /// </summary>
 void subclassListbox()
 {
     proc        = new MobileWndProc(WindowProc);
     OrigWndProc = (IntPtr)NativeWindowCommon.SetWindowLong(Handle, NativeWindowCommon.GWL_WNDPROC,
                                                            Marshal.GetFunctionPointerForDelegate(proc).ToInt32());
 }