コード例 #1
0
        private static void DrawDropDownControl(DropdownControl c, Graphics g, TextFormatFlags flags, DropdownState state)
        {
            Rectangle bounds = c.ClientRectangle;

            if (_Chevron1 == null)
            {
                GetChevrons();
            }

            Rectangle r = new Rectangle(bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);

            DrawBackground(g, r, state, c.BackColor);

            if (state != DropdownState.Disabled)
            {
                if (state == DropdownState.Default || state == DropdownState.Pressed)
                {
                    g.DrawRectangle(new Pen(_FocusColor), r);
                }
                else
                {
                    g.DrawRectangle(new Pen(_BorderColor), r);
                }
            }
            else
            {
                g.DrawRectangle(new Pen(_DisabledBoarderColor), r);
            }

            DrawDropDownButton(c, g, state);
            DrawTextArea(g, r, c.ButtonSide);
            DrawText(g, _textBounds, c.Text, c.Font, c.ForeColor);
        }
コード例 #2
0
        /// <summary>
        /// Draws a button with a chevron
        /// </summary>
        /// <param name="c">DropdownControl instance.</param>
        /// <param name="g">The graphics used to draw the button.</param>
        /// <param name="state">On of the DropdownState values that specifies the visual state of the button.</param>
        public static void DrawDropDownButton(DropdownControl c, Graphics g, DropdownState state)
        {
            Rectangle r = ButtonBounds(c.ClientRectangle, c.ButtonSide);

            r = new Rectangle(r.X, r.Y, r.Width - 1, r.Height - 1);
            DrawHighlight(g, r, state);

            // x,y offset to center image chevron on split button
            int XPos = ((r.Width / 2) - (_Chevron1.Width / 2));
            int YPos = (r.Height / 2) - (_Chevron1.Height / 2);

            switch (state)
            {
            case DropdownState.Normal:
            case DropdownState.Default:
                g.DrawImage(_Chevron1, r.X + XPos, YPos);
                break;

            case DropdownState.Disabled:
                g.DrawImage(_Chevron3, r.X + XPos, YPos);
                break;

            case DropdownState.Pressed:
                g.DrawImage(_Chevron2, r.X + XPos, YPos);
                g.DrawRectangle(new Pen(_FocusBorderColor), r);
                break;

            case DropdownState.Hot:
                g.DrawImage(_Chevron4, r.X + XPos, YPos);
                using (Pen p = new Pen(_FocusColor))
                {
                    g.DrawRectangle(p, r);
                }
                break;
            }
        }
コード例 #3
0
 /// <summary>
 /// Draws a text box with a button to one side.
 /// </summary>
 /// <param name="c">DropdownControl instance.</param>
 /// <param name="g">The Graphics used to draw the control.</param>
 /// <param name="state">One of the DropdownState values that specifies the visual state of the control.</param>
 public static void DrawDropDownControl(DropdownControl c, Graphics g, DropdownState state)
 {
     DrawDropDownControl(c, g, Flags, state);
 }