Exemplo n.º 1
0
 private void panel1_MouseUp(object sender, MouseEventArgs e)
 {
     if (Kontrol.Sec == false)
     {
         Kontrol.cizBirakildi(e);
     }
 }
Exemplo n.º 2
0
 private void panel1_MouseDown(object sender, MouseEventArgs e)
 {
     if (Kontrol.Sec == true)
     {
         Kontrol.secimYap(panel1, e.X, e.Y);
     }
     else
     {
         Kontrol.cizBasildi(e);
     }
 }
Exemplo n.º 3
0
        public static void dosyaAc(OpenFileDialog file, Panel cizimYeri)
        {
            FileStream   fs  = new FileStream(file.FileName, FileMode.Open, FileAccess.Read);
            StreamReader sr  = new StreamReader(fs);
            FileStream   fs2 = new FileStream(Application.StartupPath.ToString() + "\\tmp.txt", FileMode.Append);
            StreamWriter sw  = new StreamWriter(fs2);

            for (; ;)
            {
                string yazi = sr.ReadLine();
                if (yazi == null)
                {
                    break;
                }
                sw.WriteLine(yazi);
            }
            sw.Flush();
            sw.Close(); fs2.Close(); sr.Close(); fs.Close(); Kontrol.ilkSekil();
        }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
 public static void ciz(bool kontrol, Panel cizimYeri, int sekil, Color renk, int x1, int y1, int x2, int y2)
 {
     if (kontrol)
     {
         Graphics   formGrafik = cizimYeri.CreateGraphics();
         SolidBrush firca      = new SolidBrush(renk);
         formGrafik.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
         if (sekil == 0)
         {
             if (x2 - x1 >= 0 && y2 - y1 >= 0)
             {
                 if (x2 >= 1037 || y2 >= 779)
                 {
                     if (Kontrol.SiniraGelindi == false)
                     {
                         Kontrol.sinirAsildi(x2, y2);
                     }
                 }
                 else
                 {
                     Kontrol.sinirİcinde(); formGrafik.Clear(Color.White); if (Kontrol.SiniraGelindi == false)
                     {
                         formGrafik.FillRectangle(firca, x1, y1, x2 - x1, y2 - y1);
                     }
                 }
             }
             else if (x2 - x1 >= 0 && y2 - y1 < 0)
             {
                 if (x1 >= 1037 || y2 <= 0)
                 {
                     if (Kontrol.SiniraGelindi == false)
                     {
                         Kontrol.sinirAsildi(x2, y2);
                     }
                 }
                 else
                 {
                     Kontrol.sinirİcinde(); formGrafik.Clear(Color.White); if (Kontrol.SiniraGelindi == false)
                     {
                         formGrafik.FillRectangle(firca, x1, y2, x2 - x1, y1 - y2);
                     }
                 }
             }
             else if (x2 - x1 < 0 && y2 - y1 >= 0)
             {
                 if (x2 <= 0 || y2 >= 779)
                 {
                     if (Kontrol.SiniraGelindi == false)
                     {
                         Kontrol.sinirAsildi(x2, y2);
                     }
                 }
                 else
                 {
                     Kontrol.sinirİcinde(); formGrafik.Clear(Color.White); if (Kontrol.SiniraGelindi == false)
                     {
                         formGrafik.FillRectangle(firca, x2, y1, x1 - x2, y2 - y1);
                     }
                 }
             }
             else if (x2 - x1 < 0 && y2 - y1 < 0)
             {
                 if (x2 <= 0 || y2 <= 0)
                 {
                     if (Kontrol.SiniraGelindi == false)
                     {
                         Kontrol.sinirAsildi(x2, y2);
                     }
                 }
                 else
                 {
                     Kontrol.sinirİcinde(); formGrafik.Clear(Color.White); if (Kontrol.SiniraGelindi == false)
                     {
                         formGrafik.FillRectangle(firca, x2, y2, x1 - x2, y1 - y2);
                     }
                 }
             }
         }
         else if (sekil == 1)
         {
             if (x2 > x1 && (x2 >= 1037 || x1 - ((2 * x2 - 2 * x1) / 2) <= 0 || y1 - ((2 * x2 - 2 * x1) / 2) + 2 * x2 - 2 * x1 >= 779 || y1 - ((2 * x2 - 2 * x1) / 2) <= 0))
             {
                 if (Kontrol.SiniraGelindi == false)
                 {
                     Kontrol.sinirAsildi(x2, y2);
                 }
             }
             else if (x2 < x1 && (x2 <= 0 || x1 + (x1 - x2) >= 1037 || y1 - (x1 - x2) <= 0 || y1 + (x1 - x2) >= 779))
             {
                 if (Kontrol.SiniraGelindi == false)
                 {
                     Kontrol.sinirAsildi(x2, y2);
                 }
             }
             else
             {
                 Kontrol.sinirİcinde(); formGrafik.Clear(Color.White); if (Kontrol.SiniraGelindi == false)
                 {
                     formGrafik.FillEllipse(firca, x1 - ((2 * x2 - 2 * x1) / 2), y1 - ((2 * x2 - 2 * x1) / 2), 2 * x2 - 2 * x1, 2 * x2 - 2 * x1);
                 }
             }
         }
         else if (sekil == 2)
         {
             Point[] noktalar = { new Point(x1, y1 - (x2 - x1)), new Point(x1 - (x2 - x1), y1 + (x2 - x1)), new Point(x1 + (x2 - x1), y1 + (x2 - x1)) };
             if (x2 > x1 && (y1 - (x2 - x1) <= 0 || y1 + (x2 - x1) >= 779 || x1 - (x2 - x1) <= 0 || x1 + (x2 - x1) >= 1037))
             {
                 if (Kontrol.SiniraGelindi == false)
                 {
                     Kontrol.sinirAsildi(x2, y2);
                 }
             }
             else if (x2 < x1 && (y1 - (x2 - x1) >= 779 || y1 + (x2 - x1) <= 0 || x1 - (x2 - x1) >= 1037 || x1 + (x2 - x1) <= 0))
             {
                 if (Kontrol.SiniraGelindi == false)
                 {
                     Kontrol.sinirAsildi(x2, y2);
                 }
             }
             else
             {
                 Kontrol.sinirİcinde(); formGrafik.Clear(Color.White); if (Kontrol.SiniraGelindi == false)
                 {
                     formGrafik.FillPolygon(firca, noktalar);
                 }
             }
         }
         else if (sekil == 3)
         {
             Point[] noktalar = { new Point(x1 - (x2 - x1), y1), new Point(x1 - (x2 - x1) / 2, y1 - (x2 - x1)), new Point(x1 + (x2 - x1) / 2, y1 - (x2 - x1)), new Point(x1 + (x2 - x1), y1), new Point(x1 + (x2 - x1) / 2, y1 + (x2 - x1)), new Point(x1 - (x2 - x1) / 2, y1 + (x2 - x1)) };
             if (x2 > x1 && (x1 - (x2 - x1) <= 0 || x1 + (x2 - x1) >= 1037 || y1 - (x2 - x1) <= 0 || y1 + (x2 - x1) >= 779))
             {
                 if (Kontrol.SiniraGelindi == false)
                 {
                     Kontrol.sinirAsildi(x2, y2);
                 }
             }
             else if (x2 < x1 && (x1 - (x2 - x1) >= 1037 || x1 + (x2 - x1) <= 0 || y1 + (x2 - x1) <= 0 || y1 - (x2 - x1) >= 779))
             {
                 if (Kontrol.SiniraGelindi == false)
                 {
                     Kontrol.sinirAsildi(x2, y2);
                 }
             }
             else
             {
                 Kontrol.sinirİcinde(); formGrafik.Clear(Color.White); if (Kontrol.SiniraGelindi == false)
                 {
                     formGrafik.FillPolygon(firca, noktalar);
                 }
             }
         }
     }
 }