PaintFrame() public static method

public static PaintFrame ( Graphics g, int x1, int y1, int w, int h ) : void
g System.Drawing.Graphics
x1 int
y1 int
w int
h int
return void
Beispiel #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (cds != null)
            {
                cds.repaint();
            }
            if (cdlg != null)
            {
                cdlg.update();
            }
            if (redraw_image)
            {
                pr2.IRenderImage img = pr2.RenderImage.LockBitmap(bmpDisplay);
                Render.renderColorPicker(img, _bhue);
                img.Dispose();
                redraw_image = false;
            }

            e.Graphics.DrawImage(bmpDisplay, 0, 0, Width, Height);
            e.Graphics.DrawEllipse(Pens.Black, mx - 5, my - 5, 10, 10);
            e.Graphics.DrawEllipse(Pens.White, mx - 4, my - 4, 8, 8);
            e.Graphics.DrawEllipse(Pens.Black, mx - 3, my - 3, 6, 6);

            PaintFunctions.PaintFrame(e.Graphics, 0, 0, Width, Height);
        }
Beispiel #2
0
        /**************************************************/
        /* painting                                       */
        /**************************************************/
        protected override void OnPaint(PaintEventArgs e)
        {
            for (int i = 0; i < 256; i++)
            {
                e.Graphics.DrawLine(new Pen(ColorList[i]), 2, 2 + i, Width - 3, 2 + i);
            }
            int Value = _Value;

            e.Graphics.DrawLine(Pens.Black, 0, 2 + Value - 1, Width, 2 + Value - 1);
            e.Graphics.DrawLine(Pens.White, 0, 2 + Value, Width, 2 + Value);
            e.Graphics.DrawLine(Pens.Black, 0, 2 + Value + 1, Width, 2 + Value + 1);
            PaintFunctions.PaintFrame(e.Graphics, 0, 0, Width, Height);
        }
Beispiel #3
0
        /**************************************************/
        /* Painting                                       */
        /**************************************************/
        protected override void OnPaint(PaintEventArgs e)
        {
            int cx = 2 + Value * (Width - 6) / _maxval;

            switch (_channel)
            {
            // draw gradient stuffs
            case ColorChannel.Red:
                for (int i = 0; i < Width; i++)
                {
                    int red = i * _maxval / Width;
                    Pen p   = new Pen(Color.FromArgb(red, _pcolor.G, _pcolor.B));
                    e.Graphics.DrawLine(p, i, 0, i, Height - 1);
                }
                break;

            case ColorChannel.Green:
                for (int i = 0; i < Width; i++)
                {
                    int green = i * _maxval / Width;
                    Pen p     = new Pen(Color.FromArgb(_pcolor.R, green, _pcolor.B));
                    e.Graphics.DrawLine(p, i, 0, i, Height - 1);
                }
                break;

            case ColorChannel.Blue:
                for (int i = 0; i < Width; i++)
                {
                    int blue = i * _maxval / Width;
                    Pen p    = new Pen(Color.FromArgb(_pcolor.R, _pcolor.G, blue));
                    e.Graphics.DrawLine(p, i, 0, i, Height - 1);
                }
                break;

            default: break;
            }
            Rectangle r = e.ClipRectangle;

            //e.Graphics.DrawLine(Pens.Red, cx, 0, cx, Height-1);
            e.Graphics.DrawLine(Pens.Black, cx - 1, 0, cx - 1, Height - 1);
            e.Graphics.DrawLine(SystemPens.ControlLightLight, cx, 0, cx, Height - 1);
            e.Graphics.DrawLine(Pens.Black, cx + 1, 0, cx + 1, Height - 1);

/*			e.Graphics.DrawRectangle(Pens.Black, 0, 0, Width-1,Height-1);
 *                      e.Graphics.DrawRectangle(SystemPens.ControlLight,1,1,Width-3,Height-3);
 *                      e.Graphics.DrawRectangle(SystemPens.ControlLight,2,2,Width-5,Height-5);
 *                      e.Graphics.DrawRectangle(Pens.Black, 3,3, Width-7, Height-7);*/
            PaintFunctions.PaintFrame(e.Graphics, 0, 0, Width, Height);
        }
Beispiel #4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (mLayerRef == null || Global.ActiveMap == null)
            {
                return;
            }
            if (mLayerRef is MapLayerSpecial)
            {
                e.Graphics.FillRectangle(sbspec, 0, 0, Width, Height);
            }
            else
            {
                e.Graphics.FillRectangle(SystemBrushes.Control, 0, 0, Width, Height);
            }
            e.Graphics.DrawLine(Pens.Black, 0, 0, Width - 1, 0);
            if (!(mLayerRef is MapLayerSpecial))
            {
                DrawFrame(e, 0, 1, 44, Height - 3);
                DrawFrameInv(e, 4, 4, 16, 16);
                if (Render)
                {
                    e.Graphics.DrawImage(Images.BmpRender, 5, 5, 16, 16);
                }

                DrawFrameInv(e, 24, 4, 16, 16);

                if (Write)
                {
                    e.Graphics.DrawImage(Images.BmpWrite, 25, 5, 16, 16);
                }
                DrawFrame(e, 46, 1, Width - 48, Height - 3);
                e.Graphics.DrawLine(Pens.Black, 45, 0, 45, Height);
                if (Write)
                {
                    e.Graphics.FillRectangle(Brushes.White, 46, 2, Width - 46, Height - 4);
                }
            }
            else
            {
                DrawFrame(e, 1, 1, Width, Height - 3);
                if (Write)
                {
                    e.Graphics.FillRectangle(Brushes.White, 0, 2, Width, Height - 4);
                }
            }



            e.Graphics.DrawLine(Pens.Black, 0, Height - 1, Width - 1, Height - 1);
            e.Graphics.DrawLine(Pens.Black, Width - 1, 0, Width - 1, Height - 1);


            Font f = null;
            int  h = e.Graphics.MeasureString(mLayerRef.name, nameFont).ToSize().Height;

            if (Global.ActiveMap.Layers.IndexOf(mLayerRef) == 0)
            {
                f = nameFontS;
            }
            else
            {
                f = nameFont;
            }

            string output = mLayerRef.name;

            if (mLayerRef.type == LayerType.Tile)
            {
                output = mLayerRef.ID.ToString() + ": " + output;
            }
            e.Graphics.DrawString(output, f, SystemBrushes.ControlText, 50, Height / 2 - h / 2);
            int w = 0;


            if (mLayerRef.type != LayerType.Tile)
            {
                return;
            }

            string spl = (100 - mLayerRef.Translucency).ToString() + "%";

            Size s = e.Graphics.MeasureString(spl, plaxFont).ToSize();

            w = s.Width;
            h = s.Height;
            e.Graphics.DrawString(spl, plaxFont, SystemBrushes.ControlText, Width - 60, Height / 2 - h / 2);

            // draw opacity slider

            Graphics g = e.Graphics;

            PaintFunctions.PaintFrame(g, SliderRect.X, SliderRect.Y, 104, 8);
            g.FillRectangle(Brushes.DarkBlue, SliderRect.X + 2, SliderRect.Y + 2, 100 - mLayerRef.Translucency, 4);
        }
Beispiel #5
0
 protected override void OnPaint(PaintEventArgs e)
 {
     //e.Graphics.FillRectangle(SystemBrushes.Control,0,0,Width,Height);
     PaintFunctions.PaintFrame(e.Graphics, 0, 0, Width, Height);
 }
Beispiel #6
0
 private void paint(Graphics g)
 {
     g.FillRectangle(selected_color, 2, 2, Width - 4, Height - 4);
     PaintFunctions.PaintFrame(g, 0, 0, Width, Height);
 }