当前位置: 首页>>代码示例>>C#>>正文


C# System.Drawing.Drawing2D.LinearGradientBrush.Dispose方法代码示例

本文整理汇总了C#中System.Drawing.Drawing2D.LinearGradientBrush.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# System.Drawing.Drawing2D.LinearGradientBrush.Dispose方法的具体用法?C# System.Drawing.Drawing2D.LinearGradientBrush.Dispose怎么用?C# System.Drawing.Drawing2D.LinearGradientBrush.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Drawing2D.LinearGradientBrush的用法示例。


在下文中一共展示了System.Drawing.Drawing2D.LinearGradientBrush.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawBackground

        private void DrawBackground(Graphics g)
        {
            #region Gradiente
            // Criar o retângulo para o gradiente
            Rectangle rBackground = new Rectangle(0, 0, this.Width, this.Height);

            // Craira linha
            System.Drawing.Drawing2D.LinearGradientBrush bBackground
                = new System.Drawing.Drawing2D.LinearGradientBrush(rBackground,
                    Color.FromArgb(25, 25, 150),
                    Color.FromArgb(0, 0, 255), 1);

            // Desenhar o gradiente no container
            g.FillRectangle(bBackground, rBackground);

            // descarregar
            bBackground.Dispose();
            #endregion

            #region texto,

            #region OpenPOS
            // texto
            String drawString = "OpenPOS";

            // fonte e pincel
            Font drawFont = new Font("Arial", 45);
            SolidBrush drawBrush = new SolidBrush(Color.White);

            // posicionar
            PointF drawPoint = new PointF(50, 65);

            // escrever
            g.DrawString(drawString, drawFont, drawBrush, drawPoint);
            #endregion

            #region OpenPOS
            // texto
            drawString = "The Open Point of Sale.";

            // fonte e pincel
            drawFont = new Font("Arial", 14);
            drawBrush = new SolidBrush(Color.White);

            // posicionar
            drawPoint = new PointF(60, 130);

            // escrever
            g.DrawString(drawString, drawFont, drawBrush, drawPoint);
            #endregion

            #endregion
        }
开发者ID:njmube,项目名称:openposbr,代码行数:53,代码来源:Inicial.cs

示例2: OnPaint

 protected override void OnPaint(PaintEventArgs pe)
 {
     // Calling the base class OnPaint
     base.OnPaint(pe);
     // Create two semi-transparent colors
     Color c1 = Color.FromArgb
         (m_color1Transparent, m_color1);
     Color c2 = Color.FromArgb
         (m_color2Transparent, m_color2);
     Brush b = new System.Drawing.Drawing2D.LinearGradientBrush
         (ClientRectangle, c1, c2, 10);
     pe.Graphics.FillRectangle(b, ClientRectangle);
     b.Dispose();
 }
开发者ID:krzysztofstudniarek,项目名称:WindowsFormsFunctionalTestsExample,代码行数:14,代码来源:customButton.cs

示例3: OnPaintBackground

        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            // Getting the graphics object
            Graphics g = pevent.Graphics;

            // Creating the rectangle for the gradient
            Rectangle rBackground = new Rectangle(0, 0, this.Width, this.Height);

            // Creating the lineargradient
            System.Drawing.Drawing2D.LinearGradientBrush bBackground
                = new System.Drawing.Drawing2D.LinearGradientBrush(rBackground, Gv_Data._Color1, Gv_Data._Color2, Gv_Data._ColorAngle);

            // Draw the gradient onto the form
            g.FillRectangle(bBackground, rBackground);

            // Disposing of the resources held by the brush
            bBackground.Dispose();
        }
开发者ID:BGCX262,项目名称:zyssxtice-svn-to-git,代码行数:18,代码来源:Frm_Pub2.cs

示例4: paint_Background

        /// <summary>
        /// This method fills the background of the button.
        /// </summary>
        /// <param name="e">paint arguments use to paint the button</param>
        private void paint_Background(PaintEventArgs e)
        {
            if(e == null)
                return;
            if(e.Graphics == null)
                return;

            Graphics g =e.Graphics;
            System.Drawing.Rectangle rect = new Rectangle(0,0,Size.Width,Size.Height);
            //
            // get color of background
            //
            System.Drawing.Color color = this.BackColor;;
            if(btnState == BtnState.Inactive)
                color = System.Drawing.Color.LightGray;
            //
            // intialize ColorArray and Positions Array
            //
            Color[] ColorArray     = null;
            float[] PositionArray  = null;
            //
            // initialize color array for a button that is pushed
            //
            if(btnState == BtnState.Pushed)
            {
                ColorArray = new Color[]{
                                     Blend(this.BackColor,System.Drawing.Color.White,80),
                                     Blend(this.BackColor,System.Drawing.Color.White,40),
                                     Blend(this.BackColor,System.Drawing.Color.Black,0),
                                     Blend(this.BackColor,System.Drawing.Color.Black,0),
                                     Blend(this.BackColor,System.Drawing.Color.White,40),
                                     Blend(this.BackColor,System.Drawing.Color.White,80),
                };
                PositionArray  = new float[]{0.0f,.05f,.40f,.60f,.95f,1.0f};
            }
            //
            // else, initialize color array for a button that is normal or disabled
            //
            else
            {
                ColorArray = new Color[]{
                                         Blend(color,System.Drawing.Color.White,80),
                                         Blend(color,System.Drawing.Color.White,90),
                                         Blend(color,System.Drawing.Color.White,30),
                                         Blend(color,System.Drawing.Color.White,00),
                                         Blend(color,System.Drawing.Color.Black,30),
                                         Blend(color,System.Drawing.Color.Black,20),
                };
                PositionArray  = new float[]{0.0f,.15f,.40f,.65f,.80f,1.0f};
            }
            //
            // create blend variable for the interpolate the colors
            //
            System.Drawing.Drawing2D.ColorBlend blend = new System.Drawing.Drawing2D.ColorBlend();
            blend.Colors    = ColorArray;
            blend.Positions = PositionArray;
            //
            // create vertical gradient brush
            //
            System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this.BackColor,Blend(this.BackColor,this.BackColor,10), System.Drawing.Drawing2D.LinearGradientMode.Vertical);
            brush.InterpolationColors = blend;
            //
            // fill the rectangle
            //
            g.FillRectangle(brush, rect);
            //
            // release resources
            //
            brush.Dispose();
        }
开发者ID:mahitosh,项目名称:HRA4,代码行数:74,代码来源:BitmapButton.cs

示例5: UpdatePreview

        private void UpdatePreview(PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            if(grdSlider == null || lblPreview == null) return;
            System.Drawing.Drawing2D.LinearGradientBrush br = new System.Drawing.Drawing2D.LinearGradientBrush(lblPreview.ClientRectangle, grdSlider.MinimumColor, grdSlider.MaximumColor, System.Drawing.Drawing2D.LinearGradientMode.Horizontal);
            g.FillRectangle(br, e.ClipRectangle);
            br.Dispose();

        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:9,代码来源:ColorPicker.cs

示例6: dgReturnItems_CellPainting

        void dgReturnItems_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
            if ((e.RowIndex == -1))
            {
                // fill gradient background
                Brush gradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(e.CellBounds, Color.Blue, Color.BlueViolet, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
                e.Graphics.FillRectangle(gradientBrush, e.CellBounds);
                gradientBrush.Dispose();

                // paint rest of cell
                e.Paint(e.CellBounds, DataGridViewPaintParts.Border |
                DataGridViewPaintParts.ContentForeground);
                e.Handled = true;
            }
        }
开发者ID:anthonied,项目名称:LiquidPastel,代码行数:15,代码来源:Qoute.cs

示例7: DrawIntermediateState

 internal void DrawIntermediateState(Graphics g)
 {
     if(!IsInATreeListView) return;
     if(TreeListView._updating) return;
     Debug.Assert(!TreeListView.InvokeRequired);
     if(TreeListView.CheckBoxes != CheckBoxesTypes.Recursive || TreeListView.Columns.Count == 0) return;
     if(CheckStatus == CheckState.Indeterminate)
     {
         Rectangle rect = GetBounds(ItemBoundsPortion.Icon);
         Rectangle r = TreeListView._comctl32Version >= 6 ?
             new Rectangle(rect.Left - 14, rect.Top + 5, rect.Height-10, rect.Height-10) :
             new Rectangle(rect.Left - 11, rect.Top + 5, rect.Height-10, rect.Height-10);
         Brush brush = new System.Drawing.Drawing2D.LinearGradientBrush(r, Color.Gray, Color.LightBlue, 45, false);
         if(TreeListView.Columns[0].Width > (Level + (TreeListView.ShowPlusMinus?2:1)) * SystemInformation.SmallIconSize.Width)
             g.FillRectangle(brush, r);
         brush.Dispose();
     }
 }
开发者ID:ckolumbus,项目名称:ptm,代码行数:18,代码来源:TreeListViewItem.cs

示例8: paint_InnerBorder

		/// <summary>
		/// paint the inner border of the button.
		/// </summary>
		/// <param name="e">paint arguments use to paint the button</param>
		private void paint_InnerBorder(PaintEventArgs e)
		{
			if(e == null)
				return;
			if(e.Graphics == null)
				return;

#if ENABLE_BITMAPBUTTON_PAINT_INNERBORDER
			Graphics g = e.Graphics;
			System.Drawing.Rectangle rect = new Rectangle(0,0,Size.Width,Size.Height);

			System.Drawing.Color color = this.BackColor;
			//
			// get color of inner border
			//
			switch(State)
			{
				case BtnState.Inactive:
					color = System.Drawing.Color.Gray;
					break;
				case BtnState.Normal:
					if(this.Focused)
						color = this.InnerBorderColor_Focus;
					else
						color = this.InnerBorderColor;
					break;
				case BtnState.Pushed:
					color = Blend(InnerBorderColor_Focus,System.Drawing.Color.Black,10);
					break;
				case BtnState.MouseOver:
					color = InnerBorderColor_MouseOver;
					break;
			}
			//
			// populate color and position arrays
			//
			Color[] ColorArray    = null;
			float[] PositionArray = null;
			if(State == BtnState.Pushed)
			{
				ColorArray = new System.Drawing.Color [] {
									   Blend(color,System.Drawing.Color.Black,20),
									   Blend(color,System.Drawing.Color.Black,10),
									   Blend(color,System.Drawing.Color.White,00),
									   Blend(color,System.Drawing.Color.White,50),
									   Blend(color,System.Drawing.Color.White,85),
									   Blend(color,System.Drawing.Color.White,90),
				};
				PositionArray = new float[] {0.0f,.20f,.50f,.60f,.90f,1.0f};
			}
			else
			{
				ColorArray = new System.Drawing.Color [] {
									   Blend(color,System.Drawing.Color.White,80),
									   Blend(color,System.Drawing.Color.White,60),
									   Blend(color,System.Drawing.Color.White,10),
									   Blend(color,System.Drawing.Color.White,00),
									   Blend(color,System.Drawing.Color.Black,20),
									   Blend(color,System.Drawing.Color.Black,50),
				};
				PositionArray = new float[] {0.0f,.20f,.50f,.60f,.90f,1.0f};
			}
			//
			// create blend object
			//
			System.Drawing.Drawing2D.ColorBlend blend = new System.Drawing.Drawing2D.ColorBlend();
			blend.Colors    = ColorArray;
			blend.Positions = PositionArray;
			//
			// create gradient brush and pen
			//
			System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this.BackColor,Blend(this.BackColor,this.BackColor,10), System.Drawing.Drawing2D.LinearGradientMode.Vertical);
			brush.InterpolationColors = blend;
			System.Drawing.Pen pen0 = new System.Drawing.Pen(brush,1);
			//
			// get points array to draw the line
			//
			Point[] pts = border_Get(0,0,this.Width-1,this.Height-1);
			//
			// draw line 0
			//
			this.border_Contract(1,ref pts);
			e.Graphics.DrawLines(pen0,pts);
			//
			// draw line 1
			//
			this.border_Contract(1,ref pts);
			e.Graphics.DrawLines(pen0,pts);
			//
			// release resources
			//
			pen0.Dispose();
			brush.Dispose();
#endif
		}
开发者ID:unieagle,项目名称:libpalaso,代码行数:99,代码来源:BitmapButton.cs

示例9: FillRectGradient

        public void FillRectGradient(Rectangle rect, float pct1, Color c1, Color c2, float pct2, Color c3, Color c4)
        {
            Rectangle rect1 = new Rectangle(rect.X, rect.Y, rect.Width, (int)Math.Ceiling((float)(rect.Height * pct1)));
            Rectangle rect2 = new Rectangle(rect.X, rect.Y + rect1.Height-1, rect.Width, (int)Math.Ceiling((float)(rect.Height *pct2))+1 );

            System.Drawing.Drawing2D.LinearGradientBrush tmpbrush = new System.Drawing.Drawing2D.LinearGradientBrush(rect2, c3, c4, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
            dev.graph.FillRectangle(tmpbrush, rect2);
            tmpbrush.Dispose();

             tmpbrush = new System.Drawing.Drawing2D.LinearGradientBrush(rect1, c1, c2, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
            dev.graph.FillRectangle(tmpbrush, rect1);
            tmpbrush.Dispose();
        }
开发者ID:BGog,项目名称:GHud,代码行数:13,代码来源:DisplayModule.cs

示例10: paint_ImageBorder

        /// <summary>
        /// Paints a border around the image. If Image drop shadow is enabled,
        /// a shodow is drawn too.
        /// </summary>
        /// <param name="g">The graphics object</param>
        /// <param name="ImageRect">the rectangle region of the image</param>
        private void paint_ImageBorder(System.Drawing.Graphics g, System.Drawing.Rectangle ImageRect)
        {
            System.Drawing.Rectangle rect = ImageRect;

            //
            // If ImageDropShadow = true, draw shadow
            //
            if(ImageDropShadow)
            {
                System.Drawing.Pen p0 = new System.Drawing.Pen(System.Drawing.Color.FromArgb(80,0,0,0));
                System.Drawing.Pen p1 = new System.Drawing.Pen(System.Drawing.Color.FromArgb(40,0,0,0));
                g.DrawLine(p0, new Point(rect.Right,rect.Bottom),new Point(rect.Right+1,rect.Bottom));
                g.DrawLine(p0, new Point(rect.Right+1,rect.Top+1),new Point(rect.Right+1,rect.Bottom+0));
                g.DrawLine(p1, new Point(rect.Right+2,rect.Top+2),new Point(rect.Right+2,rect.Bottom+1));
                g.DrawLine(p0, new Point(rect.Left+1,rect.Bottom+1),new Point(rect.Right+0,rect.Bottom+1));
                g.DrawLine(p1, new Point(rect.Left+1,rect.Bottom+2),new Point(rect.Right+1,rect.Bottom+2));
            }
            //
            // Draw Image Border
            //
            if(ImageBorderEnabled)
            {
                Color[] ColorArray    = null;
                float[] PositionArray = null;
                System.Drawing.Color color = this.ImageBorderColor;
                if(!this.Enabled)
                    color = System.Drawing.Color.LightGray;
                //
                // initialize color and position array
                //
                ColorArray = new Color[]{
                                            Blend(color,System.Drawing.Color.White,40),
                                            Blend(color,System.Drawing.Color.White,20),
                                            Blend(color,System.Drawing.Color.White,30),
                                            Blend(color,System.Drawing.Color.White,00),
                                            Blend(color,System.Drawing.Color.Black,30),
                                            Blend(color,System.Drawing.Color.Black,70),
                };
                PositionArray = new float[]{0.0f,.20f,.50f,.60f,.90f,1.0f};
                //
                // create blend object
                //
                System.Drawing.Drawing2D.ColorBlend blend = new System.Drawing.Drawing2D.ColorBlend();
                blend.Colors    = ColorArray;
                blend.Positions = PositionArray;
                //
                // create brush and pens
                //
                System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this.BackColor,Blend(this.BackColor,this.BackColor,10), System.Drawing.Drawing2D.LinearGradientMode.Vertical);
                brush.InterpolationColors = blend;
                System.Drawing.Pen pen0 = new System.Drawing.Pen(brush,1);
                System.Drawing.Pen pen1 = new System.Drawing.Pen(System.Drawing.Color.Black);
                //
                // calculate points to draw line
                //
                rect.Inflate(1,1);
                Point[] pts = border_Get(rect.Left,rect.Top,rect.Width,rect.Height);
                this.border_Contract(1,ref pts);
                //
                // draw line 0
                //
                g.DrawLines(pen1,pts);
                //
                // draw line 1
                //
                this.border_Contract(1,ref pts);
                g.DrawLines(pen0,pts);
                //
                // release resources
                //
                pen1.Dispose();
                pen0.Dispose();
                brush.Dispose();
            }
        }
开发者ID:neilmayhew,项目名称:libpalaso,代码行数:81,代码来源:BitmapButton.cs

示例11: OnPaintBackground

 protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)
 {
     if (this.DesignMode)
     {
         System.Drawing.Drawing2D.LinearGradientBrush backBrush = new System.Drawing.Drawing2D.LinearGradientBrush(this.Bounds, SystemColors.ControlLightLight, SystemColors.ControlLight, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
         pevent.Graphics.FillRectangle(backBrush, this.Bounds);
         backBrush.Dispose();
     }
     else
     {
         this.PaintTransparentBackground(pevent.Graphics, this.ClientRectangle);
     }
 }
开发者ID:okyereadugyamfi,项目名称:softlogik,代码行数:13,代码来源:SPTabControl.cs

示例12: DrawRoomView

		/// <summary>
		/// Draws the room view
		/// </summary>
		/// <param name="g">The graphics used to draw the room view</param>
		/// <param name="imgRect">The rectangle the image will occupy on the display</param>
		private void DrawRoomView( Graphics g, Rectangle imgRect )
		{
			Point bottom = Point.Empty;
			Point top = Point.Empty;
			Point left = Point.Empty;
			Point right = Point.Empty;

			bottom.X = imgRect.X + ( imgRect.Width / 2 );
			bottom.Y = imgRect.Bottom;

			top.X = bottom.X;
			top.Y = bottom.Y - imgRect.Width;

			left.X = imgRect.X;
			left.Y = imgRect.Bottom - ( imgRect.Width / 2 );

			right.X = imgRect.Right;
			right.Y = left.Y;

			// top points
			Point top1 = Point.Empty;
			Point top2 = Point.Empty;
			Point top3 = Point.Empty;

			top1.Y = top2.Y = top3.Y = 0;
			top1.X = left.X;
			top2.X = top.X;
			top3.X = right.X;

			Pen blackPen = new Pen( Color.Black );
			Brush whiteBrush = new System.Drawing.Drawing2D.LinearGradientBrush( top, right, Color.DarkSlateBlue, Color.SkyBlue );

			// Draw base block
			Point[] baseBlock = new Point[] { top, right, bottom, left, top };
			g.FillPolygon( whiteBrush, baseBlock );

			// Fill
			Point[] leftArea = new Point[] { left, top1, top2, top, left };
			Point[] rightArea = new Point[] { top, top2, top3, right, top };

			Brush darkBrush = new System.Drawing.Drawing2D.LinearGradientBrush( left, top1, Color.MidnightBlue, Color.LightGray);
			Brush lightBrush = new System.Drawing.Drawing2D.LinearGradientBrush( right, top3, Color.SteelBlue, Color.White );

			g.FillPolygon( darkBrush, leftArea );
			g.FillPolygon( lightBrush, rightArea );

			// Draw base
			g.DrawLines( blackPen, baseBlock );

			// Draw vertical lines
			g.DrawLine( blackPen, left, top1 );
			g.DrawLine( blackPen, top, top2 );
			g.DrawLine( blackPen, right, top3 );

			// Draw top line
			g.DrawLine( blackPen, top1, top3 );

			// Draw axes
			g.DrawLine( blackPen, right, GetIntersection( bottom, right ) );
			g.DrawLine( blackPen, right, GetIntersection( top, right ) );
			g.DrawLine( blackPen, left, GetIntersection( bottom, left ) );
			g.DrawLine( blackPen, left, GetIntersection( top, left ) );

			blackPen.Dispose();
			whiteBrush.Dispose();
			darkBrush.Dispose();
			lightBrush.Dispose();
		}
开发者ID:aj9251,项目名称:pandorasbox3,代码行数:73,代码来源:ArtViewer.cs

示例13: OnPaint

 //////////////////////////////////////////////////////////////////
 //
 // Function: protected override void OnPaint( PaintEventArgs pe )
 //
 // By: Doug
 //
 // Date: 2/27/03
 //
 // Description: Paint the DougScrollingTextCtrl.
 //
 ////////////////////////////////////////////////////////////////
 //
 protected override void OnPaint(PaintEventArgs pe)
 {
     // This is a fancy brush that draws graded colors.
     Brush MyBrush =
         new System.Drawing.Drawing2D.LinearGradientBrush(
           ClientRectangle, m_Color1, m_Color2, 10);
     // Get the font and use it to draw text in the control.
     // Resize to the height of the control if possible.
     m_MyFont = new Font(Font.Name, (Height * 3) / 4,
         Font.Style, GraphicsUnit.Pixel);
     // Draw the text string in the control.
     pe.Graphics.DrawString(sScrollText, m_MyFont, MyBrush, 0, 0);
     base.OnPaint(pe);
     // Clean up variables..
     MyBrush.Dispose();
     m_MyFont.Dispose();
 }
开发者ID:darinkes,项目名称:MusicDrucker,代码行数:29,代码来源:DougScrollingTextCtrl.cs

示例14: OnDrawItem

        /// <summary>
        /// Controls the drawing of each item.  Overridding this places you directly at the stage where
        /// the backbuffer is being drawn to and e.ClipRectangle is the item bounds.
        /// </summary>
        /// <param name="item">The Icolorbreak to draw</param>
        /// <param name="e">A PaintEventArgs with the Graphics surface and the ClipRectangle</param>
        protected virtual void OnDrawItem(IColorCategory item, PaintEventArgs e)
        {

            Rectangle box;
            string text;
            Brush brush;

            // Draw background
            if (item.IsSelected)
            {
                Rectangle selection = e.ClipRectangle;
                //selection.Y = e.ClipRectangle.Top + _itemSpacing;
                //selection.Height = _itemHeight;
                e.Graphics.FillRectangle(_highlightBrush, e.ClipRectangle);
                brush = _highlightTextBrush;
            }
            else
            {
                if (_contentStyle == ColorPanelStyle.Values && _layerType == LayerTypes.Raster)
                {
                    
                    e.Graphics.FillRectangle(_errorBrush, e.ClipRectangle);
                    
                }
                brush = _foreBrush;
            }


            // Establish bounds
            int left = Padding.Left;
            box = new Rectangle(e.ClipRectangle.Left + left, e.ClipRectangle.Top + _itemSpacing, e.ClipRectangle.Width - left - Padding.Right, ItemHeight - _itemSpacing * 2);


            if (_contentStyle == ColorPanelStyle.Colors)
            {
                brush = new System.Drawing.Drawing2D.LinearGradientBrush(box, item.LowColor, item.HighColor, System.Drawing.Drawing2D.LinearGradientMode.Horizontal);
                e.Graphics.FillRectangle(brush, box);
                brush.Dispose(); // this was newly created, so dispose it
                e.Graphics.DrawRectangle(Pens.Black, box);
                return;
            }



            else if (_contentStyle == ColorPanelStyle.Captions)
            {

                text = item.LegendText;
            }
            else
            {
                text = item.ToString();
            }


            if (_horizontalAlignment == HorizontalAlignment.Left)
            {

                e.Graphics.DrawString(text, Font, brush, box);
            }
            else if (_horizontalAlignment == HorizontalAlignment.Right)
            {
                // clip the visible region so we don't mess up padding
                e.Graphics.SetClip(box);
                int right = box.Right;
                SizeF measure = e.Graphics.MeasureString(text, Font);
                left = right - Convert.ToInt32(measure.Width);
                Rectangle extendedBox = new Rectangle(left, box.Top, right - left, box.Height);
                e.Graphics.DrawString(text, Font, brush, extendedBox);
                e.Graphics.ResetClip();

            }
            else if (_horizontalAlignment == HorizontalAlignment.Center)
            {
                // clip the visible region so we don't mess up padding
                e.Graphics.SetClip(box);
                int mid = box.Left + box.Width / 2;
                int right = box.Right;
                SizeF measure = e.Graphics.MeasureString(text, Font);
                left = mid - Convert.ToInt32(measure.Width)/2;
                Rectangle extendedBox = new Rectangle(left, box.Top, right - left, box.Height);
                e.Graphics.DrawString(text, Font, brush, extendedBox);
                e.Graphics.ResetClip();

            }







        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:99,代码来源:ColorBreakPanel.cs

示例15: DrawKnob

 private void DrawKnob(Graphics g, Point location)
 {
     if (_knobVisible == false) return;
     Color light = Lighten(_knobColor, 50);
     Color dark = Darken(_knobColor, 50);
     Rectangle r = new Rectangle(location.X - _knobRadius, location.Y - _knobRadius, _knobRadius * 2, _knobRadius * 2);
     Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(r, light, dark, 315f);
     g.FillEllipse(b, r);
     b.Dispose();
 }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:10,代码来源:AnglePicker.cs


注:本文中的System.Drawing.Drawing2D.LinearGradientBrush.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。