Example #1
0
 private void PointDisplaySizeTextBox_TextChange(object sender, EventArgs e)
 {
     if (PolyPointImage != null && float.TryParse(TextBoxPointDisplaySize.Text, out float o))
     {
         PolyPointImage.PointSize = o;
         ConvertingImageBox.Invalidate();
     }
 }
Example #2
0
 private void ZoomComboBox_TextChange(object sender, EventArgs e)
 {
     if (PolyPointImage != null)
     {
         PolyPointImage.Zoom     = GetZoomFromBox();
         ConvertingImageBox.Size = new Size((int)Math.Ceiling(Generator.Image.Size.Width * PolyPointImage.Zoom),
                                            (int)Math.Ceiling(Generator.Image.Size.Height * PolyPointImage.Zoom));
         ConvertingImageBox.Invalidate();
     }
 }
Example #3
0
 private void AccuracyTextBox_TextChange(object sender, EventArgs e)
 {
     if (Generator != null && PolyPointImage != null)
     {
         if (float.TryParse(TextBoxAccuracy.Text, out float accuracy))
         {
             GeneratorAccuracy = accuracy;
             Points            = Generator.GenerateAsList(GeneratorAccuracy, PointOrigin);
             ConvertingImageBox.Invalidate();
             OutputPoints();
         }
     }
 }
Example #4
0
 private void PointOriginTextBoxUpdateText()
 {
     if (Generator != null && PolyPointImage != null)
     {
         if (Int32.TryParse(PointOriginXTextBox.Text, out int PointOriginX) && Int32.TryParse(PointOriginYTextBox.Text, out int PointOriginY))
         {
             PointOrigin = new Size(PointOriginX, PointOriginY);
             PolyPointImage.PointOrigin = PointOrigin;
             Points = Generator.GenerateAsList(GeneratorAccuracy, PointOrigin);
             ConvertingImageBox.Invalidate();
             OutputPoints();
         }
     }
 }
Example #5
0
        private void PointColorButton_Click(object sender, EventArgs e)
        {
            PointColorDialog.ShowDialog();

            if (PolyPointImage != null)
            {
                if (PointColorDialog.Color != PolyPointImage.PointColor)
                {
                    PolyPointImage.PointColor = PointColorDialog.Color;
                    ConvertingImageBox.Invalidate();
                }
            }

            PointColorButton.BackColor = PointColorDialog.Color;
        }
Example #6
0
        private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Title  = "Open Image";
                ofd.Filter = "png files (*.png)|*.png";

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    CloseImage();

                    Generator = new PolyPointGenerator(new Bitmap(ofd.FileName));

                    if (float.TryParse(TextBoxAccuracy.Text, out float acc))
                    {
                        GeneratorAccuracy = acc;
                    }

                    if (Int32.TryParse(PointOriginXTextBox.Text, out int PointOriginX) && Int32.TryParse(PointOriginYTextBox.Text, out int PointOriginY))
                    {
                        PointOrigin = new Size(PointOriginX, PointOriginY);
                    }

                    Points = Generator.GenerateAsList(GeneratorAccuracy, PointOrigin);

                    PolyPointImage = new PolyPointImage(ConvertingImageBox.CreateGraphics(), ConvertingImageBox.BackColor, PointColorDialog.Color)
                    {
                        PointOrigin = PointOrigin,
                        Zoom        = GetZoomFromBox()
                    };

                    ConvertingImageBox.Size = new Size((int)Math.Ceiling(Generator.Image.Size.Width * PolyPointImage.Zoom),
                                                       (int)Math.Ceiling(Generator.Image.Size.Height * PolyPointImage.Zoom));

                    if (Int32.TryParse(TextBoxPointDisplaySize.Text, out int o))
                    {
                        PolyPointImage.PointSize = o;
                    }

                    ConvertingImageBox.Invalidate();

                    OutputPoints();
                }
            }
        }
Example #7
0
 private void CloseImage()
 {
     if (Generator != null)
     {
         Generator.Close();
         Generator = null;
     }
     Points = null;
     if (PolyPointImage != null)
     {
         PolyPointImage.Close();
         PolyPointImage = null;
     }
     TextBoxOutput.Clear();
     PointOrigin = new Size(0, 0);
     PointOriginXTextBox.Text = "0";
     PointOriginYTextBox.Text = "0";
     GeneratorAccuracy        = 1f;
     ConvertingImageBox.Invalidate();
 }