コード例 #1
0
ファイル: WindowsSlider.cs プロジェクト: JianwenSun/cc
        // Static Create method called by the event tracker system
        internal static void RaiseEvents (IntPtr hwnd, int eventId, object idProp, int idObject, int idChild)
        {
            if (idObject != NativeMethods.OBJID_VSCROLL && idObject != NativeMethods.OBJID_HSCROLL)
            {
                WindowsSlider wtv = new WindowsSlider (hwnd, null, 0);

                wtv.DispatchEvents (eventId, idProp, idObject, idChild);
            }
        }
コード例 #2
0
ファイル: WindowsSlider.cs プロジェクト: dox0/DotNet471RS3
        // Static Create method called by the event tracker system
        internal static void RaiseEvents(IntPtr hwnd, int eventId, object idProp, int idObject, int idChild)
        {
            if (idObject != NativeMethods.OBJID_VSCROLL && idObject != NativeMethods.OBJID_HSCROLL)
            {
                WindowsSlider wtv = new WindowsSlider(hwnd, null, 0);

                wtv.DispatchEvents(eventId, idProp, idObject, idChild);
            }
        }
コード例 #3
0
ファイル: WindowsSlider.cs プロジェクト: JianwenSun/cc
            // ------------------------------------------------------
            //
            // Internal Methods
            //
            // ------------------------------------------------------

            #region Internal Methods

            // Returns the bounding rectangle of the control.
            internal static Rect GetBoundingRectangle (IntPtr hwnd, WindowsSlider.SItem item, bool fHorizontal)
            {
                NativeMethods.Win32Rect rcChannel = new NativeMethods.Win32Rect ();
                rcChannel.left = rcChannel.right = rcChannel.top = rcChannel.bottom = 1000;

                unsafe
                {
                    XSendMessage.XSend(hwnd, NativeMethods.TBM_GETCHANNELRECT, IntPtr.Zero, new IntPtr(&rcChannel), Marshal.SizeOf(rcChannel.GetType()), XSendMessage.ErrorValue.NoCheck);
                }
                if (!Misc.MapWindowPoints(hwnd, IntPtr.Zero, ref rcChannel, 2))
                {
                    return Rect.Empty;
                }

                NativeMethods.Win32Rect rcThumb = new NativeMethods.Win32Rect();
                rcThumb.left = rcThumb.right = rcThumb.top = rcThumb.bottom = 1000;

                unsafe
                {
                    XSendMessage.XSend(hwnd, NativeMethods.TBM_GETTHUMBRECT, IntPtr.Zero, new IntPtr(&rcThumb), Marshal.SizeOf(rcThumb.GetType()), XSendMessage.ErrorValue.NoCheck);
                }
                if (!Misc.MapWindowPoints(hwnd, IntPtr.Zero, ref rcThumb, 2))
                {
                    return Rect.Empty;
                }

                if (fHorizontal)
                {
                    // When WS_EX_RTLREADING is set swap the increment and decrement bars.
                    if (Misc.IsLayoutRTL(hwnd))
                    {
                        if (item == SItem.LargeDecrement)
                        {
                            item = SItem.LargeIncrement;
                        }
                        else if (item == SItem.LargeIncrement)
                        {
                            item = SItem.LargeDecrement;
                        }
                    }

                    switch (item)
                    {
                        case WindowsSlider.SItem.LargeDecrement :
                            return new Rect (rcChannel.left, rcChannel.top, rcThumb.left - rcChannel.left, rcChannel.bottom - rcChannel.top);

                        case WindowsSlider.SItem.Thumb :
                            return new Rect (rcThumb.left, rcThumb.top, rcThumb.right - rcThumb.left, rcThumb.bottom - rcThumb.top);

                        case WindowsSlider.SItem.LargeIncrement :
                            return new Rect (rcThumb.right, rcChannel.top, rcChannel.right - rcThumb.right, rcChannel.bottom - rcChannel.top);
                    }
                }
                else
                {
                    int dx = rcChannel.bottom - rcChannel.top;
                    int dy = rcChannel.right - rcChannel.left;

                    switch (item)
                    {
                        case WindowsSlider.SItem.LargeDecrement :
                            return new Rect (rcChannel.left, rcChannel.top, dx, rcThumb.top - rcChannel.top);

                        case WindowsSlider.SItem.Thumb :
                            return new Rect (rcThumb.left, rcThumb.top, rcThumb.right - rcThumb.left, rcThumb.bottom - rcThumb.top);

                        case WindowsSlider.SItem.LargeIncrement :
                            return new Rect (rcChannel.left, rcThumb.bottom, dx, dy);
                    }
                }

                return Rect.Empty;
            }