Exemplo n.º 1
0
            /// <summary>
            /// Draw the image of the button
            /// </summary>
            /// <param name="e"></param>
            /// <param name="bounds"></param>
            public virtual void DrawImage(VCButtonItem button, ItemPaintEventArgs e, Rectangle imgBounds)
            {
                Image image = button.Image;

                if (button.Enabled)
                {
                    e.Graphics.DrawImage(image, imgBounds);
                }
                else
                {
                    float[][] array = new float[5][];
                    array[0] = new float[5] {
                        0.2125f, 0.2125f, 0.2125f, 0, 0
                    };
                    array[1] = new float[5] {
                        0.5f, 0.5f, 0.5f, 0, 0
                    };
                    array[2] = new float[5] {
                        0.0361f, 0.0361f, 0.0361f, 0, 0
                    };
                    array[3] = new float[5] {
                        0, 0, 0, 1, 0
                    };
                    array[4] = new float[5] {
                        0.2f, 0.2f, 0.2f, 0, 1
                    };
                    ColorMatrix     grayMatrix = new ColorMatrix(array);
                    ImageAttributes att        = new ImageAttributes();
                    att.SetColorMatrix(grayMatrix);
                    e.Graphics.DrawImage(image, imgBounds, 0, 0, imgBounds.Width, imgBounds.Height, GraphicsUnit.Pixel, att);
                }
            }
Exemplo n.º 2
0
 /// <summary>
 /// Draw the background of the button
 /// </summary>
 /// <param name="e"></param>
 /// <param name="bounds"></param>
 public virtual void DrawBackground(VCButtonItem button, ItemPaintEventArgs e, GraphicsPath bounds)
 {
     if (button.IsMouseDown)
     {
         using (Brush brush = new SolidBrush(Color.Yellow))
         {
             e.Graphics.FillPath(brush, bounds);
         }
     }
 }
Exemplo n.º 3
0
            /// <summary>
            /// Draw the text of the button
            /// </summary>
            /// <param name="e"></param>
            /// <param name="bounds"></param>
            public virtual void DrawText(VCButtonItem button, ItemPaintEventArgs e, Rectangle textBounds)
            {
                // Calculate formatting
                StringFormat format = new StringFormat();

                format.Alignment     = StringAlignment.Center;
                format.LineAlignment = StringAlignment.Center;

                // Draw text
                Color c = button.Enabled ? button.TextColor : ControlPaint.Light(button.TextColor);

                using (Brush brush = new SolidBrush(c))
                {
                    e.Graphics.DrawString(button.Text, button.Font, brush, textBounds, format);
                }
            }
Exemplo n.º 4
0
 /// <summary>
 /// Draw the mouse over markers of the button
 /// </summary>
 /// <param name="e"></param>
 /// <param name="bounds"></param>
 public virtual void DrawMouseOver(VCButtonItem button, ItemPaintEventArgs e, GraphicsPath bounds)
 {
     e.Graphics.DrawPath(Pens.Azure, bounds);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Default ctor
 /// </summary>
 /// <param name="button"></param>
 /// <param name="next"></param>
 public ButtonMouseHandler(VCButtonItem button, Handlers.MouseHandler next)
     : base(next)
 {
     this.button = button;
 }