public Paint() { InitializeComponent(); fontDialog1.ShowColor = true; pictureBox1_Color1.BackColor = buf.DrawColor; pictureBox2_Color2.BackColor = buf.FillColor; DoubleBuffered = true; button2_Line.Checked = true; Enter_text_Form.Hide(); //Выпадающие подсказки ToolTip t = new ToolTip(); t.SetToolTip(label1_Color1, "Выбор цвета пера"); t.SetToolTip(label2_Color2, "Выбор цвета заливки"); t.SetToolTip(button1_Text, "Выбор элемента текст"); t.SetToolTip(button2_Line, "Выбор элемента Линия"); t.SetToolTip(button3_Pryamougolnik, "Выбор элемента прямоугольник"); t.SetToolTip(button4_Oval, "Выбор элемента Овал"); t.SetToolTip(Fill_Button, "Выбор элемента Заливка"); t.SetToolTip(Eraser_button, "Выбор элемента Стирка"); t.SetToolTip(Size_Line, "Толщина линии"); }
/// <summary> /// Предпросмотр печати /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void printToolStripMenuItem_Click(object sender, EventArgs e) { Enter_text_Form.Text = null; Enter_text_Form.Hide(); printPreviewDialog1.ShowDialog(); if (printDialog1.ShowDialog() == DialogResult.OK) { printDocument1.Print(); } }
/// <summary> /// Вывод на печать /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Enter_text_Form.Text = null; Enter_text_Form.Hide(); Bitmap img = new Bitmap(Paint_panel.Width, Paint_panel.Height); Paint_panel.DrawToBitmap(img, new Rectangle(0, 0, Paint_panel.Width, Paint_panel.Height)); Graphics g = e.Graphics; g.DrawImage(img, 0, 0); }
/// <summary> /// Создание экземпляров объектов в буфере /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Paint_panel_MouseDown(object sender, MouseEventArgs e) { if (Eraser_button.Checked == false) { flag_eraser = false; } Enter_text_Form.Hide(); if (Eraser_button.Checked == true) { obj = new Lastic(); flag_eraser = true; Enter_text_Form.Hide(); } else if (button1_Text.Checked == true) { if (Enter_text_Form.Text.Count() != 0) { obj = new Text(Enter_text_Form.Text); ((Text)obj).Font = buf.Font; Enter_text_Form.Text = null; Enter_text_Form.Show(); Enter_text_Form.Focus(); } else { obj = null; return; } } else if (button2_Line.Checked == true) { obj = new Line(); Enter_text_Form.Text = null; Enter_text_Form.Hide(); } else if (button3_Pryamougolnik.Checked == true) { obj = new RectangleB(); Enter_text_Form.Text = null; Enter_text_Form.Hide(); } else if (button4_Oval.Checked == true) { obj = new Ellips(); Enter_text_Form.Text = null; Enter_text_Form.Hide(); } flag_mouseclick = true; obj.Colorelem = buf.DrawColor; obj.Widthelem = buf.LineWidth; obj.Start1 = e.Location; if (Fill_Button.Checked == true) { obj.backgroundcolorelem = buf.FillColor; // obj.Colorelem = buf.FillColor; Enter_text_Form.Text = null; Enter_text_Form.Hide(); } }
/// <summary> /// Элемент текст /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Text_Click(object sender, EventArgs e) { Enter_text_Form.Show(); Enter_text_Form.Focus(); }
private void Eraser_button_Click(object sender, EventArgs e) { Enter_text_Form.Hide(); }
private void button4_Oval_Click(object sender, EventArgs e) { Enter_text_Form.Hide(); }
private void button3_Pryamougolnik_Click(object sender, EventArgs e) { Enter_text_Form.Hide(); }