示例#1
0
        /// <summary>
        /// Paints the control on the screen
        /// </summary>
        /// <param name="e">The context to paint</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Font     f = this.Font;
            Brush    b = new SolidBrush(this.ForeColor);

            Point        startingPoint = new Point(0, 0);
            Point        endPoint      = new Point(0, 0);
            Border3DSide side          = Border3DSide.Top;

            if (DrawHorizontalLine)
            {
                startingPoint.Y = this.Height / 2;
                endPoint.Y      = startingPoint.Y;
                endPoint.X      = this.Width - startingPoint.X;
            }
            else
            {
                startingPoint.X = this.Width / 2;
                endPoint.X      = startingPoint.X;
                endPoint.Y      = this.Height - startingPoint.Y;
                side            = Border3DSide.Left;
            }

            ControlPaint.DrawBorder3D(g, startingPoint.X,
                                      startingPoint.Y,
                                      endPoint.X,
                                      endPoint.Y, LineBorderStyle, side);
        }
示例#2
0
        private int Border3DSideToSide(Border3DSide sides)
        {
            int num = 0;

            if (sides == Border3DSide.All)
            {
                num |= 0x80f;
            }
            if ((sides & Border3DSide.Bottom) != 0)
            {
                num |= 8;
            }
            if ((sides & Border3DSide.Left) != 0)
            {
                num |= 1;
            }
            if ((sides & Border3DSide.Middle) != 0)
            {
                num |= 0x800;
            }
            if ((sides & Border3DSide.Right) != 0)
            {
                num |= 4;
            }
            if ((sides & Border3DSide.Top) != 0)
            {
                num |= 2;
            }
            return(num);
        }
        /// <summary>
        /// Draws the element.
        /// </summary>
        /// <param name="drawPhase">The draw phase.</param>
        /// <param name="drawParams">The draw parameters.</param>
        /// <returns></returns>
        public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
        {
            UIElement element = drawParams.Element;

            if (drawPhase == DrawPhase.BeforeDrawBorders)
            {
                Border3DSide sides = (Border3DSide)0;
                if (element is DayHeaderAreaUIElement)
                {
                    sides = Border3DSide.Top | Border3DSide.Bottom;
                }
                else if (element is DayHeaderUIElement)
                {
                    sides = Border3DSide.Bottom;
                }

                if (sides != 0)
                {
                    if ((sides & Border3DSide.Top) != 0)
                    {
                        drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Top);
                    }

                    if ((sides & Border3DSide.Bottom) != 0)
                    {
                        drawParams.DrawBorders(UIElementBorderStyle.TwoColor, Border3DSide.Bottom);
                    }
                    return(true);
                }
            }
            return(false);
        }
示例#4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            bool isHorizontal = this.Orientation == Orientation.Horizontal;

            switch (lineType)
            {
            case LineType.Etched:
            {
                Border3DSide borderSide = isHorizontal ? Border3DSide.Top : Border3DSide.Left;
                ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, Border3DStyle.Etched, borderSide);
                break;
            }

            case LineType.Single:
            {
                int x1 = 0;
                int y1 = 0;
                int x2 = isHorizontal ? Width - 1 : 0;
                int y2 = isHorizontal ? 0 : Height - 1;

                e.Graphics.DrawLine(pen, x1, y1, x2, y2);
                break;
            }
            }
        }
示例#5
0
        private void PaintCustomColors(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Rectangle    r = Rectangle.Empty;
            int          x = 6, y = 6;
            Graphics     g      = e.Graphics;
            Border3DSide side   = (Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom);
            int          width  = colorPanel.ClientRectangle.Width;
            int          iIndex = 0;

            foreach (Color clr in m_CustomColors)
            {
                r = new Rectangle(x, y, 21, 21);
                if (r.Right > width)
                {
                    y  += 25;
                    x   = 6;
                    r.X = x;
                    r.Y = y;
                }
                ControlPaint.DrawBorder3D(g, x, y, 21, 21, Border3DStyle.Sunken, side);
                r.Inflate(-2, -2);
                g.FillRectangle(new SolidBrush(clr), r);

                m_CustomColorsPos[iIndex] = r;
                iIndex++;

                x += 24;
            }
        }
示例#6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Border3DSide sides = this.Vertical ?
                                 (Border3DSide.Left | Border3DSide.Right) : (Border3DSide.Top | Border3DSide.Bottom);

            ControlPaint.DrawBorder3D(e.Graphics, 0, 0, this.Width, this.Height, this._style, sides);
        }
        private void DrawElement_RowSelectorHeaderUIElement(ref UIElementDrawParams drawParams)
        {
            drawParams.DrawBackColor(drawParams.Element.Rect);

            Border3DSide border = Border3DSide.Bottom | Border3DSide.Right;

            drawParams.DrawBorders(UIElementBorderStyle.Solid, border);
        }
示例#8
0
        private void DrawBorder(ref UIElementDrawParams drawParams, Border3DSide borderSide, Color?color)
        {
            if (null == color)
            {
                return;
            }

            drawParams.DrawBorders(UIElementBorderStyle.Solid, borderSide, color.Value, drawParams.Element.Rect, drawParams.ElementDrawingClipRect);
        }
示例#9
0
        public void DrawBackground(Graphics g, Rectangle bounds, DrawItemState state, bool toplevel, bool hasicon, bool enabled)
        {
            bool selected = (state & DrawItemState.Selected) > 0;

            if (selected || ((state & DrawItemState.HotLight) > 0))
            {
                if (toplevel && selected)
                {
                    // draw toplevel, selected menuitem
                    bounds.Inflate(-1, 0);
                    g.FillRectangle(new SolidBrush(stripeColor), bounds);
                    Border3DSide borders = Border3DSide.Top | Border3DSide.Left | Border3DSide.Right;
                    if (this.MenuItems.Count == 0)
                    {
                        borders |= Border3DSide.Bottom;
                    }
                    ControlPaint.DrawBorder3D(g, bounds.Left, bounds.Top, bounds.Width,
                                              bounds.Height, Border3DStyle.Flat, borders);
                    ;
                }
                else
                {
                    // draw menuitem, selected OR toplevel, hotlighted
                    if (enabled)
                    {
                        g.FillRectangle(new SolidBrush(selectionColor), bounds);
                        g.DrawRectangle(new Pen(borderColor), bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);
                    }
                    else
                    {
                        // if disabled draw menuitem unselected
                        g.FillRectangle(new SolidBrush(stripeColor), bounds);
                        bounds.X     += STRIPE_WIDTH;
                        bounds.Width -= STRIPE_WIDTH;
                        g.FillRectangle(new SolidBrush(bgColor), bounds);
                    }
                }
            }
            else
            {
                if (!toplevel)
                {
                    // draw menuitem, unselected
                    g.FillRectangle(new SolidBrush(stripeColor), bounds);
                    bounds.X     += STRIPE_WIDTH;
                    bounds.Width -= STRIPE_WIDTH;
                    g.FillRectangle(new SolidBrush(bgColor), bounds);
                }
                else
                {
                    // draw toplevel, unselected menuitem
                    g.FillRectangle(SystemBrushes.Control, bounds);
                }
            }
        }
示例#10
0
 public static void DrawBorder3D(Graphics graphics, int x, int y,
                                 int width, int height,
                                 Border3DStyle style,
                                 Border3DSide sides)
 {
     ThemeManager.MainPainter.DrawBorder3D
         (graphics, x, y, width, height,
         SystemColors.InactiveBorder,
         SystemColors.Control,
         style, sides);
 }
示例#11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BevelControl"/> class.
        /// </summary>
        public BevelControl()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.DoubleBuffer, true);

            style = DefaultStyle;
            sides = DefaultShape;
        }
示例#12
0
        /// <summary>
        /// [email protected] : for FreezePanes enhancement, draw method is extended by adding a parameter to specify which border should be drawn.
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="area"></param>
        /// <param name="partType"></param>
        public override void Draw(GraphicsCache graphics, RectangleF area, BorderPartType partType)
        {
            Border3DSide sides = Border3DSide.All;

            if (partType == BorderPartType.All)
            {
                sides = Border3DSide.All;
            }

            if (BorderStyle == BorderStyle.System)
            {
                ControlPaint.DrawBorder3D(graphics.Graphics, Rectangle.Round(area), Border3DStyle.Flat, sides);
            }
        }
示例#13
0
        /// <summary>
        /// Draws a rectangle into the specified Graphics object.
        /// </summary>
        /// <param name="g">The graphics object into which to draw.</param>
        /// <param name="rect">The rect of the border.</param>
        /// <param name="borderSides">The sides of the border to be drawn.</param>
        /// <param name="pen">The pen with which to draw the border.</param>
        public static void DrawBorder(Graphics g, Rectangle rect, Border3DSide borderSides, Pen pen)
        {
            if (Border3DSide.Left == (borderSides & Border3DSide.Left))
            {
                g.DrawLine(pen, new PointF((float)rect.Left, (float)rect.Bottom), new PointF((float)rect.Left, (float)rect.Top));
            }

            if (Border3DSide.Top == (borderSides & Border3DSide.Top))
            {
                g.DrawLine(pen, new PointF((float)rect.Left, (float)rect.Top), new PointF((float)rect.Right, (float)rect.Top));
            }

            if (Border3DSide.Right == (borderSides & Border3DSide.Right))
            {
                g.DrawLine(pen, new PointF((float)rect.Right, (float)rect.Top), new PointF((float)rect.Right, (float)rect.Bottom));
            }

            if (Border3DSide.Bottom == (borderSides & Border3DSide.Bottom))
            {
                g.DrawLine(pen, new PointF((float)rect.Left, (float)rect.Bottom), new PointF((float)rect.Right, (float)rect.Bottom));
            }
        }
        /// <summary>
        /// Called during the drawing operation of a UIElement for a specific phase
        /// of the operation. This will only be called for the phases returned
        /// from the GetPhasesToFilter method.
        /// </summary>
        /// <param name="drawPhase">Contains a single bit which identifies the current draw phase.</param>
        /// <param name="drawParams">The <see cref="T:Infragistics.Win.UIElementDrawParams" /> used to provide rendering information.</param>
        /// <returns>
        /// Returning true from this method indicates that this phase has been handled and the default processing should be skipped.
        /// </returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
        {
            UIElement element = drawParams.Element;

            switch (drawPhase)
            {
            case DrawPhase.BeforeDrawBorders:
            {
                Border3DSide sides = (Border3DSide)0;

                if (element is DayOfWeekHeaderUIElement)
                {
                    sides = Border3DSide.Top | Border3DSide.Bottom;
                }

                if (sides != 0)
                {
                    if ((sides & Border3DSide.Top) != 0)
                    {
                        drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Top);
                    }

                    if ((sides & Border3DSide.Bottom) != 0)
                    {
                        drawParams.DrawBorders(UIElementBorderStyle.TwoColor, Border3DSide.Bottom);
                    }
                    return(true);
                }
                break;
            }

            case DrawPhase.BeforeDrawFocus:
                return(true);
            }
            return(false);
        }
示例#15
0
文件: Theme.cs 项目: yonder/mono
 public abstract void CPDrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides);
示例#16
0
		private static void DrawBorderInternal (Graphics graphics, int startX, int startY, int endX, int endY,
			int width, Color color, ButtonBorderStyle style, Border3DSide side) 
		{
			DrawBorderInternal (graphics, (float) startX, (float) startY, (float) endX, (float) endY, 
				width, color, style, side);
		}
示例#17
0
		public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) {
			CPDrawBorder3D(graphics, rectangle, style, sides, ColorControl);
		}
	public static void DrawBorder3D(System.Drawing.Graphics graphics, int x, int y, int width, int height, Border3DStyle style, Border3DSide sides) {}
示例#19
0
        public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style, Border3DSide sides)
        {
            if (graphics == null)
            {
                throw new ArgumentNullException("graphics");
            }

            if ((style & Border3DStyle.Adjust) == Border3DStyle.Adjust)
            {
                var sz = SystemInformation.Border3DSize;
                x      -= sz.Width;
                y      -= sz.Height;
                width  += sz.Width;
                height += sz.Height;
                style  &= ~Border3DStyle.Adjust;
            }

            switch (style)
            {
            case Border3DStyle.Bump:
                DrawBorderStyleBump(graphics, x, y, width, height, sides);
                break;

            case Border3DStyle.Etched:
                DrawBorderStyleEtched(graphics, x, y, width, height, sides);
                break;

            case Border3DStyle.Flat:
                DrawBorderStyleFlat(graphics, x, y, width, height, sides);
                break;

            case Border3DStyle.Raised:
                DrawBorderStyleRaised(graphics, x, y, width, height, sides, true, true);
                break;

            case Border3DStyle.RaisedInner:
                DrawBorderStyleRaised(graphics, x, y, width, height, sides, true, false);
                break;

            case Border3DStyle.RaisedOuter:
                DrawBorderStyleRaised(graphics, x, y, width, height, sides, false, true);
                break;

            case Border3DStyle.Sunken:
                DrawBorderStyleSunken(graphics, x, y, width, height, sides, true, true);
                break;

            case Border3DStyle.SunkenInner:
                DrawBorderStyleSunken(graphics, x, y, width, height, sides, true, false);
                break;

            case Border3DStyle.SunkenOuter:
                DrawBorderStyleSunken(graphics, x, y, width, height, sides, false, true);
                break;
            }
        }
示例#20
0
        private static void DrawBorderStyleSunken(Graphics graphics, int x, int y, int width, int height, Border3DSide sides, bool inner, bool outer)
        {
            var left   = (sides & Border3DSide.Left) != 0;
            var top    = (sides & Border3DSide.Top) != 0;
            var right  = (sides & Border3DSide.Right) != 0;
            var bottom = (sides & Border3DSide.Bottom) != 0;

            borderPen1.DashStyle = DashStyle.Solid;
            borderPen2.DashStyle = DashStyle.Solid;
            borderPen3.DashStyle = DashStyle.Solid;
            borderPen4.DashStyle = DashStyle.Solid;
            borderPen1.Color     = outer ? SystemColors.ControlDark : Color.Transparent;
            borderPen2.Color     = SystemColors.ControlDarkDark;
            borderPen3.Color     = outer ? Color.White : Color.Transparent;
            borderPen4.Color     = SystemColors.ControlLight;

            if (left)
            {
                graphics.DrawLine(borderPen1, x, y, x, y + height);
                if (inner)
                {
                    graphics.DrawLine(borderPen2, x + 1, y, x + 1, y + height);
                }
            }
            if (top)
            {
                var top1x2 = right ? x + width - 1 : x + width;
                var top2x1 = left ? x + 1 : x;
                var top2x2 = right ? x + width - 2 : x + width;
                graphics.DrawLine(borderPen1, x, y, top1x2, y);
                if (inner)
                {
                    graphics.DrawLine(borderPen2, top2x1, y + 1, top2x2, y + 1);
                }
            }
            if (right)
            {
                var right2y1 = top ? y + 1 : y;
                var right2y2 = bottom ? y + height - 1 : y + height;
                graphics.DrawLine(borderPen3, x + width - 1, y, x + width - 1, y + height);
                if (inner)
                {
                    graphics.DrawLine(borderPen4, x + width - 2, right2y1, x + width - 2, right2y2);
                }
            }
            if (bottom)
            {
                var bottom2x1 = left ? x + 1 : x;
                var bottom2x2 = right ? x + width - 2 : x + width;
                graphics.DrawLine(borderPen3, x, y + height - 1, x + width, y + height - 1);
                if (inner)
                {
                    graphics.DrawLine(borderPen4, bottom2x1, y + height - 2, bottom2x2, y + height - 2);
                }
            }
        }
示例#21
0
 public virtual void DrawEdge(ref Rectangle rect, Border3DStyle border, Border3DSide sides, int flags)
 {
     Win32.DrawEdge(this._hdc, ref rect, this.Border3dStyleToBorder(border), this.Border3DSideToSide(sides) | flags);
 }
示例#22
0
//		public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) {
//			CPDrawBorder3D(graphics, rectangle, style, sides, ColorControl);
//		}
		
		public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color)
		{
			Pen		penTopLeft;
			Pen		penTopLeftInner;
			Pen		penBottomRight;
			Pen		penBottomRightInner;
			Rectangle	rect= new Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
			
			if ((style & Border3DStyle.Adjust) != 0) {
				rect.Y -= 2;
				rect.X -= 2;
				rect.Width += 4;
				rect.Height += 4;
			}
			
			penTopLeft = penTopLeftInner = penBottomRight = penBottomRightInner = ResPool.GetPen (control_color);
			
			CPColor cpcolor = ResPool.GetCPColor (control_color);
			
			switch (style) {
			case Border3DStyle.Raised:
				penTopLeftInner = ResPool.GetPen (cpcolor.LightLight);
				penBottomRight = ResPool.GetPen (cpcolor.Dark);
				penBottomRightInner = ResPool.GetPen (BorderColor);
				break;
			case Border3DStyle.Sunken:
				penTopLeft = ResPool.GetPen (BorderColor);
				penTopLeftInner = ResPool.GetPen (cpcolor.Dark);
				penBottomRight = ResPool.GetPen (cpcolor.LightLight);
				break;
			case Border3DStyle.Etched:
				penTopLeft = penBottomRightInner = ResPool.GetPen (BorderColor);
				penTopLeftInner = penBottomRight = ResPool.GetPen (cpcolor.LightLight);
				break;
			case Border3DStyle.RaisedOuter:
				penBottomRight = ResPool.GetPen (cpcolor.Dark);
				break;
			case Border3DStyle.SunkenOuter:
				penTopLeft = ResPool.GetPen (BorderColor);
				penBottomRight = ResPool.GetPen (cpcolor.LightLight);
				break;
			case Border3DStyle.RaisedInner:
				penTopLeft = ResPool.GetPen (cpcolor.LightLight);
				penBottomRight = ResPool.GetPen (BorderColor);
				break;
			case Border3DStyle.SunkenInner:
				penTopLeft = ResPool.GetPen (cpcolor.Dark);
				break;
			case Border3DStyle.Flat:
				penTopLeft = penBottomRight = ResPool.GetPen (BorderColor);
				break;
			case Border3DStyle.Bump:
				penTopLeftInner = penBottomRight = ResPool.GetPen (cpcolor.Dark);
				break;
			default:
				break;
			}
			
			if ((sides & Border3DSide.Middle) != 0) {
				graphics.FillRectangle (ResPool.GetSolidBrush (control_color), rect);
			}
			
			if ((sides & Border3DSide.Left) != 0) {
				graphics.DrawLine (penTopLeft, rect.Left, rect.Bottom - 2, rect.Left, rect.Top);
				graphics.DrawLine (penTopLeftInner, rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top);
			}
			
			if ((sides & Border3DSide.Top) != 0) {
				graphics.DrawLine (penTopLeft, rect.Left, rect.Top, rect.Right - 2, rect.Top);
				graphics.DrawLine (penTopLeftInner, rect.Left + 1, rect.Top + 1, rect.Right - 3, rect.Top + 1);
			}
			
			if ((sides & Border3DSide.Right) != 0) {
				graphics.DrawLine (penBottomRight, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 1);
				graphics.DrawLine (penBottomRightInner, rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 2);
			}
			
			if ((sides & Border3DSide.Bottom) != 0) {
				graphics.DrawLine (penBottomRight, rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
				graphics.DrawLine (penBottomRightInner, rect.Left + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2);
			}
		}
示例#23
0
文件: Theme.cs 项目: Profit0004/mono
		public abstract void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides);
 public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides)
 {
     ThemeEngine.Current.CPDrawBorder3D(graphics, rectangle, style, sides);
 }
 public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style, Border3DSide sides)
 {
     DrawBorder3D(graphics, new Rectangle(x, y, width, height), style, sides);
 }
 public static void DrawBorder3D(System.Drawing.Graphics graphics, int x, int y, int width, int height, Border3DStyle style, Border3DSide sides)
 {
 }
	// Draw a 3D border within a rectangle.
	public virtual void DrawBorder3D(Graphics graphics, int x, int y,
									 int width, int height,
									 Color foreColor,
									 Color backColor,
									 Border3DStyle style,
									 Border3DSide sides)
			{
				Color dark, light, darkdark, lightlight;
				Color top1, top2 , left1, left2;
				Color bottom1, bottom2, right1, right2;
				Pen pen;
				bool doubleBorder=false;
				top2 = left2 = bottom2 = right2 = Color.Black;

				dark=ControlPaint.Dark(backColor);
				light=ControlPaint.Light(backColor);
				darkdark=ControlPaint.DarkDark(backColor);
				lightlight=ControlPaint.LightLight(backColor);
								
				switch(style)
				{
					case Border3DStyle.Flat:
						top1=dark;
						left1=dark;
						right1=dark;
						bottom1=dark;
						doubleBorder=false;
						break;
					case Border3DStyle.Raised:
						top1=light;
						top2=lightlight;
						left1=light;
						left2=lightlight;
						bottom1=dark;
						bottom2=darkdark;
						right1=dark;
						right2=darkdark;
						doubleBorder=true;
						break;
					case Border3DStyle.RaisedInner:
						top1=lightlight;
						left1=lightlight;
						bottom1=dark;
						right1=dark;
						doubleBorder=false;
						break;
					case Border3DStyle.RaisedOuter:
						top1=light;
						left1=light;
						bottom1=darkdark;
						right1=darkdark;
						doubleBorder=false;
						break;
					case Border3DStyle.Etched:
						top1=dark;
						top2=lightlight;
						left1=dark;
						left2=lightlight;
						bottom1=dark;
						bottom2=lightlight;
						right1=dark;
						right2=lightlight;
						doubleBorder=true;
						break;
					case Border3DStyle.Sunken:
						top1=dark;
						top2=darkdark;
						left1=dark;
						left2=darkdark;
						right1=light;
						right2=lightlight;
						bottom1=light;
						bottom2=lightlight;
						doubleBorder=true;
						break;
					case Border3DStyle.SunkenOuter:
						top1=dark;
						left1=dark;
						bottom1=lightlight;
						right1=lightlight;
						doubleBorder=false;
						break;
					case Border3DStyle.SunkenInner:
						top1=dark;
						left1=dark;
						bottom1=light;
						right1=light;
						doubleBorder=false;
						break;					
					case Border3DStyle.Bump:
						top1=light;
						top2=darkdark;
						left1=light;
						left2=darkdark;
						right1=light;
						right2=darkdark;
						bottom1=light;
						bottom2=darkdark;
						doubleBorder=true;
						break;
					default:
						top1=foreColor;
						bottom1=foreColor;
						left1=foreColor;
						right1=foreColor;
						doubleBorder=false;
						break;
				}

				if(doubleBorder && (width >= 4 && height >= 4))
				{
					pen = new Pen(left1, 1.0f);
					pen.EndCap = LineCap.Square;
					if((sides & Border3DSide.Left )!=0)
					{
						graphics.DrawLine(pen, x, y + height - 2, x, y);
						pen.Color = left2;
						graphics.DrawLine(pen, x + 1, y + height - 3,
									  x + 1, y + 1);
					}
					if((sides & Border3DSide.Right )!=0)
					{
						pen.Color = right1;
						graphics.DrawLine(pen, x + width - 2, y + 1,
									  x + width - 2, y + height - 2);
						pen.Color = right2;
						graphics.DrawLine(pen, x + width - 1, y,
									  x + width - 1, y + height - 1);
					}
					if((sides & Border3DSide.Top)!=0)
					{
						pen.Color = top1;
						graphics.DrawLine(pen, x + 1, y, x + width - 2, y);
						pen.Color = top2;
						graphics.DrawLine(pen, x + 2, y + 1,
									  x + width - 3, y + 1);
					}
					if((sides & Border3DSide.Bottom)!=0)
					{
						pen.Color = bottom1;
						graphics.DrawLine(pen, x + width - 3, y + height - 2,
									  x + 1, y + height - 2);
						pen.Color = bottom2;
						graphics.DrawLine(pen, x + width - 2, y + height - 1,
									  x, y + height - 1);
					}
					pen.Dispose();
					x += 2;
					y += 2;
					width -= 4;
					height -= 4;
				}
				else if(!doubleBorder && width >= 2 && height >= 2)
				{
					pen = new Pen(left1, 1.0f);
					pen.EndCap = LineCap.Square;
					if((sides & Border3DSide.Left )!=0)
					{
						graphics.DrawLine(pen, x, y + height - 2, x, y);
					}
					if((sides & Border3DSide.Right )!=0)
					{
						pen.Color = right1;
						graphics.DrawLine(pen, x + width - 1, y,
									  x + width - 1, y + height - 1);
					}
					if((sides & Border3DSide.Top)!=0)
					{
						pen.Color = top1;
						graphics.DrawLine(pen, x + 1, y, x + width - 2, y);
					}
					if((sides & Border3DSide.Bottom)!=0)
					{
						pen.Color = bottom1;
						graphics.DrawLine(pen, x + width - 2, y + height - 1,
									  x, y + height - 1);
					}
					pen.Dispose();
					x+=1;
					y+=1;
					width -=2;
					height -=2;
				}
			}
 public static void DrawBorder3D(System.Drawing.Graphics graphics, System.Drawing.Rectangle rectangle, Border3DStyle style, Border3DSide sides)
 {
 }
示例#29
0
        private void DrawBorderHelper(Graphics g, Rectangle rect, Rectangle invalidRect, Border3DSide sides, Color color, ref Pen pen)
        {
            if (sides == (Border3DSide)0)
            {
                return;
            }
            Rectangle rectangle = rect;

            rectangle.Width--;
            rectangle.Height--;
            if (rectangle.Height > 0 && rectangle.Width > 0)
            {
                if (pen == null)
                {
                    pen = Infragistics.Win.Utilities.CreatePen(color);
                }
                else if (pen.Color != color)
                {
                    pen.Color = Infragistics.Win.Utilities.GetNonSystemColor(color);
                }
                if ((sides & Border3DSide.Left) != 0 && invalidRect.Left <= rectangle.Left)
                {
                    g.DrawLine(pen, rectangle.Left, rectangle.Bottom, rectangle.Left, rectangle.Top);
                }
                if ((sides & Border3DSide.Right) != 0 && invalidRect.Right >= rectangle.Right - 1)
                {
                    g.DrawLine(pen, rectangle.Right, rectangle.Top, rectangle.Right, rectangle.Bottom);
                }
                if ((sides & Border3DSide.Top) != 0 && invalidRect.Top <= rectangle.Top)
                {
                    g.DrawLine(pen, rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Top);
                }
                if ((sides & Border3DSide.Bottom) != 0 && invalidRect.Bottom >= rectangle.Bottom - 1)
                {
                    g.DrawLine(pen, rectangle.Right, rectangle.Bottom, rectangle.Left, rectangle.Bottom);
                }
            }
        }
示例#30
0
 public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides)
 {
     DrawBorder3D(graphics, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, style, sides);
 }
示例#31
0
        /// <summary>
        /// Default constructor of the control
        /// </summary>
        public InfoBarLite()
        {
            m_Image = null;
              m_ImageAlignment = ImageAlignment.TopLeft;
              m_BackStyle = BackStyle.Solid;
              m_GradientMode = LinearGradientMode.Horizontal;
              m_GradientStartColor = Color.DeepSkyBlue;
              m_GradientEndColor = Color.White;
              m_BorderStyle = Border3DStyle.Etched;
              m_BorderSide = Border3DSide.Bottom;

              m_Text1 = "Peace at home, peace in the world!";
              m_Text1ForeColor = SystemColors.ControlText;

              m_Text2 = "The quick brown fox lazily jumped over the bridge.";
              m_Text2ForeColor = SystemColors.ControlText;

              try
              {
            m_Text1Font = new Font("Tahoma", 8, FontStyle.Bold, GraphicsUnit.Point);
            m_Text2Font = new Font("Tahoma", 8);
              }
              catch
              {
            m_Text1Font = Font;
            m_Text2Font = Font;
              }

              m_ImageOffsetX = 2;
              m_ImageOffsetY = 0;
              m_Text1OffsetX = 0;
              m_Text1OffsetY = 0;
              m_Text2OffsetX = 20;
              m_Text2OffsetY = 0;

              BackColor = SystemColors.Window;

              ResizeRedraw = true;
              SetStyle(ControlStyles.UserPaint, true);
              SetStyle(ControlStyles.AllPaintingInWmPaint, true);
              SetStyle(ControlStyles.DoubleBuffer, true);
        }
	public static void DrawBorder3D(System.Drawing.Graphics graphics, System.Drawing.Rectangle rectangle, Border3DStyle style, Border3DSide sides) {}
 public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides)
 {
     DrawBorder3D(graphics, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, style, sides);
 }
	public static void DrawBorder3D(Graphics graphics, int x, int y,
									int width, int height,
									Border3DStyle style,
									Border3DSide sides)
			{
				ThemeManager.MainPainter.DrawBorder3D
					(graphics, x, y, width, height,
					 SystemColors.InactiveBorder,
					 SystemColors.Control,
					 style, sides);
			}
        /// <include file='doc\ControlPaint.uex' path='docs/doc[@for="ControlPaint.DrawBorder3D5"]/*' />
        /// <devdoc>
        ///     Draws a 3D style border at the given rectangle.  You may specify the style
        ///     of the 3D appearance, and which sides of the 3D rectangle you wish to
        ///     draw.
        /// </devdoc>
        public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style, Border3DSide sides) {
            if (graphics == null) {
                throw new ArgumentNullException("graphics");
            }

            int edge = ((int)style) & 0x0F;
            int flags = ((int)sides) | (((int)style) & ~0x0F);

            NativeMethods.RECT rc = NativeMethods.RECT.FromXYWH(x, y, width, height);

            // Windows just draws the border to size, and then
            // shrinks the rectangle so the user can paint the
            // client area.  We can't really do that, so we do
            // the opposite:  We precalculate the size of the border
            // and enlarge the rectangle so the client size is
            // preserved.
            //
            if ((flags & (int)Border3DStyle.Adjust) == (int)Border3DStyle.Adjust) {
                Size sz = SystemInformation.Border3DSize;
                rc.left -= sz.Width;
                rc.right += sz.Width;
                rc.top -= sz.Height;
                rc.bottom += sz.Height;
                flags &= ~((int)Border3DStyle.Adjust);
            }

            using( WindowsGraphics wg = WindowsGraphics.FromGraphics(graphics)) { // Get Win32 dc with Graphics properties applied to it.
                SafeNativeMethods.DrawEdge(new HandleRef(wg, wg.DeviceContext.Hdc), ref rc, edge, flags);
            }
        }
		public static void DrawBorder3D( Graphics graphics, int x, int y, int width, int height, Border3DStyle style,Border3DSide sides) {
			DrawBorder3D( graphics, new Rectangle(x, y, width, height), style, sides);
		}
		public static void DrawBorder3D( Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) {

			ThemeEngine.Current.CPDrawBorder3D (graphics, rectangle, style, sides);
		}
示例#38
0
		public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color)
		{
			Pen		penTopLeft;
			Pen		penTopLeftInner;
			Pen		penBottomRight;
			Pen		penBottomRightInner;
			Rectangle	rect= new Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
			bool is_ColorControl = control_color.ToArgb () == ColorControl.ToArgb () ? true : false;
			
			if ((style & Border3DStyle.Adjust) != 0) {
				rect.Y -= 2;
				rect.X -= 2;
				rect.Width += 4;
				rect.Height += 4;
			}
			
			penTopLeft = penTopLeftInner = penBottomRight = penBottomRightInner = is_ColorControl ? SystemPens.Control : ResPool.GetPen (control_color);
			
			CPColor cpcolor = CPColor.Empty;
			
			if (!is_ColorControl)
				cpcolor = ResPool.GetCPColor (control_color);
			
			switch (style) {
			case Border3DStyle.Raised:
				penTopLeftInner = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight);
				penBottomRight = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark);
				penBottomRightInner = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark);
				break;
			case Border3DStyle.Sunken:
				penTopLeft = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark);
				penTopLeftInner = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark);
				penBottomRight = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight);
				break;
			case Border3DStyle.Etched:
				penTopLeft = penBottomRightInner = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark);
				penTopLeftInner = penBottomRight = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight);
				break;
			case Border3DStyle.RaisedOuter:
				penBottomRight = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark);
				break;
			case Border3DStyle.SunkenOuter:
				penTopLeft = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark);
				penBottomRight = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight);
				break;
			case Border3DStyle.RaisedInner:
				penTopLeft = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight);
				penBottomRight = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark);
				break;
			case Border3DStyle.SunkenInner:
				penTopLeft = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark);
				break;
			case Border3DStyle.Flat:
				penTopLeft = penBottomRight = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark);
				break;
			case Border3DStyle.Bump:
				penTopLeftInner = penBottomRight = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark);
				break;
			default:
				break;
			}
			
			bool inner = ((style != Border3DStyle.RaisedOuter) && (style != Border3DStyle.SunkenOuter));
			
			if ((sides & Border3DSide.Middle) != 0) {
				Brush brush = is_ColorControl ? SystemBrushes.Control : ResPool.GetSolidBrush (control_color);
				graphics.FillRectangle (brush, rect);
			}
			
			if ((sides & Border3DSide.Left) != 0) {
				graphics.DrawLine (penTopLeft, rect.Left, rect.Bottom - 2, rect.Left, rect.Top);
				if ((rect.Width > 2) && inner)
					graphics.DrawLine (penTopLeftInner, rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top);
			}
			
			if ((sides & Border3DSide.Top) != 0) {
				graphics.DrawLine (penTopLeft, rect.Left, rect.Top, rect.Right - 2, rect.Top);
				if ((rect.Height > 2) && inner)
					graphics.DrawLine (penTopLeftInner, rect.Left + 1, rect.Top + 1, rect.Right - 3, rect.Top + 1);
			}
			
			if ((sides & Border3DSide.Right) != 0) {
				graphics.DrawLine (penBottomRight, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 1);
				if ((rect.Width > 3) && inner)
					graphics.DrawLine (penBottomRightInner, rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 2);
			}
			
			if ((sides & Border3DSide.Bottom) != 0) {
				graphics.DrawLine (penBottomRight, rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
				if ((rect.Height > 3) && inner)
					graphics.DrawLine (penBottomRightInner, rect.Left + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2);
			}
		}
示例#39
0
 public void DrawEdge(ref Rectangle rect, Border3DStyle border, Border3DSide sides)
 {
     this.DrawEdge(ref rect, border, sides, 0);
 }
示例#40
0
		private static void DrawBorderInternal (Graphics graphics, float startX, float startY, float endX, float endY,
			int width, Color color, ButtonBorderStyle style, Border3DSide side) {

			Pen pen = null;

			switch (style) {
			case ButtonBorderStyle.Solid:
			case ButtonBorderStyle.Inset:
			case ButtonBorderStyle.Outset:
					pen = ThemeEngine.Current.ResPool.GetDashPen (color, DashStyle.Solid);
					break;
			case ButtonBorderStyle.Dashed:
					pen = ThemeEngine.Current.ResPool.GetDashPen (color, DashStyle.Dash);
					break;
			case ButtonBorderStyle.Dotted:
					pen = ThemeEngine.Current.ResPool.GetDashPen (color, DashStyle.Dot);
					break;
			default:
			case ButtonBorderStyle.None:
					return;
			}

			switch(style) {
			case ButtonBorderStyle.Outset: {
				Color		colorGrade;
				int		hue, brightness, saturation;
				int		brightnessSteps;
				int		brightnessDownSteps;

				ControlPaint.Color2HBS(color, out hue, out brightness, out saturation);

				brightnessDownSteps=brightness/width;
				if (brightness>127) {
					brightnessSteps=Math.Max(6, (160-brightness)/width);
				} else {
					brightnessSteps=(127-brightness)/width;
				}

				for (int i=0; i<width; i++) {
					switch(side) {
					case Border3DSide.Left:	{
						colorGrade=ControlPaint.HBS2Color(hue, Math.Min(255, brightness+brightnessSteps*(width-i)), saturation);
						pen = ThemeEngine.Current.ResPool.GetPen (colorGrade);
						graphics.DrawLine(pen, startX+i, startY+i, endX+i, endY-i);
						break;
					}

					case Border3DSide.Right: {
						colorGrade=ControlPaint.HBS2Color(hue, Math.Max(0, brightness-brightnessDownSteps*(width-i)), saturation);
						pen = ThemeEngine.Current.ResPool.GetPen (colorGrade);
						graphics.DrawLine(pen, startX-i, startY+i, endX-i, endY-i);
						break;
					}

					case Border3DSide.Top: {
						colorGrade=ControlPaint.HBS2Color(hue, Math.Min(255, brightness+brightnessSteps*(width-i)), saturation);
						pen = ThemeEngine.Current.ResPool.GetPen (colorGrade);
						graphics.DrawLine(pen, startX+i, startY+i, endX-i, endY+i);
						break;
					}

					case Border3DSide.Bottom: {
						colorGrade=ControlPaint.HBS2Color(hue, Math.Max(0, brightness-brightnessDownSteps*(width-i)), saturation);
						pen = ThemeEngine.Current.ResPool.GetPen (colorGrade);
						graphics.DrawLine(pen, startX+i, startY-i, endX-i, endY-i);
						break;
					}
					}
				}
				break;
			}

			case ButtonBorderStyle.Inset: {
				Color		colorGrade;
				int		hue, brightness, saturation;
				int		brightnessSteps;
				int		brightnessDownSteps;

				ControlPaint.Color2HBS(color, out hue, out brightness, out saturation);

				brightnessDownSteps=brightness/width;
				if (brightness>127) {
					brightnessSteps=Math.Max(6, (160-brightness)/width);
				} else {
					brightnessSteps=(127-brightness)/width;
				}

				for (int i=0; i<width; i++) {
					switch(side) {
					case Border3DSide.Left:	{
						colorGrade=ControlPaint.HBS2Color(hue, Math.Max(0, brightness-brightnessDownSteps*(width-i)), saturation);
						pen = ThemeEngine.Current.ResPool.GetPen (colorGrade);
						graphics.DrawLine(pen, startX+i, startY+i, endX+i, endY-i);
						break;
					}

					case Border3DSide.Right: {
						colorGrade=ControlPaint.HBS2Color(hue, Math.Min(255, brightness+brightnessSteps*(width-i)), saturation);
						pen = ThemeEngine.Current.ResPool.GetPen (colorGrade);
						graphics.DrawLine(pen, startX-i, startY+i, endX-i, endY-i);
						break;
					}

					case Border3DSide.Top: {
						colorGrade=ControlPaint.HBS2Color(hue, Math.Max(0, brightness-brightnessDownSteps*(width-i)), saturation);
						pen = ThemeEngine.Current.ResPool.GetPen (colorGrade);
						graphics.DrawLine(pen, startX+i, startY+i, endX-i, endY+i);
						break;
					}

					case Border3DSide.Bottom: {
						colorGrade=ControlPaint.HBS2Color(hue, Math.Min(255, brightness+brightnessSteps*(width-i)), saturation);
						pen = ThemeEngine.Current.ResPool.GetPen (colorGrade);
						graphics.DrawLine(pen, startX+i, startY-i, endX-i, endY-i);
						break;
					}
					}
				}
				break;
			}

				/*
					I decided to have the for-loop duplicated for speed reasons;
					that way we only have to switch once (as opposed to have the
					for-loop around the switch)
				*/
			default: {
				switch(side) {
				case Border3DSide.Left:	{
					for (int i=0; i<width; i++) {
						graphics.DrawLine(pen, startX+i, startY+i, endX+i, endY-i);
					}
					break;
				}

				case Border3DSide.Right: {
					for (int i=0; i<width; i++) {
						graphics.DrawLine(pen, startX-i, startY+i, endX-i, endY-i);
					}
					break;
				}

				case Border3DSide.Top: {
					for (int i=0; i<width; i++) {
						graphics.DrawLine(pen, startX+i, startY+i, endX-i, endY+i);
					}
					break;
				}

				case Border3DSide.Bottom: {
					for (int i=0; i<width; i++) {
						graphics.DrawLine(pen, startX+i, startY-i, endX-i, endY-i);
					}
					break;
				}
				}
				break;
			}
			}
		}
示例#41
0
		public override void CPDrawBorder3D( Graphics dc, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color ) {
			// currently we don't take care of Border3DStyle or Border3DSide
			
			Pen tmp_pen = ResPool.GetPen( edge_bottom_inner_color );
			dc.DrawLine( tmp_pen, rectangle.X + 1, rectangle.Y + 2, rectangle.X + 2, rectangle.Y + 1 );
			dc.DrawLine( tmp_pen, rectangle.Right - 3, rectangle.Y + 1, rectangle.Right - 2, rectangle.Y + 2 );
			dc.DrawLine( tmp_pen, rectangle.Right - 3, rectangle.Bottom - 2, rectangle.Right - 2, rectangle.Bottom - 3 );
			dc.DrawLine( tmp_pen, rectangle.X + 1, rectangle.Bottom - 3, rectangle.X + 2, rectangle.Bottom - 2 );
			
			tmp_pen = ResPool.GetPen( theme_back_color );
			dc.DrawLine( tmp_pen, rectangle.X + 2, rectangle.Y + 2, rectangle.Right - 3, rectangle.Y + 2 );
			dc.DrawLine( tmp_pen, rectangle.X + 2, rectangle.Y + 3, rectangle.X + 2, rectangle.Bottom - 3 );
			
			tmp_pen = ResPool.GetPen( Color.White );
			dc.DrawLine( tmp_pen, rectangle.X + 3, rectangle.Bottom - 3, rectangle.Right - 3, rectangle.Bottom - 3 );
			dc.DrawLine( tmp_pen, rectangle.Right - 3, rectangle.Y + 3, rectangle.Right - 3, rectangle.Bottom - 3 );
			
			Point[] points = {
				new Point( rectangle.X + 3, rectangle.Y + 1 ),
				new Point( rectangle.Right - 4, rectangle.Y + 1 ),
				new Point( rectangle.Right - 2, rectangle.Y + 3 ),
				new Point( rectangle.Right - 2, rectangle.Bottom - 4 ),
				new Point( rectangle.Right - 4, rectangle.Bottom - 2 ),
				new Point( rectangle.X + 3, rectangle.Bottom - 2 ),
				new Point( rectangle.X + 1, rectangle.Bottom - 4 ),
				new Point( rectangle.X + 1, rectangle.Y + 3 ),
				new Point( rectangle.X + 3, rectangle.Y + 1 )
			};
			
			dc.DrawLines( ResPool.GetPen( combobox_border_color ), points );
			
			Point[] points_top_outer = {
				new Point( rectangle.X + 1, rectangle.Y + 1 ),
				new Point( rectangle.X + 2, rectangle.Y ),
				new Point( rectangle.Right - 3, rectangle.Y ),
				new Point( rectangle.Right - 2 , rectangle.Y + 1 )
			};
			
			Point[] points_bottom_outer = {
				new Point( rectangle.X + 1, rectangle.Bottom - 2 ),
				new Point( rectangle.X + 2, rectangle.Bottom - 1 ),
				new Point( rectangle.Right - 3, rectangle.Bottom - 1 ),
				new Point( rectangle.Right - 2, rectangle.Bottom - 2 )
			};
			
			// outer border
			tmp_pen = ResPool.GetPen( button_outer_border_dark_color );
			dc.DrawLines( tmp_pen, points_top_outer );
			tmp_pen = ResPool.GetPen( button_outer_border_light_color );
			dc.DrawLines( tmp_pen, points_bottom_outer );
			
			using ( LinearGradientBrush lgbr = new LinearGradientBrush( new Point( rectangle.X, rectangle.Y + 2 ), new Point( rectangle.X, rectangle.Bottom - 3 ), button_outer_border_dark_color, button_outer_border_light_color ) ) {
				using (Pen lgbrpen = new Pen (lgbr)) {
					dc.DrawLine (lgbrpen, rectangle.X, rectangle.Y + 2, rectangle.X, rectangle.Bottom - 3 );
					dc.DrawLine (lgbrpen, rectangle.Right - 1, rectangle.Y + 2, rectangle.Right - 1, rectangle.Bottom - 3 );
				}
			}
			
			tmp_pen = ResPool.GetPen( button_edge_top_outer_color );
			dc.DrawLine( tmp_pen, rectangle.X, rectangle.Y + 1, rectangle.X + 1, rectangle.Y );
			dc.DrawLine( tmp_pen, rectangle.Right - 2, rectangle.Y, rectangle.Right - 1, rectangle.Y + 1 );
			
			tmp_pen = ResPool.GetPen( button_edge_bottom_outer_color );
			dc.DrawLine( tmp_pen, rectangle.X, rectangle.Bottom - 2, rectangle.X + 1, rectangle.Bottom - 1 );
			dc.DrawLine( tmp_pen, rectangle.Right - 1, rectangle.Bottom - 2, rectangle.Right - 2, rectangle.Bottom - 1 );
		}
示例#42
0
文件: Theme.cs 项目: yonder/mono
 public abstract void CPDrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color);
示例#43
0
        private static void DrawBorderStyleFlat(Graphics graphics, int x, int y, int width, int height, Border3DSide sides)
        {
            var left   = (sides & Border3DSide.Left) != 0;
            var top    = (sides & Border3DSide.Top) != 0;
            var right  = (sides & Border3DSide.Right) != 0;
            var bottom = (sides & Border3DSide.Bottom) != 0;

            borderPen1.DashStyle = DashStyle.Solid;
            borderPen2.DashStyle = DashStyle.Solid;
            borderPen1.Color     = SystemColors.ControlDark;
            borderPen2.Color     = SystemColors.Control;

            if (left)
            {
                graphics.DrawLine(borderPen1, x, y, x, y + height);
                graphics.DrawLine(borderPen2, x + 1, y, x + 1, y + height);
            }
            if (top)
            {
                var top2x1 = left ? x + 1 : x;
                var top2x2 = right ? x + width - 2 : x + width;
                graphics.DrawLine(borderPen1, x, y, x + width, y);
                graphics.DrawLine(borderPen2, top2x1, y + 1, top2x2, y + 1);
            }
            if (right)
            {
                var right1y1 = top ? y + 1 : y;
                var right1y2 = bottom ? y + height - 1 : y + height;
                graphics.DrawLine(borderPen2, x + width - 2, right1y1, x + width - 2, right1y2);
                graphics.DrawLine(borderPen1, x + width - 1, y, x + width - 1, y + height);
            }
            if (bottom)
            {
                var bottom1x1 = left ? x + 1 : x;
                var bottom1x2 = right ? x + width - 1 : x + width;
                graphics.DrawLine(borderPen2, bottom1x1, y + height - 2, bottom1x2, y + height - 2);
                graphics.DrawLine(borderPen1, x, y + height - 1, x + width, y + height - 1);
            }
        }
示例#44
0
 public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides)
 {
     throw null;
 }
示例#45
0
文件: Theme.cs 项目: Profit0004/mono
		public abstract void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color);
 public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style, Border3DSide sides)
 {
     if (graphics == null)
     {
         throw new ArgumentNullException("graphics");
     }
     int edge = ((int) style) & 15;
     int flags = (int) (sides | ((Border3DSide) ((int) (style & ~(Border3DStyle.Sunken | Border3DStyle.Raised)))));
     System.Windows.Forms.NativeMethods.RECT rect = System.Windows.Forms.NativeMethods.RECT.FromXYWH(x, y, width, height);
     if ((flags & 0x2000) == 0x2000)
     {
         Size size = SystemInformation.Border3DSize;
         rect.left -= size.Width;
         rect.right += size.Width;
         rect.top -= size.Height;
         rect.bottom += size.Height;
         flags &= -8193;
     }
     using (WindowsGraphics graphics2 = WindowsGraphics.FromGraphics(graphics))
     {
         System.Windows.Forms.SafeNativeMethods.DrawEdge(new HandleRef(graphics2, graphics2.DeviceContext.Hdc), ref rect, edge, flags);
     }
 }
示例#47
0
 public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style, Border3DSide sides)
 {
     throw null;
 }