private void button16_Click(object sender, EventArgs e) { SaveFileDialog kayit = new SaveFileDialog(); kayit.Filter = "Metin Dosyası|*.txt"; if (kayit.ShowDialog() == DialogResult.OK) { Dosyalama.kayit(kayit); } }
public static void cizBirakildi(MouseEventArgs e) { if (renk != Color.White) { bitisX = e.X; bitisY = e.Y; ciz = false; Dosyalama.geciciKayit(); ilkSekilCizildi = true; } }
private void panel1_MouseMove(object sender, MouseEventArgs e) { if (Kontrol.Sec == false) { Cizim.ciz(Kontrol.Ciz, panel1, Kontrol.Sekil, Kontrol.Renk, Kontrol.BaslangicX, Kontrol.BaslangicY, e.X, e.Y); if (Kontrol.Ciz) { Dosyalama.geciciDosyadanCiz(panel1, Kontrol.IlkSekilCizildi); } } }
private void button17_Click(object sender, EventArgs e) { OpenFileDialog dosya = new OpenFileDialog(); dosya.Filter = "Metin Dosyası|*.txt"; if (dosya.ShowDialog() == DialogResult.OK) { Dosyalama.dosyaAc(dosya, panel1); Dosyalama.geciciDosyadanCiz(panel1, true); } }
public static void secimYap(Panel cizimYeri, int x, int y) { secilenX = x; secilenY = y; Dosyalama.secileniBul(cizimYeri, x, y); }
private void butonTik(object sender, EventArgs e) { Graphics formGrafik = panel1.CreateGraphics(); if (sender == button1) { Kontrol.sekilSec(0); formGrafik.Clear(Color.White); Dosyalama.geciciDosyadanCiz(panel1, Kontrol.IlkSekilCizildi); if (Kontrol.Sec) { Kontrol.secBirakildi(); } panel2.BackColor = Color.Gold; panel3.BackColor = SystemColors.Control; panel4.BackColor = SystemColors.Control; panel5.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button2) { Kontrol.sekilSec(1); formGrafik.Clear(Color.White); Dosyalama.geciciDosyadanCiz(panel1, Kontrol.IlkSekilCizildi); if (Kontrol.Sec) { Kontrol.secBirakildi(); } panel2.BackColor = SystemColors.Control; panel3.BackColor = Color.Gold; panel4.BackColor = SystemColors.Control; panel5.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button3) { Kontrol.sekilSec(2); formGrafik.Clear(Color.White); Dosyalama.geciciDosyadanCiz(panel1, Kontrol.IlkSekilCizildi); if (Kontrol.Sec) { Kontrol.secBirakildi(); } panel2.BackColor = SystemColors.Control; panel3.BackColor = SystemColors.Control; panel4.BackColor = Color.Gold; panel5.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button4) { Kontrol.sekilSec(3); formGrafik.Clear(Color.White); Dosyalama.geciciDosyadanCiz(panel1, Kontrol.IlkSekilCizildi); if (Kontrol.Sec) { Kontrol.secBirakildi(); } panel2.BackColor = SystemColors.Control; panel3.BackColor = SystemColors.Control; panel4.BackColor = SystemColors.Control; panel5.BackColor = Color.Gold; panel15.BackColor = SystemColors.Control; } else if (sender == button5) { if (Kontrol.Sec == true) { Dosyalama.renkDegistir(panel1, Color.Cyan, Kontrol.SecilenX, Kontrol.SecilenY); } Kontrol.renkSec(Color.Cyan); Kontrol.secBirakildi(); panel6.BackColor = Color.Pink; panel7.BackColor = SystemColors.Control; panel8.BackColor = SystemColors.Control; panel9.BackColor = SystemColors.Control; panel10.BackColor = SystemColors.Control; panel11.BackColor = SystemColors.Control; panel12.BackColor = SystemColors.Control; panel13.BackColor = SystemColors.Control; panel14.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button6) { if (Kontrol.Sec == true) { Dosyalama.renkDegistir(panel1, Color.LightGray, Kontrol.SecilenX, Kontrol.SecilenY); } Kontrol.renkSec(Color.LightGray); Kontrol.secBirakildi(); panel6.BackColor = SystemColors.Control; panel7.BackColor = Color.Pink; panel8.BackColor = SystemColors.Control; panel9.BackColor = SystemColors.Control; panel10.BackColor = SystemColors.Control; panel11.BackColor = SystemColors.Control; panel12.BackColor = SystemColors.Control; panel13.BackColor = SystemColors.Control; panel14.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button7) { if (Kontrol.Sec == true) { Dosyalama.renkDegistir(panel1, Color.Yellow, Kontrol.SecilenX, Kontrol.SecilenY); } Kontrol.renkSec(Color.Yellow); Kontrol.secBirakildi(); panel6.BackColor = SystemColors.Control; panel7.BackColor = SystemColors.Control; panel8.BackColor = Color.Pink; panel9.BackColor = SystemColors.Control; panel10.BackColor = SystemColors.Control; panel11.BackColor = SystemColors.Control; panel12.BackColor = SystemColors.Control; panel13.BackColor = SystemColors.Control; panel14.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button8) { if (Kontrol.Sec == true) { Dosyalama.renkDegistir(panel1, Color.Blue, Kontrol.SecilenX, Kontrol.SecilenY); } Kontrol.renkSec(Color.Blue); Kontrol.secBirakildi(); panel6.BackColor = SystemColors.Control; panel7.BackColor = SystemColors.Control; panel8.BackColor = SystemColors.Control; panel9.BackColor = Color.Pink; panel10.BackColor = SystemColors.Control; panel11.BackColor = SystemColors.Control; panel12.BackColor = SystemColors.Control; panel13.BackColor = SystemColors.Control; panel14.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button9) { if (Kontrol.Sec == true) { Dosyalama.renkDegistir(panel1, Color.Red, Kontrol.SecilenX, Kontrol.SecilenY); } Kontrol.renkSec(Color.Red); Kontrol.secBirakildi(); panel6.BackColor = SystemColors.Control; panel7.BackColor = SystemColors.Control; panel8.BackColor = SystemColors.Control; panel9.BackColor = SystemColors.Control; panel10.BackColor = Color.Pink; panel11.BackColor = SystemColors.Control; panel12.BackColor = SystemColors.Control; panel13.BackColor = SystemColors.Control; panel14.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button10) { if (Kontrol.Sec == true) { Dosyalama.renkDegistir(panel1, Color.Green, Kontrol.SecilenX, Kontrol.SecilenY); } Kontrol.renkSec(Color.Green); Kontrol.secBirakildi(); panel6.BackColor = SystemColors.Control; panel7.BackColor = SystemColors.Control; panel8.BackColor = SystemColors.Control; panel9.BackColor = SystemColors.Control; panel10.BackColor = SystemColors.Control; panel11.BackColor = Color.Pink; panel12.BackColor = SystemColors.Control; panel13.BackColor = SystemColors.Control; panel14.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button11) { if (Kontrol.Sec == true) { Dosyalama.renkDegistir(panel1, Color.Purple, Kontrol.SecilenX, Kontrol.SecilenY); } Kontrol.renkSec(Color.Purple); Kontrol.secBirakildi(); panel6.BackColor = SystemColors.Control; panel7.BackColor = SystemColors.Control; panel8.BackColor = SystemColors.Control; panel9.BackColor = SystemColors.Control; panel10.BackColor = SystemColors.Control; panel11.BackColor = SystemColors.Control; panel12.BackColor = Color.Pink; panel13.BackColor = SystemColors.Control; panel14.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button12) { if (Kontrol.Sec == true) { Dosyalama.renkDegistir(panel1, Color.Orange, Kontrol.SecilenX, Kontrol.SecilenY); } Kontrol.renkSec(Color.Orange); Kontrol.secBirakildi(); panel6.BackColor = SystemColors.Control; panel7.BackColor = SystemColors.Control; panel8.BackColor = SystemColors.Control; panel9.BackColor = SystemColors.Control; panel10.BackColor = SystemColors.Control; panel11.BackColor = SystemColors.Control; panel12.BackColor = SystemColors.Control; panel13.BackColor = Color.Pink; panel14.BackColor = SystemColors.Control; panel15.BackColor = SystemColors.Control; } else if (sender == button13) { if (Kontrol.Sec == true) { Dosyalama.renkDegistir(panel1, Color.Brown, Kontrol.SecilenX, Kontrol.SecilenY); } Kontrol.renkSec(Color.Brown); Kontrol.secBirakildi(); panel6.BackColor = SystemColors.Control; panel7.BackColor = SystemColors.Control; panel8.BackColor = SystemColors.Control; panel9.BackColor = SystemColors.Control; panel10.BackColor = SystemColors.Control; panel11.BackColor = SystemColors.Control; panel12.BackColor = SystemColors.Control; panel13.BackColor = SystemColors.Control; panel14.BackColor = Color.Pink; panel15.BackColor = SystemColors.Control; } else if (sender == button14) { Kontrol.secBasildi(); panel2.BackColor = SystemColors.Control; panel3.BackColor = SystemColors.Control; panel4.BackColor = SystemColors.Control; panel5.BackColor = SystemColors.Control; panel15.BackColor = Color.Gold; } else if (sender == button15) { Dosyalama.secileniSil(panel1, Kontrol.SecilenX, Kontrol.SecilenY); Kontrol.secBirakildi(); panel15.BackColor = SystemColors.Control; } }
public static void secim(Panel cizimYeri, int sekil, int x1, int y1, int x2, int y2) { Graphics formGrafik = cizimYeri.CreateGraphics(); formGrafik.Clear(Color.White); Dosyalama.geciciDosyadanCiz(cizimYeri, true); Pen kalem = new Pen(Color.Black, 8); if (sekil == 0) { if (x2 - x1 >= 0 && y2 - y1 >= 0) { formGrafik.DrawRectangle(kalem, x1 - 20, y1 - 20, x2 - x1 + 40, y2 - y1 + 40); } else if (x2 - x1 >= 0 && y2 - y1 < 0) { formGrafik.DrawRectangle(kalem, x1 - 20, y2 - 20, x2 - x1 + 40, y1 - y2 + 40); } else if (x2 - x1 < 0 && y2 - y1 >= 0) { formGrafik.DrawRectangle(kalem, x2 - 20, y1 - 20, x1 - x2 + 40, y2 - y1 + 40); } else if (x2 - x1 < 0 && y2 - y1 < 0) { formGrafik.DrawRectangle(kalem, x2 - 20, y2 - 20, x1 - x2 + 40, y1 - y2 + 40); } } else if (sekil == 1) { if (x2 - x1 >= 0 && y2 - y1 >= 0) { formGrafik.DrawEllipse(kalem, x1 - ((2 * x2 - 2 * x1) / 2) - 20, y1 - ((2 * x2 - 2 * x1) / 2) - 20, 2 * x2 - 2 * x1 + 40, 2 * x2 - 2 * x1 + 40); } else if (x2 - x1 >= 0 && y2 - y1 < 0) { formGrafik.DrawEllipse(kalem, x1 - ((2 * x2 - 2 * x1) / 2) - 20, y1 - ((2 * x2 - 2 * x1) / 2) - 20, 2 * x2 - 2 * x1 + 40, 2 * x2 - 2 * x1 + 40); } else if (x2 - x1 < 0 && y2 - y1 >= 0) { formGrafik.DrawEllipse(kalem, x1 - ((2 * x2 - 2 * x1) / 2) + 20, y1 - ((2 * x2 - 2 * x1) / 2) + 20, 2 * x2 - 2 * x1 - 40, 2 * x2 - 2 * x1 - 40); } else if (x2 - x1 < 0 && y2 - y1 < 0) { formGrafik.DrawEllipse(kalem, x1 - ((2 * x2 - 2 * x1) / 2) + 20, y1 - ((2 * x2 - 2 * x1) / 2) + 20, 2 * x2 - 2 * x1 - 40, 2 * x2 - 2 * x1 - 40); } } else if (sekil == 2) { if (x1 < x2) { Point[] noktalar = { new Point(x1, y1 - (x2 - x1) - 30), new Point(x1 - (x2 - x1) - 30, y1 + (x2 - x1) + 15), new Point(x1 + (x2 - x1) + 30, y1 + (x2 - x1) + 15) }; formGrafik.DrawPolygon(kalem, noktalar); } else { Point[] noktalar = { new Point(x1, y1 - (x2 - x1) + 30), new Point(x1 - (x2 - x1) + 30, y1 + (x2 - x1) - 15), new Point(x1 + (x2 - x1) - 30, y1 + (x2 - x1) - 15) }; formGrafik.DrawPolygon(kalem, noktalar); } } else if (sekil == 3) { if (x1 < x2) { Point[] noktalar = { new Point(x1 - (x2 - x1) - 15, y1), new Point(x1 - (x2 - x1) / 2 - 15, y1 - (x2 - x1) - 15), new Point(x1 + (x2 - x1) / 2 + 15, y1 - (x2 - x1) - 15), new Point(x1 + 15 + (x2 - x1), y1), new Point(x1 + (x2 - x1) / 2 + 15, y1 + (x2 - x1) + 15), new Point(x1 - (x2 - x1) / 2 - 15, y1 + (x2 - x1) + 15) }; formGrafik.DrawPolygon(kalem, noktalar); } else { Point[] noktalar = { new Point(x1 - (x2 - x1) + 15, y1), new Point(x1 - (x2 - x1) / 2 + 15, y1 - (x2 - x1) + 15), new Point(x1 + (x2 - x1) / 2 - 15, y1 - (x2 - x1) + 15), new Point(x1 - 15 + (x2 - x1), y1), new Point(x1 + (x2 - x1) / 2 - 15, y1 + (x2 - x1) - 15), new Point(x1 - (x2 - x1) / 2 + 15, y1 + (x2 - x1) - 15) }; formGrafik.DrawPolygon(kalem, noktalar); } } }