Esempio n. 1
0
        private void WmNotifyDropDown(ref Message m)
        {
            NativeMethods.NMTOOLBAR nmTB = (NativeMethods.NMTOOLBAR)m.GetLParam(typeof(NativeMethods.NMTOOLBAR));
            ToolBoxButton           tbb  = buttons[nmTB.iItem];
            Menu menu = tbb.DropDownMenu;

            if (menu != null)
            {
                NativeMethods.RECT      rc  = new NativeMethods.RECT();
                NativeMethods.TPMPARAMS tpm = new NativeMethods.TPMPARAMS();
                UnsafeNativeMethods.SendMessage(new HandleRef(this, Handle), NativeMethods.TB_GETRECT, nmTB.iItem, ref rc);

                if ((menu.GetType()).IsAssignableFrom(typeof(ContextMenu)))
                {
                    ((ContextMenu)menu).Show(this, new Point(rc.left, rc.bottom));
                }
                else
                {
                    UnsafeNativeMethods.MapWindowPoints(new HandleRef(nmTB.hdr, nmTB.hdr.hwndFrom), NativeMethods.NullHandleRef, ref rc, 2);
                    tpm.rcExclude_left   = rc.left;
                    tpm.rcExclude_top    = rc.top;
                    tpm.rcExclude_right  = rc.right;
                    tpm.rcExclude_bottom = rc.bottom;
                    UnsafeNativeMethods.TrackPopupMenuEx(new HandleRef(menu, menu.Handle), NativeMethods.TPM_LEFTALIGN | NativeMethods.TPM_LEFTBUTTON | NativeMethods.TPM_VERTICAL, rc.left, rc.bottom, new HandleRef(this, Handle), tpm);
                }
            }
        }
Esempio n. 2
0
 private void WmNotifyDragOut(ref Message m)
 {
     NativeMethods.NMTOOLBAR nmTB = (NativeMethods.NMTOOLBAR)m.GetLParam(typeof(NativeMethods.NMTOOLBAR));
     //Debug.WriteLine("WmNotifyDragOut");
 }