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


C# Design.PaintValueEventArgs类代码示例

本文整理汇总了C#中System.Drawing.Design.PaintValueEventArgs的典型用法代码示例。如果您正苦于以下问题:C# PaintValueEventArgs类的具体用法?C# PaintValueEventArgs怎么用?C# PaintValueEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: PaintValue

		public override void PaintValue(PaintValueEventArgs e)
		{
			try
			{
				if(e==null || e.Value==null)
					return;
				int iIndex=(int)e.Value;
				System.Drawing.Image img=this.GetImage(e.Context,iIndex);
				if(img==null)
					return;
				PaintValueEventArgs pi=new PaintValueEventArgs(e.Context,img,e.Graphics,e.Bounds);
                if (img != null)
                {
                    Rectangle r = e.Bounds;
                    r.Width--;
                    r.Height--;
                    e.Graphics.DrawRectangle(SystemPens.WindowFrame, r);
                    e.Graphics.DrawImage(img, e.Bounds);
                }

				//m_ImageEditor.PaintValue(pi);
				//m_ImageEditor.PaintValue(img,e.Graphics,e.Bounds);
			}
			catch{}
		}
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:25,代码来源:ComboItemsEditor.cs

示例2: PaintValue

        public override void PaintValue(PaintValueEventArgs e)
        {
            if (e.Value is Color && ((Color)e.Value).A <= byte.MaxValue)
            {
                Color xnacolor = (Color)e.Value;
                System.Drawing.Color syscolor = System.Drawing.Color.FromArgb(xnacolor.A, xnacolor.R, xnacolor.G, xnacolor.B);

                int oneThird = e.Bounds.Width / 3;
                using (System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(System.Drawing.Color.DarkGray))
                {
                    e.Graphics.FillRectangle(brush, new System.Drawing.Rectangle(e.Bounds.X + 1, e.Bounds.Y + 1, 4, 4));
                    e.Graphics.FillRectangle(brush, new System.Drawing.Rectangle(e.Bounds.X + 9, e.Bounds.Y + 1, 4, 4));
                    e.Graphics.FillRectangle(brush, new System.Drawing.Rectangle(e.Bounds.X + 17, e.Bounds.Y + 1, 2, 4));

                    e.Graphics.FillRectangle(brush, new System.Drawing.Rectangle(e.Bounds.X + 5, e.Bounds.Y + 5, 4, 4));
                    e.Graphics.FillRectangle(brush, new System.Drawing.Rectangle(e.Bounds.X + 13, e.Bounds.Y + 5, 4, 4));

                    e.Graphics.FillRectangle(brush, new System.Drawing.Rectangle(e.Bounds.X + 1, e.Bounds.Y + 9, 4, 3));
                    e.Graphics.FillRectangle(brush, new System.Drawing.Rectangle(e.Bounds.X + 9, e.Bounds.Y + 9, 4, 3));
                    e.Graphics.FillRectangle(brush, new System.Drawing.Rectangle(e.Bounds.X + 17, e.Bounds.Y + 9, 2, 3));

                }
                using (System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(syscolor))
                {
                    e.Graphics.FillRectangle(brush, new System.Drawing.Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height - 1));
                }
            }

            if (e.Value is System.Drawing.Color)
            {
                base.PaintValue(e);
            }
        }
开发者ID:ade,项目名称:barrelbomber-leveleditor,代码行数:33,代码来源:XNAColorUITypeEditors.cs

示例3: PaintValue

        /// <summary>
        /// Paints a representation of the value of an object using the specified <see cref="T:System.Drawing.Design.PaintValueEventArgs"/>.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Drawing.Design.PaintValueEventArgs"/> that indicates what to paint and where to paint it.</param>
        public override void PaintValue(PaintValueEventArgs e)
        {
            Brush backgroundBrush = new SolidBrush(Color.FromArgb((int)((float)e.Value * 255f), Color.White));

            e.Graphics.FillRectangle(Brushes.Black, e.Bounds);
            e.Graphics.FillRectangle(backgroundBrush, e.Bounds);
        }
开发者ID:Andrea,项目名称:MercuryParticleEngine,代码行数:11,代码来源:PercentEditor.cs

示例4: PaintValue

        public override void PaintValue(PaintValueEventArgs e)
        {
            var inheritableColor = (InheritableColor)e.Value;

            using (var brush = new SolidBrush(inheritableColor.Value))
                e.Graphics.FillRectangle(brush, e.Bounds);
        }
开发者ID:netgrim,项目名称:MapKit,代码行数:7,代码来源:Truc.cs

示例5: PaintValue

      public override void PaintValue(PaintValueEventArgs pe)
      {
         Image image = null;
         int imageIndex = 0;

         if (!int.TryParse(pe.Value.ToString(), out imageIndex))
            return;

         ImageList imageList = null;

         PropertyDescriptorCollection PropertyCollection
                           = TypeDescriptor.GetProperties(instance);

         PropertyDescriptor property;
         if ((property = PropertyCollection.Find("LargeImages", false)) != null)
            imageList = (ImageList)property.GetValue(instance);

         if ((imageList != null) && (imageList.Images.Count > imageIndex) && (imageIndex >= 0)) 
         {
            image = imageList.Images[imageIndex];
         }

         if (imageIndex < 0 || image == null)
         {
            pe.Graphics.DrawLine(Pens.Black, pe.Bounds.X + 1, pe.Bounds.Y + 1,
               pe.Bounds.Right - 1, pe.Bounds.Bottom - 1);
            pe.Graphics.DrawLine(Pens.Black, pe.Bounds.Right - 1, pe.Bounds.Y + 1,
               pe.Bounds.X + 1, pe.Bounds.Bottom - 1);
         }
         else
         {
            pe.Graphics.DrawImage(image, pe.Bounds);
         }
      }
开发者ID:iraychen,项目名称:Guifreaks-Navisuite,代码行数:34,代码来源:LargeImageIndexEditor.cs

示例6: PaintValue

        /// <summary>
        /// Draw a preview of the <see cref="ColorPair"/>
        /// </summary>
        /// <param name="e">The paint event args providing the <see cref="Graphics"/> and bounding
        /// rectangle</param>
        public override void PaintValue(PaintValueEventArgs e)
        {
            ColorPair colorPair = (ColorPair)e.Value ;

            using ( SolidBrush b = new SolidBrush(colorPair.Background)) {
                e.Graphics.FillRectangle(b, e.Bounds);
            }

            // Draw the text "ab" using the Foreground/Background values from the ColorPair
            using(SolidBrush b = new SolidBrush(colorPair.Foreground)) {
                using(Font f = new Font("Arial",6)) {
                    RectangleF temp = new RectangleF(e.Bounds.Left,e.Bounds.Top,e.Bounds.Height,e.Bounds.Width) ;
                    temp.Inflate(-2,-2) ;

                    // Set up how we want the text drawn
                    StringFormat format = new StringFormat(StringFormatFlags.FitBlackBox | StringFormatFlags.NoWrap) ;
                    format.Trimming = StringTrimming.EllipsisCharacter ;
                    format.Alignment = StringAlignment.Center ;
                    format.LineAlignment = StringAlignment.Center ;

                    // save the Smoothing mode of the Graphics object so we can restore it
                    SmoothingMode saveMode = e.Graphics.SmoothingMode ;
                    e.Graphics.SmoothingMode = SmoothingMode.AntiAlias ;
                    e.Graphics.DrawString("ab",f,b,temp,format) ;
                    e.Graphics.SmoothingMode = saveMode ;
                }
            }
        }
开发者ID:svn2github,项目名称:fiddler-plus,代码行数:33,代码来源:ColorEditors.cs

示例7: PaintValue

		public override void PaintValue(PaintValueEventArgs e)
		{
			WebControl control = e.Context.Instance as WebControl;

			// Fills the left rectangle with a color.
			e.Graphics.FillRegion(new SolidBrush(control.BackColor), new Region(e.Bounds));
		}
开发者ID:Helen1987,项目名称:edu,代码行数:7,代码来源:ColorTypeEditor.cs

示例8: PaintValue

 public override void PaintValue(PaintValueEventArgs e)
 {
     if (e.Value is string && !string.IsNullOrEmpty((string)e.Value))
     {
         e.Graphics.DrawImage(global::Seal.Properties.Resources.error, 3, 0, 16, 16);
     }
 }
开发者ID:cnark,项目名称:Seal-Report,代码行数:7,代码来源:InformationErrorUITypeEditor.cs

示例9: PaintValue

        public override void PaintValue(PaintValueEventArgs e)
        {
            var ts = (TextStyle) e.Value;
            using (var b = new SolidBrush(ts.BackColor))
            {
                e.Graphics.FillRectangle(b, e.Bounds);
            }

            FontStyle fs = FontStyle.Regular;
            if (ts.Bold)
                fs |= FontStyle.Bold;
            if (ts.Italic)
                fs |= FontStyle.Italic;
            if (ts.Underline)
                fs |= FontStyle.Underline;

            var f = new Font("arial", 8f, fs);

            using (var b = new SolidBrush(ts.ForeColor))
            {
                e.Graphics.DrawString("abc", f, b, e.Bounds);
            }

            f.Dispose();
        }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:25,代码来源:TextStyleUIEditor.cs

示例10: PaintValue

		/// <summary>
		/// Draw a preview of the <see cref="GradientColor"/>
		/// </summary>
		/// <param name="e">The paint event args providing the <see cref="Graphics"/> and bounding
		/// rectangle</param>
		public override void PaintValue(PaintValueEventArgs e) {
			GradientColor gradientColor = (GradientColor)e.Value ;
			using ( LinearGradientBrush b = gradientColor.GetBrush(e.Bounds,LinearGradientMode.Horizontal)) 
			{
				e.Graphics.FillRectangle(b, e.Bounds);
			}
		}
开发者ID:corefan,项目名称:ProfileSharp,代码行数:12,代码来源:ColorEditors.cs

示例11: PaintValue

        public override void PaintValue(PaintValueEventArgs e)
        {
            if (!(e.Context.Instance is KrbTabControl)) return;
            var parent = (KrbTabControl)e.Context.Instance;
            var caption = (ButtonsCaption)e.Value;

            using (var brush = new LinearGradientBrush(e.Bounds, parent.GradientCaption.InactiveCaptionColorStart, parent.GradientCaption.InactiveCaptionColorEnd, parent.GradientCaption.CaptionGradientStyle))
            {
                var bl = new Blend(2) { Factors = new[] { 0.1F, 1.0F }, Positions = new[] { 0.0F, 1.0F } };
                brush.Blend = bl;
                e.Graphics.FillRectangle(brush, e.Bounds);

                Image captionDropDown = Resources.DropDown;
                using (var attributes = new ImageAttributes())
                {
                    var map = new[]
                    {
                        new ColorMap {OldColor = Color.White, NewColor = Color.Transparent},
                        new ColorMap {OldColor = Color.Black, NewColor = caption.InactiveCaptionButtonsColor}
                    };

                    attributes.SetRemapTable(map);

                    var rect = e.Bounds;
                    rect.Inflate(-3, 0);
                    e.Graphics.DrawImage(captionDropDown, rect, 0, 0, captionDropDown.Width, captionDropDown.Height, GraphicsUnit.Pixel, attributes);
                }
            }
        }
开发者ID:KelvinCoding,项目名称:masterwork-dwarf-fortress,代码行数:29,代码来源:ButtonsCaptionEditor.cs

示例12: PaintValue

        /// <summary>
        /// Paints a representation of the value of an object using the specified <see cref="T:System.Drawing.Design.PaintValueEventArgs"/>.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Drawing.Design.PaintValueEventArgs"/> that indicates what to paint and where to paint it.</param>
        public override void PaintValue(PaintValueEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBilinear;

            Point center = new Point
            {
                X = e.Bounds.Width / 2,
                Y = e.Bounds.Height / 2
            };

            var backgroundBrush = Brushes.SteelBlue;
            var circleBrush = Brushes.White;
            var centerBrush = Brushes.Black;
            var anglePen = new Pen(Brushes.Red, 1f);

            // Fill background and ellipse and center point...
            e.Graphics.FillRectangle(backgroundBrush, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
            e.Graphics.FillEllipse(circleBrush, e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 3, e.Bounds.Height - 3);
            e.Graphics.FillEllipse(centerBrush, center.X + e.Bounds.X - 1, center.Y + e.Bounds.Y - 1, 3, 3);

            // Draw line along the current Angle...
            float radians = (float)e.Value;

            e.Graphics.DrawLine(anglePen, center.X + e.Bounds.X, center.Y + e.Bounds.Y,
                e.Bounds.X + (center.X + (int)((float)center.X * Calculator.Cos(radians))),
                e.Bounds.Y + (center.Y + (int)((float)center.Y * Calculator.Sin(radians))));
        }
开发者ID:Andrea,项目名称:MercuryParticleEngine,代码行数:32,代码来源:AngleEditor.cs

示例13: PaintValue

        public override void PaintValue(PaintValueEventArgs e)
        {
            var val = (bool?) e.Value;

            ControlPaint.DrawCheckBox(e.Graphics, e.Bounds,
                (val ?? false) ? ButtonState.Checked : ButtonState.Normal);
        }
开发者ID:johnmensen,项目名称:TradeSharp,代码行数:7,代码来源:CheckBoxPropertyGridEditor.cs

示例14: PaintValue

 public override void PaintValue(PaintValueEventArgs e)
 {
     Graphics g = e.Graphics;
     GradientInfo gradient = (GradientInfo)e.Value;
     gradient.Draw(g, e.Bounds);
     g.DrawRectangleProper(Pens.Black, e.Bounds);
 }
开发者ID:Maximus325,项目名称:ShareX,代码行数:7,代码来源:GradientEditor.cs

示例15: PaintValue

 public override void PaintValue(PaintValueEventArgs e)
 {
     Hatcher hatch = e.Value as Hatcher;
     using (HatchBrush brush = new HatchBrush(hatch.HatchType, hatch.ForeColor, hatch.BackColor))
     {
         e.Graphics.FillRectangle(brush, e.Bounds);
     }
 }
开发者ID:KelvinCoding,项目名称:masterwork-dwarf-fortress,代码行数:8,代码来源:HatcherEditor.cs


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