public void Reloadbuttons() { this.Controls.Clear(); if (_ShowButtons) { _buttonClear = new FlatButton(); _buttonClear.Location = new Point(3, 3); _buttonClear.Text = "Clear"; _buttonClear.BackShadeColor = Color.White; _buttonClear.BackShadeRatio = 0.1; _buttonClear.Click += new EventHandler((o, e) => { CreateBitmap(); CurrentTool = DrawBoxTools.None; }); this.Controls.Add(_buttonClear); _buttonBrush = new FlatButton(); _buttonBrush.Location = new Point(_buttonClear.Right + 3, 3); _buttonBrush.Text = "Brush"; _buttonBrush.BackShadeColor = Color.Yellow; _buttonBrush.BackShadeRatio = 0.1; _buttonBrush.Click += new EventHandler((o, e) => { if (CurrentTool == DrawBoxTools.Brush) { CurrentTool = DrawBoxTools.None; } else { CurrentTool = DrawBoxTools.Brush; } }); this.Controls.Add(_buttonBrush); _buttonEraser = new FlatButton(); _buttonEraser.Location = new Point(_buttonBrush.Right + 3, 3); _buttonEraser.Text = "Eraser"; _buttonEraser.BackShadeColor = Color.Pink; _buttonEraser.BackShadeRatio = 0.1; _buttonEraser.Click += new EventHandler((o, e) => { if (CurrentTool == DrawBoxTools.Eraser) { CurrentTool = DrawBoxTools.None; } else { CurrentTool = DrawBoxTools.Eraser; } }); this.Controls.Add(_buttonEraser); _buttonColorSecondary = new FlatButton(); _buttonColorSecondary.Width = _buttonColorSecondary.Height; _buttonColorSecondary.Location = new Point(this.Width - _buttonColorSecondary.Width - 3, 3 + _buttonColorSecondary.Height / 3); _buttonColorSecondary.BackShadeColor = _ColorSecondary; _buttonColorSecondary.BackShadeRatio = 1.0; _buttonColorSecondary.Anchor = AnchorStyles.Top | AnchorStyles.Right; _buttonColorSecondary.Click += new EventHandler((o, e) => { FormColorPicker dlg = new FormColorPicker(); dlg.Color = _ColorSecondary; if (dlg.ShowDialog(this) != DialogResult.OK) { return; } _buttonColorSecondary.BackShadeColor = _ColorSecondary = dlg.Color; }); this.Controls.Add(_buttonColorSecondary); _buttonColorPrimary = new FlatButton(); _buttonColorPrimary.Width = _buttonColorPrimary.Height; _buttonColorPrimary.Location = new Point(_buttonColorSecondary.Left - (int)(_buttonColorPrimary.Width * 0.6), 3); _buttonColorPrimary.BackShadeColor = _ColorPrimary; _buttonColorPrimary.BackShadeRatio = 1.0; _buttonColorPrimary.Anchor = AnchorStyles.Top | AnchorStyles.Right; _buttonColorPrimary.Click += new EventHandler((o, e) => { FormColorPicker dlg = new FormColorPicker(); dlg.Color = _ColorPrimary; if (dlg.ShowDialog(this) != DialogResult.OK) { return; } _buttonColorPrimary.BackShadeColor = _ColorPrimary = dlg.Color; }); this.Controls.Add(_buttonColorPrimary); _buttonColorPrimary.BringToFront(); } }