Exemplo n.º 1
0
        public void SetPositionNoInvalidate(Point value)
        {
            Point point = position;

            position   = value;
            position.X = Math.Min(position.X, virtualSize.Width - base.Width);
            position.Y = Math.Min(position.Y, virtualSize.Height - base.Height);
            if (position.X < 0)
            {
                position.X = 0;
            }
            if (position.Y < 0)
            {
                position.Y = 0;
            }
            Rectangle r    = base.ClientRectangle;
            RECT      rect = RECT.FromXYWH(r.X, r.Y, r.Width, r.Height);

            ScrollWindow(new HandleRef(this, base.Handle), point.X - position.X, point.Y - position.Y, ref rect,
                         ref rect);
            SetScrollPos(new HandleRef(this, base.Handle), 0, position.X, true);
            SetScrollPos(new HandleRef(this, base.Handle), 1, position.Y, true);

            //实现继打线和套打框随滚动条移动
            foreach (Control c in this.Controls)
            {
                //套打时套打的panel是不可见的,所以用Tag属性值(active:活跃  idle:空闲)来标识套打状态
                //解决套打不能超过一页的问题,暂时只对河池人医做特殊处理。 --黄泳亮 2013.5.9
                if (c.Visible)
                {
                    c.Top += point.Y - position.Y;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Draws a scroll button on a scroll bar control.
        /// </summary>
        /// <param name="graphics">The <see cref="Graphics"/> to draw on.</param>
        /// <param name="rectangle">The <see cref="Rectangle"/> that represents the dimensions of the glyph.</param>
        /// <param name="button">One of the <see cref="ScrollButton"/> values that specifies the type of scroll arrow to draw.</param>
        /// <param name="state">A bitwise combination of the <see cref="ButtonState"/> values that specifies the state to draw the scroll button in.</param>
        public static void DrawScrollButton(Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state)
        {
            IntPtr hdc = graphics.GetHdc();

            RECT r = RECT.FromXYWH(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);

            NativeMethods.DrawFrameControl(hdc, ref r, NativeMethods.DFC.SCROLL, (NativeMethods.DFCS)button | (NativeMethods.DFCS)state);

            graphics.ReleaseHdc(hdc);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Draws a radio button control.
        /// </summary>
        /// <param name="graphics">The <see cref="Graphics"/> to draw on.</param>
        /// <param name="rectangle">The <see cref="Rectangle"/> that represents the dimensions of the radio button.</param>
        /// <param name="state">A bitwise combination of the <see cref="ButtonState"/> values that specifies the state to draw the radio button in.</param>
        public static void DrawRadioButton(Graphics graphics, Rectangle rectangle, ButtonState state)
        {
            IntPtr hdc = graphics.GetHdc();

            RECT r = RECT.FromXYWH(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);

            NativeMethods.DrawFrameControl(hdc, ref r, NativeMethods.DFC.BUTTON, NativeMethods.DFCS.BUTTONRADIO | (NativeMethods.DFCS)state);

            graphics.ReleaseHdc(hdc);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Draws a focus rectangle on the specified graphics surface and within the specified bounds.
        /// </summary>
        /// <param name="graphics">The <see cref="Graphics"/> to draw on.</param>
        /// <param name="rectangle">The <see cref="Rectangle"/> that represents the dimensions of the grab handle glyph.</param>
        /// <remarks>A focus rectangle is a dotted rectangle that Windows uses to indicate what control has the current keyboard focus.
        /// On Windows Mobile this is drawn in the color specified by the current device theme.</remarks>
        public static void DrawFocusRectangle(Graphics graphics, Rectangle rectangle)
        {
            bool   success;
            IntPtr hdc = graphics.GetHdc();

            RECT r = RECT.FromXYWH(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);

            if (InTheHand.NativeMethods.IsMobile5)
            {
                success = NativeMethods.DrawFocusRectColor(hdc, ref r, 0);
            }
            else
            {
                success = NativeMethods.DrawFocusRect(hdc, ref r);
            }

            graphics.ReleaseHdc(hdc);
        }