private void SetHoverLine(Line l)
        {
            bool change = hoverLine != l;

            if (change)
            {
                hoverLine = l;
                PictureBox1.SetHoverLine(l);
                PictureBox1.Invalidate();
                if (selectedLine == null)
                {
                    lineBox.Enabled = l != null;
                    if (l != null)
                    {
                        numLatA.Value   = (decimal)l.A.latitude;
                        numLatB.Value   = (decimal)l.B.latitude;
                        numLatO.Value   = (decimal)l.O.latitude;
                        numLongA.Value  = (decimal)l.A.longitude;
                        numLongB.Value  = (decimal)l.B.longitude;
                        numLongO.Value  = (decimal)l.O.longitude;
                        fldLineTyp.Text = ((LineType)l.Type).ToString();
                    }
                    else
                    {
                        numLatA.Value   = 0;
                        numLatB.Value   = 0;
                        numLatO.Value   = 0;
                        numLongA.Value  = 0;
                        numLongB.Value  = 0;
                        numLongO.Value  = 0;
                        fldLineTyp.Text = "";
                    }
                }
            }
        }
Example #2
0
 private void btnApply_Click(object sender, EventArgs e)
 {
     if (activeParcour != null && comboBoxPoint.SelectedItem != null)
     {
         if (activeParcour.Line.Count(p => p.Type == (int)comboBoxPoint.SelectedItem) == 1)
         {
             Line   l    = activeParcour.Line.First(p => p.Type == (int)comboBoxPoint.SelectedItem);
             Vector a    = new Vector(l.A.longitude, l.A.latitude, 0);
             Vector b    = new Vector(l.B.longitude, l.B.latitude, 0);
             Vector m    = Vector.Middle(a, b);
             Vector neu  = new Vector((double)manualPointLongitude.Value, (double)manualPointLatitude.Value, 0);
             Vector diff = neu - m;
             l.A.longitude += diff.X;
             l.A.latitude  += diff.Y;
             l.O.longitude += diff.X;
             l.O.latitude  += diff.Y;
             l.B.longitude += diff.X;
             l.B.latitude  += diff.Y;
             List <PointTempExtension> connectedPoints = findConnectedPoints(activeParcour.Line, l.A, l);
             foreach (Point p in connectedPoints)
             {
                 if (p != l.A && p != l.B && p != l.O)
                 {
                     p.longitude += diff.X;
                     p.latitude  += diff.Y;
                 }
             }
             PictureBox1.Invalidate();
         }
     }
 }
Example #3
0
        private void PictureBox1_MouseDown(System.Object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (MouseButtons == MouseButtons.Right)
            {
                polydraw();
            }
            if (Makeselection)
            {
                try
                {
                    if (e.Button == MouseButtons.Left)
                    {
                        Cursor = Cursors.Cross;
                        cropX  = e.X;
                        cropY  = e.Y;

                        cropPen           = new Pen(Color.Green, 5);
                        cropPen.DashStyle = DashStyle.DashDotDot;
                    }
                    PictureBox1.Refresh();
                }
                catch
                {
                    Console.WriteLine("{0} Exception caught.", e);
                }
            }
        }
Example #4
0
        public DialogResult ShowDialog(VW_BookingMinibooking mbRow, object muRow, Form assgnForm)
        {
            bkgNumbLabel.Text     = mbRow.BookingNumber;
            bkgCustomerLabel.Text = mbRow.CustomerName;
            VW_UnitSourceMiniUnit mu = (VW_UnitSourceMiniUnit)muRow;


            unitSourvceNumbLabel.Text = Conversions.ToString(mu.MiniunitNumber);
            try
            {
                unitSourceCustomLabel.Text = Conversions.ToString(mu.CustomerName);
            }
            catch
            {
                unitSourceCustomLabel.Text = Conversions.ToString(mu.CustomerName);
            }

            _muID = Conversions.ToInteger(mu.MiniUnitId);
            PictureBox1.Hide();
            changeUnitCustRadioButton.Checked = false;
            dontAsnRadioButton.Checked        = true;
            checkUnit();
            MdlLoadingSetting.showDialogForm(this, assgnForm);
            return(DialogResult);
        }
        void ofd_FileOkKMLLayer(object sender, CancelEventArgs e)
        {
            OpenFileDialog ofd = sender as OpenFileDialog;

            try
            {
                activeParcour = Importer.importFromKMLLayer(ofd.FileName);
                ParcourSet p = activeParcour;
                p.ColorPROH        = Properties.Settings.Default.PROHColor;
                p.ColorGates       = Properties.Settings.Default.SPFPColor;
                p.Alpha            = (int)Properties.Settings.Default.PROHTransp;
                p.HasCircleOnGates = Properties.Settings.Default.SPFPCircle;
                PictureBox1.SetParcour(activeParcour);
                PictureBox1.Invalidate();
                PictureBox1.Refresh();
                fldName.Text = Path.GetFileNameWithoutExtension(ofd.FileName);
            }
            catch (ApplicationException ex1)
            {
                MessageBox.Show(ex1.Message, "Parcour import from *.kml", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error while Parsing File");
            }
        }
Example #6
0
        private void PictureBox1_MouseDown_1(object sender, MouseEventArgs e)
        {
            if (TabControl1.SelectedIndex == 4)
            {
                Point TextStartLocation = e.Location;
                if (CreateText)
                {
                    Cursor = Cursors.IBeam;
                }
            }
            else
            {
                Cursor = Cursors.Default;
                if (Makeselection)
                {
                    try
                    {
                        if (e.Button == System.Windows.Forms.MouseButtons.Left)
                        {
                            Cursor = Cursors.Cross;
                            cropX  = e.X;
                            cropY  = e.Y;

                            cropPen           = new Pen(Color.Black, 1);
                            cropPen.DashStyle = DashStyle.DashDotDot;
                        }
                        PictureBox1.Refresh();
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
Example #7
0
        private void butEllipse_Click(object sender, EventArgs e)
        {
            Rectangle rect = new Rectangle(250, 200, 150, 80);

            g = PictureBox1.CreateGraphics();
            g.DrawEllipse(penBlue, rect);
        }
Example #8
0
        /// <summary>
        /// Resets this form's controls.
        /// </summary>
        private void Reset()
        {
            PictureBox1.Invoke(new MethodInvoker(delegate
            {
                PictureBox1.Visible = false;
                PictureBox2.Visible = false;
                PictureBox3.Visible = false;

                BtnChat1.Visible = false;
                BtnChat2.Visible = false;
                BtnChat3.Visible = false;

                LblName1.Visible = false;
                LblName2.Visible = false;
                LblName2.Visible = false;

                LblUsername.Visible = true;
                LblPassword.Visible = true;

                BtnLogin.Visible    = true;
                TxtUsername.Visible = true;
                TxtPassword.Visible = true;

                LblStatus.Text    = "Connecting...";
                LblStatus.Visible = false;
            }));
        }
Example #9
0
        private void UpdatePicBox()
        {
            UpdateLabel();
            var link = this.linkList[this.index];

            PictureBox1.Load(link);
        }
Example #10
0
 // click once to add a point or select a point
 private void PictureBox1_MouseDown(object sender, MouseEventArgs e)
 {
     if (!stopDraw)
     {
         if (e.Button == MouseButtons.Left)
         {
             points.Add(e.Location);
             points = points.Distinct().ToList();
         }
         if (points.Count > 2)
         {
             DrawCurve(PictureBox1.CreateGraphics());
         }
     }
     if (stopDraw)
     {
         for (int i = 0; i < points.Count; i++)
         {
             if (Math.Abs(e.Location.X - points[i].X) < 10 && Math.Abs(e.Location.Y - points[i].Y) < 10)
             {
                 selectedIndex = i;
                 changeCurve   = true;
                 return;
             }
         }
     }
 }
Example #11
0
        private void btLimpiar_Click(object sender, EventArgs e)
        {
            // Limpiar la superficie de dibujo
            Graphics g = PictureBox1.CreateGraphics();

            g.Clear(Color.White);
        }
Example #12
0
        private void btCurvas_Click(object sender, EventArgs e)
        {
            // Superficie de dibujo
            Graphics g = PictureBox1.CreateGraphics();

            // Crear lápices
            Pen lápizRojo  = new Pen(Color.Red, 3);
            Pen lápizVerde = new Pen(Color.Green, 3);

            // Puntos que definen la curva flexible cardinal
            Point[] puntos = { new Point(25, 25), new Point(50, 15), new Point(100, 5), new Point(120, 25), new Point(150, 50), new Point(220, 200), new Point(120, 120) };
            // Dibujar líneas entre los puntos
            g.DrawLines(lápizRojo, puntos);
            // Dibujar la curva
            g.DrawCurve(lápizVerde, puntos);

            // Crear lápiz
            Pen lápizNegro = new Pen(Color.Black, 3);
            // Puntos que definen la curva flexible de Bézier
            Point p1 = new Point(30, 120);
            Point p2 = new Point(150, 200);
            Point c1 = new Point(75, 10);
            Point c2 = new Point(50, 210);

            // Dibujar la curva
            g.DrawBezier(lápizNegro, p1, c1, c2, p2);
        }
Example #13
0
        private void comboBoxParcours_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListItem li = comboBoxParcours.SelectedItem as ListItem;

            if (li != null)
            {
                ParcourSet   p  = li.getParcour();
                MapSet       m  = p.MapSet;
                MemoryStream ms = new MemoryStream(m.PictureSet.Data);
                PictureBox1.Image = System.Drawing.Image.FromStream(ms);
                c = new Converter(m);
                PictureBox1.SetConverter(c);
                CurrentMap = m;
                List <Line> toDelete = p.Line.Where(pp => pp.Type == (int)LineType.START || pp.Type == (int)LineType.END).ToList();
                foreach (Line l in toDelete)
                {
                    p.Line.Remove(l);
                }
                activeParcour = p;
                PictureBox1.SetParcour(activeParcour);
                bool generatedParcour = activeParcour.Line.Count(pp => pp.Type == (int)LineType.Point) > 0;
                btnRecalc.Enabled   = generatedParcour;
                chkAutocalc.Enabled = generatedParcour;
                chkAutocalc.Checked = generatedParcour;
            }
        }
Example #14
0
 private void btnRecalc_Click(object sender, EventArgs e)
 {
     if (btnRecalc.Enabled)
     {
         btnRecalc.Enabled = false;
         try
         {
             double channel = Decimal.ToDouble(channelWide.Value);
             t          = new Timer();
             t.Tick    += new EventHandler(t_Tick);
             t.Interval = 100;
             t.Start();
             pc = new ParcourGenerator();
             lock (activeParcour)
             {
                 pc.RecalcParcour(activeParcour, c, channel);
             }
             PictureBox1.Invalidate();
         }
         catch (Exception ex)
         {
             btnRecalc.Enabled = true;
             MessageBox.Show(ex.Message, "Error while generating Parcour");
         }
     }
 }
Example #15
0
        private void PictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (Makeselection)
            {
                try
                {
                    if (PictureBox1.Image == null)
                    {
                        return;
                    }


                    if (e.Button == MouseButtons.Left)
                    {
                        PictureBox1.Refresh();
                        cropWidth  = e.X - cropX;
                        cropHeight = e.Y - cropY;
                        Graphics g = PictureBox1.CreateGraphics();

                        g.DrawRectangle(cropPen, cropX, cropY, cropWidth, cropHeight);
                    }
                }
                catch
                {
                    return;
                }
            }
        }
Example #16
0
        private void Timer1_Tick(object sender, EventArgs e)
        {
            // Obtener el objeto Graphics expuesto por PictureBox1
            Graphics g = PictureBox1.CreateGraphics();

            // Dibujar la bola en la superficie de dibujo
            g.DrawImage(mapaBits, posXBola - anchoMapaBitsBola / 2, posYBola - altoMapaBitsBola / 2, anchoMapaBitsBola, altoMapaBitsBola);
            // Liberar los recursos utilizados por el objeto Graphics
            g.Dispose();

            // Siguiente posición de la bola
            posXBola += MovXBola;
            posYBola += MovYBola;

            // Invertir la posición de la bola cuando esta toque en los
            // límites de la superficie de dibujo
            if (posXBola + radioXBola >= PictureBox1.ClientSize.Width || posXBola - radioXBola <= 0)
            {
                MovXBola = -MovXBola;
                Console.Beep(3000, 20);
            }
            if (posYBola + radioYBola >= PictureBox1.ClientSize.Height || posYBola - radioYBola <= 0)
            {
                MovYBola = -MovYBola;
                Console.Beep(4000, 20);
            }
        }
Example #17
0
        private void PictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            botonPulsado = false;
            // Borrar el cursor
            Rectangle rect = new Rectangle(e.X, 0, 1, PictureBox1.Height);

            PictureBox1.Invalidate(rect);
        }
Example #18
0
        private void button8_Click(object sender, EventArgs e)
        {
            Bitmap bmp = new Bitmap(newBitmap.Width, newBitmap.Height);

            newBitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
            PictureBox1.Image = newBitmap;
            PictureBox1.Refresh();
        }
 private void numLongO_ValueChanged(object sender, EventArgs e)
 {
     if (selectedLine != null)
     {
         (selectedLine.O as Point).longitude = Decimal.ToDouble(numLongO.Value);
         PictureBox1.Invalidate();
     }
 }
Example #20
0
 private void numLongA_ValueChanged(object sender, EventArgs e)
 {
     if (selectedPoint != null)
     {
         selectedPoint.longitude = Decimal.ToDouble(numLongA.Value);
         PictureBox1.Invalidate();
     }
 }
Example #21
0
        private void btTarta_Click(object sender, EventArgs e)
        {
            Graphics  g     = PictureBox1.CreateGraphics();
            Pen       lápiz = new Pen(Color.Black, 3);
            Rectangle rect  = new Rectangle(10, 60, 230, 90);

            g.DrawPie(lápiz, rect, 30, 150);
        }
Example #22
0
 public ParcourEdit(Client.DataAccess iClient)
 {
     Client = iClient;
     InitializeComponent();
     PictureBox1.Cursor = select;
     activeParcour      = new ParcourSet();
     PictureBox1.SetParcour(activeParcour);
 }
        //private void btnColorLayer_Click(object sender, EventArgs e)
        //{
        //    ColorDialog cd = new ColorDialog();
        //    cd.AnyColor = false;
        //    cd.SolidColorOnly = true;
        //    cd.ShowDialog();
        //    btnColorPROH.BackColor = cd.Color;
        //    ParcourSet p = activeParcour;
        //    PictureBox1.ColorPROH = cd.Color;
        //    p.ColorPROH = cd.Color;
        //    PictureBox1.SetParcour(p);
        //    PictureBox1.Invalidate();
        //}

        //private void btnColorPen_Click(object sender, EventArgs e)
        //{
        //    ColorDialog cd = new ColorDialog();
        //    cd.AnyColor = false;
        //    cd.SolidColorOnly = true;
        //    cd.ShowDialog();
        //    btnColorGates.BackColor = cd.Color;
        //    ParcourSet p = activeParcour;
        //    p.ColorGates = cd.Color;
        //    PictureBox1.ColorGates = cd.Color;
        //    PictureBox1.SetParcour(p);
        //    PictureBox1.Invalidate();
        //}

        private void checkBoxCircle_CheckedChanged(object sender, EventArgs e)
        {
            ParcourSet p = activeParcour;

            PictureBox1.HasCircleOnGates = checkBoxCircle.Checked;
            p.HasCircleOnGates           = checkBoxCircle.Checked;
            PictureBox1.SetParcour(p);
            PictureBox1.Invalidate();
        }
Example #24
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     points.Clear();
     curve.Clear();
     DrawFinalLine(PictureBox1.CreateGraphics());
     stopDraw      = false;
     changeCurve   = false;
     selectedIndex = -1;
 }
Example #25
0
 // end change curve
 private void PictureBox1_MouseUp(object sender, MouseEventArgs e)
 {
     if (stopDraw && changeCurve)
     {
         points[selectedIndex] = e.Location;
         DrawFinalLine(PictureBox1.CreateGraphics());
         changeCurve = false;
     }
 }
Example #26
0
        private void btRegiones_Click(object sender, EventArgs e)
        {
            // Superficie de dibujo
            Graphics g = PictureBox1.CreateGraphics();
            // Lápiz
            Pen lápiz = new Pen(Color.Black, 3);
            // Centro de la superficie de dibujo
            int xCentro = PictureBox1.Width / 2;
            int yCentro = PictureBox1.Height / 2;

            // Transformaciones: eje Y positivo hacia arriba y
            // origen (0,0) en el centro
            g.Transform = new Matrix(1, 0, 0, -1, xCentro, yCentro);
            // Rectángulos para tres elipses
            Rectangle rect0 = new Rectangle(-50, 0, 100, 100);
            Rectangle rect1 = new Rectangle(-7, -75, 100, 100);
            Rectangle rect2 = new Rectangle(-93, -75, 100, 100);
            // Añadimos tres elipses a un trazado
            GraphicsPath trazado = new GraphicsPath();

            trazado.AddEllipse(rect0);
            trazado.AddEllipse(rect1);
            trazado.AddEllipse(rect2);
            // Pintar el trazado
            g.FillPath(Brushes.Yellow, trazado);
            // Crear una región con el trazado
            Region región = new Region(trazado);

            //GraphicsPath trazado0 = new GraphicsPath();
            //trazado0.AddEllipse(rect0);
            //GraphicsPath trazado1 = new GraphicsPath();
            //trazado1.AddEllipse(rect1);
            //GraphicsPath trazado2 = new GraphicsPath();
            //trazado2.AddEllipse(rect2);
            //Region región = new Region(trazado0);
            //región.Xor(trazado1);
            //región.Xor(trazado2);
            //g.FillRegion(Brushes.Yellow, región);

            // Definir la región de recorte:
            // región de recorte actual intersección objeto región
            g.SetClip(región, CombineMode.Intersect);
            // Dibujar radios desde el origen, de dos en dos grados
            float PI    = 3.1415926F;
            float radio = Math.Min(xCentro, yCentro);
            float a;
            float x;
            float y;

            for (a = 0; a <= 2 * PI; a += PI / 90)
            {
                x = System.Convert.ToSingle(radio * Math.Cos(a));
                y = System.Convert.ToSingle(radio * Math.Sin(a));
                g.DrawLine(Pens.Red, 0, 0, x, y);
            }
        }
Example #27
0
 private void btLimpiar_Click(object sender, EventArgs e)
 {
     // Limpiar la superficie de dibujo
     if (g == null)
     {
         g = ObtenerObjetoGraphics();
     }
     g.Clear(Color.White);
     PictureBox1.Invalidate();
 }
 private void numericUpDownPen_ValueChanged(object sender, EventArgs e)
 {
     if (activeParcour != null)
     {
         ParcourSet p = activeParcour;
         PictureBox1.PenWidthGates = (float)numericUpDownPenGates.Value;
         PictureBox1.SetParcour(p);
         PictureBox1.Invalidate();
     }
 }
Example #29
0
        private void SetHoverPoint(PointTempExtension p, Line l)
        {
            bool change = hoverPoint != p;

            if (change)
            {
                hoverPoint = p;
                PictureBox1.SetHoverLine(l);
                PictureBox1.Invalidate();
            }
        }
Example #30
0
        private void btTrazados_Click(object sender, EventArgs e)
        {
            Graphics     g       = PictureBox1.CreateGraphics();
            GraphicsPath trazado = new GraphicsPath();
            Rectangle    rect    = new Rectangle(10, 10, 200, 100);

            trazado.AddArc(rect, 45, 135);
            trazado.AddLine(80, 100, 160, 200);
            trazado.CloseFigure();
            g.DrawPath(Pens.Blue, trazado);
        }