Ejemplo n.º 1
0
        public void InitializeComponent()
        {
            int magion          = DrawingBoardDemo.ColorButtonMagion;
            int x               = magion + 2;
            int y               = magion + 2;
            int colorButtonSize = DrawingBoardDemo.ColorButtonSize;

            drawButton        = new DrawModeButton();
            drawButton.Bounds = new Rectangle(x, y, colorButtonSize, colorButtonSize);
            drawButton.Click += button_Click;
            drawButton.Image  = Properties.Resources.Pen;
            this.Controls.Add(drawButton);
            x += colorButtonSize + magion;

            fillButton        = new DrawModeButton();
            fillButton.Bounds = new Rectangle(x, y, colorButtonSize, colorButtonSize);
            fillButton.Click += button_Click;
            fillButton.Image  = Properties.Resources.Fill;
            this.Controls.Add(fillButton);
            x  = magion + 2;
            y += colorButtonSize + magion;

            eraseButton        = new DrawModeButton();
            eraseButton.Bounds = new Rectangle(x, y, colorButtonSize, colorButtonSize);
            eraseButton.Click += button_Click;
            eraseButton.Image  = Properties.Resources.Erase;
            this.Controls.Add(eraseButton);
            x += colorButtonSize + magion;

            clearButton        = new Button();
            clearButton.Bounds = new Rectangle(x, y, colorButtonSize, colorButtonSize);
            clearButton.Click += button_Click;
            clearButton.Image  = Properties.Resources.Referesh;
            this.Controls.Add(clearButton);
        }
Ejemplo n.º 2
0
        public void InitializeComponent()
        {
            Color[,] colors = new Color[, ] {
                { Color.Black, Color.Gray, Color.Brown, Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.LightBlue, Color.Blue, Color.Violet },
                { Color.White, Color.LightGray, Color.LightCoral, Color.Pink, Color.DarkOrange, Color.LightYellow, Color.GreenYellow, Color.SkyBlue, Color.CadetBlue, Color.Tomato }
            };
            int magion          = DrawingBoardDemo.ColorButtonMagion;
            int x               = magion + 2;
            int y               = magion + 2;
            int colorButtonSize = DrawingBoardDemo.ColorButtonSize;

            foreColorButton          = new ColorButton();
            foreColorButton.Selected = true;
            foreColorButton.Name     = "foreColorButton";
            foreColorButton.Text     = "Fore color";
            foreColorButton.Bounds   = new Rectangle(x, y, colorButtonSize * 2, colorButtonSize * 2);
            foreColorButton.Click   += button_Click;
            this.Controls.Add(foreColorButton);
            x = foreColorButton.Right + magion;

            backColorButton        = new ColorButton();
            backColorButton.Name   = "backColorButton";
            backColorButton.Text   = "Back color";
            backColorButton.Bounds = new Rectangle(x, y, colorButtonSize * 2, colorButtonSize * 2);
            backColorButton.Click += button_Click;
            this.Controls.Add(backColorButton);
            x = backColorButton.Right + magion;

            int startX = x;

            for (int i = 0; i < colors.GetLength(0); i++)
            {
                x = startX;
                for (int j = 0; j < colors.GetLength(1); j++)
                {
                    Button button = new Button();
                    button.Click    += button_Click;
                    button.Bounds    = new Rectangle(x, y, colorButtonSize, colorButtonSize);
                    button.BackColor = colors[i, j];
                    x = button.Right + magion;
                    this.Controls.Add(button);
                }
                y = y + colorButtonSize + magion;
            }
            y  = magion + 3;
            x += 2;
            editColorButton                   = new Button();
            editColorButton.Name              = "editColorButton";
            editColorButton.Text              = "Edit colors";
            editColorButton.Bounds            = new Rectangle(x, y, colorButtonSize * 2, colorButtonSize * 2);
            editColorButton.Click            += button_Click;
            editColorButton.Image             = Properties.Resources.ChooseColor;
            editColorButton.TextImageRelation = TextImageRelation.ImageAboveText;
            this.Controls.Add(editColorButton);
        }