/// <summary>
 ///     Paint a representation of the simple filler (usually in designer).
 /// </summary>
 /// <param name="e">A <c>PaintValueEventArgs</c> that indicates what to paint and where to paint it.</param>
 public override void PaintValue(PaintValueEventArgs e)
 {
     if (e.Value is BrushPainter)
     {
         System.Drawing.Brush br = ((BrushPainter)e.Value).GetUITypeEditorBrush(e.Bounds);
         if (br != null)
         {
             e.Graphics.FillRectangle(br, e.Bounds /*r*/);
         }
     }
 }
 public override void PaintValue(
     PaintValueEventArgs e)
 {
     if (e.Value is Color)
     {
         var color = (Color)e.Value;
         var brush = new SolidBrush(color);
         e.Graphics.FillRectangle(brush, e.Bounds);
         brush.Dispose();
     }
 }
            ///<summary>
            ///Paints a representation of the value of an object using the specified <see cref="T:System.Drawing.Design.PaintValueEventArgs"></see>.
            ///</summary>
            ///
            ///<param name="e">A <see cref="T:System.Drawing.Design.PaintValueEventArgs"></see> that indicates what to paint and where to paint it. </param>
            public override void PaintValue(PaintValueEventArgs e)
            {
                base.PaintValue(e);
                ColorPair pair = e.Value as ColorPair;

                if (pair != null)
                {
                    LinearGradientBrush br = new LinearGradientBrush(e.Bounds, pair.BackColor1, pair.BackColor2, pair.Gradient);
                    e.Graphics.FillRectangle(br, e.Bounds);
                }
            }
Exemplo n.º 4
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            bool   flag;
            string str = e.Value as string;

            if ((flag = ((FolderImage != null) && !SharedUtil.IsEmpty(str)) && Directory.Exists(str)) || (NoFolderImage != null))
            {
                e.Graphics.DrawImage(flag ? FolderImage : NoFolderImage, new Rectangle(1, 2, e.Bounds.Width - 2, e.Bounds.Height - 2));
            }
            base.PaintValue(e);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Performs custom actions on PaintValue events. Paints a representative value of the given object to the provided canvas</summary>
        /// <param name="e">PaintValueEventArgs indicating what to paint and where to paint it</param>
        public override void PaintValue(PaintValueEventArgs e)
        {
            TypeConverter converter = e.Context.PropertyDescriptor.Converter;
            object        value     = converter.ConvertTo(e.Value, typeof(Color)); // convert from underlying type to Color

            if (value != null && value is Color)
            {
                Color color = (Color)value;
                base.PaintValue(new PaintValueEventArgs(e.Context, color, e.Graphics, e.Bounds));
            }
        }
Exemplo n.º 6
0
        public void ImageEditor_PaintValue_InvalidArgsValue_Nop(object value)
        {
            var editor = new ImageEditor();

            using (var image = new Bitmap(10, 10))
                using (Graphics graphics = Graphics.FromImage(image))
                {
                    var e = new PaintValueEventArgs(null, value, graphics, new Rectangle(1, 2, 3, 4));
                    editor.PaintValue(e);
                }
        }
Exemplo n.º 7
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            e.Graphics.FillRectangle(Brushes.White, e.Bounds);

            bool isend = e.Context.PropertyDescriptor.Name == "EndCap";
            Pen  pen   = new Pen(Color.Black, 2);

            pen.DashStyle = (DashStyle)e.Value;
            Point pt = PaintHelper.CenterPoint(e.Bounds);

            e.Graphics.DrawLine(pen, e.Bounds.Left + 2, pt.Y, e.Bounds.Right - 2, pt.Y);
        }
        public override void PaintValue(PaintValueEventArgs e)
        {
            var p = e.Value as GradientBrush;

            if (p == null)
            {
                return;
            }

            using (var br = p.GetBrush(e.Bounds))
                e.Graphics.FillRectangle(br, e.Bounds);
        }
Exemplo n.º 9
0
        /// <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)
        {
            base.PaintValue(e);

            Color color = e.Value is GorgonColor ? (Color)(GorgonColor)e.Value : (Color)e.Value;

            e.Graphics.DrawImage(APIResources.PropertyChecker, e.Bounds);
            using (Brush brush = new SolidBrush(color))
            {
                e.Graphics.FillRectangle(brush, e.Bounds);
            }
        }
Exemplo n.º 10
0
            public override void PaintValue(PaintValueEventArgs e)
            {
                if (e.Value == null)
                {
                    return;
                }

                SolidBrush solidBrush = new SolidBrush(((Plot)e.Value).Pen.Color);

                e.Graphics.FillRectangle((Brush)solidBrush, e.Bounds);
                solidBrush.Dispose();
            }
Exemplo n.º 11
0
 public override void PaintValue(PaintValueEventArgs e)
 {
     if (e.Value is Microsoft.Xna.Framework.Color)
     {
         var xnaColor = (Microsoft.Xna.Framework.Color)e.Value;
         base.PaintValue(new PaintValueEventArgs(e.Context, System.Drawing.Color.FromArgb(xnaColor.A, xnaColor.R, xnaColor.G, xnaColor.B), e.Graphics, e.Bounds));
     }
     else
     {
         base.PaintValue(e);
     }
 }
Exemplo n.º 12
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            if (e.Value == null)
            {
                return;
            }

            SolidBrush brush = new SolidBrush((Color)e.Value);
            Rectangle  rect  = new Rectangle(1, 1, 19, 17);

            e.Graphics.FillRectangle(brush, rect);
        }
Exemplo n.º 13
0
 /// <summary>
 ///     Paint a representation of the line (usually in designer).
 /// </summary>
 /// <param name="e">A <c>PaintValueEventArgs</c> that indicates what to paint and where to paint it.</param>
 public override void PaintValue(PaintValueEventArgs e)
 {
     if (e.Value is PenPainter)
     {
         int y   = e.Bounds.Height / 2;
         Pen pen = ((PenPainter)e.Value).GetPen();
         if (pen != null)
         {
             e.Graphics.DrawLine(pen, e.Bounds.X, y, e.Bounds.X + e.Bounds.Width - 1, y);
         }
     }
 }
Exemplo n.º 14
0
        public void PaintValueEventArgs_Ctor_ITypeDescriptorContext_Object_Graphics_Rectangle(ITypeDescriptorContext context, object value, Rectangle bounds)
        {
            using var image         = new Bitmap(10, 10);
            using Graphics graphics = Graphics.FromImage(image);

            var e = new PaintValueEventArgs(context, value, graphics, bounds);

            Assert.Same(context, e.Context);
            Assert.Same(value, e.Value);
            Assert.Same(graphics, e.Graphics);
            Assert.Equal(bounds, e.Bounds);
        }
Exemplo n.º 15
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            string path = ObjectHelper.GetImageRoot() + e.Value;

            if (File.Exists(path))
            {
                Bitmap    image  = (Bitmap)Image.FromFile(path);
                Rectangle bounds = e.Bounds;
                bounds.Inflate(-1, -1);
                e.Graphics.DrawImage(image, bounds, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
            }
            base.PaintValue(e);
        }
 public override void PaintValue(PaintValueEventArgs e)
 {
     if (e != null)
     {
         IComponentID c = e.Value as IComponentID;
         if (c != null)
         {
             e.Graphics.DrawString(c.ComponentName, _font, Brushes.Black, (float)2, (float)2);
             return;
         }
     }
     base.PaintValue(e);
 }
Exemplo n.º 17
0
 public override void PaintValue(PaintValueEventArgs e)
 {
     if (e.Context != null && e.Context.Instance != null)
     {
         MathematicExpression me = e.Context.Instance as MathematicExpression;
         if (me != null)
         {
             Image img = me.CreateMathExpressionImage(e.Graphics);
             e.Graphics.DrawImage(img, e.Bounds);
             e.Graphics.DrawString(me.ToString(), new Font("Times New Roman", 8), Brushes.Black, new PointF(32, 0));
         }
     }
 }
Exemplo n.º 18
0
		/// <override></override>
		public override void PaintValue(PaintValueEventArgs e) {
			if (e != null && e.Value != null) {
				if (formatter.Alignment != StringAlignment.Center) formatter.Alignment = StringAlignment.Center;
				if (formatter.LineAlignment != StringAlignment.Near) formatter.LineAlignment = StringAlignment.Near;

				GdiHelpers.ApplyGraphicsSettings(e.Graphics, RenderingQuality.HighQuality);
				using (Font font = new Font(e.Value.ToString(), e.Bounds.Height, FontStyle.Regular, GraphicsUnit.Pixel))
					e.Graphics.DrawString(e.Value.ToString(), font, Brushes.Black, (RectangleF)e.Bounds, formatter);
				GdiHelpers.ApplyGraphicsSettings(e.Graphics, RenderingQuality.DefaultQuality);
				
				base.PaintValue(e);
			}
		}
Exemplo n.º 19
0
 public override void PaintValue(PaintValueEventArgs e)
 {
     if ((e.Value as DirectoryInfo).Exists)
     {
         e.Graphics.DrawImage(Properties.Resources.Folder.ToBitmap(),
                              e.Bounds);
     }
     else
     {
         e.Graphics.DrawImage(Properties.Resources.FolderBad.ToBitmap(),
                              e.Bounds);
     }
 }
Exemplo n.º 20
0
        /// <summary>
        ///     Paint a representation of the simple filler (usually in designer).
        /// </summary>
        /// <param name="e">A <c>PaintValueEventArgs</c> that indicates what to paint and where to paint it.</param>
        public override void PaintValue(PaintValueEventArgs e)
        {
            //e.Graphics.FillRectangle(new SolidBrush(Color.Blue), e.Bounds /*r*/);

            ////if (e.Value is Filler)
            ////{
            ////    Brush br = ((Filler)e.Value).GetUITypeEditorBrush(e.Bounds);
            ////    if (br != null)
            ////    {
            ////        e.Graphics.FillRectangle(br, e.Bounds /*r*/);
            ////    }
            ////}
        }
Exemplo n.º 21
0
        /// <summary>
        /// Draw a representation of our value
        /// </summary>
        public override void PaintValue(PaintValueEventArgs e)
        {
            IBrushData bd = e.Value as IBrushData;

            if (bd == null)
            {
                base.PaintValue(e);
            }
            else
            {
                e.Graphics.FillRectangle(BlockFormat.PrepareBrushForDrawing(bd.GetBrush(), e.Bounds), e.Bounds);
            }
        }
Exemplo n.º 22
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            byte val = (byte)e.Value;

            if (LevelData.ObjTypes.ContainsKey(val))
            {
                e.Graphics.DrawImage(LevelData.ObjTypes[val].Image.Image.ToBitmap(LevelData.BmpPal).Resize(e.Bounds.Size), e.Bounds);
            }
            else
            {
                e.Graphics.DrawImage(LevelData.UnknownImg.Resize(e.Bounds.Size), e.Bounds);
            }
        }
Exemplo n.º 23
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            ObjectPen op      = (ObjectPen)e.Value;
            Rectangle R       = e.Bounds;
            Region    OldClip = e.Graphics.Clip;

            e.Graphics.SetClip(R);
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            e.Graphics.DrawLine(op.GetPen(), e.Bounds.X, e.Bounds.Y, e.Bounds.Right - 1, e.Bounds.Bottom - 1);
            e.Graphics.SmoothingMode = SmoothingMode.Default;
            e.Graphics.Clip          = OldClip;
            base.PaintValue(e);
        }
Exemplo n.º 24
0
 public override void PaintValue(PaintValueEventArgs e)
 {
     e.Graphics.FillRectangle(Brushes.White, e.Bounds);
     if (e.Value is MindMapLayoutType)
     {
         MindMapLayoutType lt    = (MindMapLayoutType)e.Value;
         Image             image = GetIcon(lt);
         if (image != null)
         {
             PaintHelper.DrawImageInRange(e.Graphics, image, e.Bounds);
         }
     }
 }
Exemplo n.º 25
0
        public override void PaintIcon(PaintValueEventArgs e, Rectangle r)
        {
            MapProperties mep    = (MapProperties)e.Context.Instance;
            byte          sprite = (byte)(0x81 + ((int)e.Value * 4));

            if (shop)
            {
                sprite += (8 * 4);
            }
            Bitmap b = mep.me.make_icon(sprite, 1, true, 1);

            e.Graphics.DrawImage(b, r);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 绘制数据
        /// </summary>
        /// <param name="e">参数</param>
        public override void PaintValue(PaintValueEventArgs e)
        {
            XColorValue color = e.Value as XColorValue;

            if (color == null)
            {
                color = new XColorValue();
            }
            using (SolidBrush b = new SolidBrush(color.Value))
            {
                e.Graphics.FillRectangle(b, e.Bounds);
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Paints a representation of the value of an object using the specified PaintValueEventArgs.
        /// </summary>
        /// <param name="pe">A PaintValueEventArgs that indicates what to paint and where to paint it.</param>
        public override void PaintValue(PaintValueEventArgs pe)
        {
            if (!(pe.Value is int))
            {
                return;
            }
            Image img = GetImage(pe.Context, (int)pe.Value);

            if (img != null)
            {
                pe.Graphics.DrawImage(img, pe.Bounds);
            }
        }
Exemplo n.º 28
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            Image image = e.Value as Image;

            if (image != null)
            {
                Rectangle bounds = e.Bounds;
                bounds.Width--;
                bounds.Height--;
                e.Graphics.DrawRectangle(SystemPens.WindowFrame, bounds);
                e.Graphics.DrawImage(image, e.Bounds);
            }
        }
Exemplo n.º 29
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            string s = FormulaHelper.ImageRoot + e.Value;

            if (File.Exists(s))
            {
                Bitmap    B = (Bitmap)Bitmap.FromFile(s);
                Rectangle R = e.Bounds;
                R.Inflate(-1, -1);
                e.Graphics.DrawImage(B, R, 0, 0, B.Width, B.Height, GraphicsUnit.Pixel);
            }
            base.PaintValue(e);
        }
Exemplo n.º 30
0
 public override void PaintValue(PaintValueEventArgs e)
 {
     if (e.Value is UvColor)
     {
         var overrideValue     = GdiColorFromUvColor((UvColor)e.Value);
         var overrideEventData = new PaintValueEventArgs(e.Context, overrideValue, e.Graphics, e.Bounds);
         base.PaintValue(overrideEventData);
     }
     else
     {
         base.PaintValue(e);
     }
 }
Exemplo n.º 31
0
 //塗りつぶし
 public override void PaintValue(PaintValueEventArgs e)
 {
     if (e.Value == null) return;
     Color color = ColorTranslator.FromHtml(e.Value.ToString());
     e.Graphics.FillRectangle(new SolidBrush(color), e.Bounds);
 }
Exemplo n.º 32
0
            public override void PaintValue(PaintValueEventArgs e)
            {

                ControlPaint.DrawCheckBox(e.Graphics, e.Bounds, ((Customer)e.Context.Instance).Cb ? ButtonState.Checked : ButtonState.Normal);

            }
	public virtual void PaintValue(PaintValueEventArgs e) {}
Exemplo n.º 34
0
            public override void PaintValue(PaintValueEventArgs e)
            {
                //Load SampleResources file
                string m = this.GetType().Module.Name;
                m = m.Substring(0, m.Length - 4);
                ResourceManager resourceManager = new ResourceManager(m + ".Resource1", Assembly.GetExecutingAssembly());


                int i = (int)e.Value;
                string _SourceName = "";
                switch (i)
                {
                    case ((int)HE_SourceType.sandstone): _SourceName = "sandstone"; break;
                    case ((int)HE_SourceType.claystone): _SourceName = "claystone"; break;
                    case ((int)HE_SourceType.siltstone): _SourceName = "siltstone"; break;
                    case ((int)HE_SourceType.mixed): _SourceName = "mixed"; break;
                    case ((int)HE_SourceType.conglomerate): _SourceName = "conglomerate"; break;
                }

                //Draw the corresponding image
                Bitmap newImage = (Bitmap)resourceManager.GetObject(_SourceName);
                Rectangle destRect = e.Bounds;
                destRect.Width *= 4;

                newImage.MakeTransparent();
                e.Graphics.DrawImage(newImage, destRect);

            }
Exemplo n.º 35
0
            public override void PaintValue(PaintValueEventArgs e)
            {
                //Load SampleResources file              
                string m = this.GetType().Module.Name;
                m = m.Substring(0, m.Length - 4);
                ResourceManager resourceManager = new ResourceManager(m + ".Resource1", Assembly.GetExecutingAssembly());

                int i = 1 + (int)e.Value;
                if (i <= 6)
                {
                    string _SourceName = "l" + i.ToString();
                    //Draw the corresponding image
                    Bitmap newImage = (Bitmap)resourceManager.GetObject(_SourceName);
                    Rectangle destRect = e.Bounds;
                    destRect.Width *= 4;

                    newImage.MakeTransparent();
                    e.Graphics.DrawImage(newImage, destRect);
                }
            }
Exemplo n.º 36
0
        public override void PaintValue(PaintValueEventArgs pe)
        {
            string bmpName = null;
            int g = (int)pe.Value;

            //Load SampleResources file
            string m = this.GetType().Module.Name;
            m = m.Substring(0, m.Length - 4);
            ResourceManager resourceManager = new ResourceManager(m + ".Resource1", Assembly.GetExecutingAssembly());


            if (g > 80)
            {
                bmpName = "best";
            }
            else if (g > 60)
            {
                bmpName = "ok";
            }
            else
            {
                bmpName = "bad";
            }


            //Draw the corresponding image
            Bitmap newImage = (Bitmap)resourceManager.GetObject(bmpName);
            Rectangle destRect = pe.Bounds;
            //destRect.Width *= 4;            
            newImage.MakeTransparent();
            pe.Graphics.DrawImage(newImage, destRect);

            //      Bitmap b = new Bitmap(typeof(GradeEditor), bmpName);            
            //            pe.Graphics.DrawImage(Image.FromFile(Environment.CurrentDirectory + "\\" + bmpName), pe.Bounds);
            //      pe.Graphics.DrawImage(b, pe.Bounds);
            //      b.Dispose();
        }