public void DrawItem(Radar radar, Graphics g) { PointF cp = radar.AzEl2XY(_azimuth, _elevation); PointF _topLeft = new PointF(cp.X - ((float)_width / 2), cp.Y - ((float)_height / 2)); PointF p1 = new PointF(((float)_topLeft.X + ((float)_width / 2F)), (float)_topLeft.Y); PointF p2 = new PointF((float)_topLeft.X, (float)_topLeft.Y + (float)_height); PointF p3 = new PointF((float)_topLeft.X + (float)_width, (float)_topLeft.Y + (float)_height); _gp = new GraphicsPath(FillMode.Winding); _gp.AddPolygon(new PointF[] { p1, p2, p3 }); g.FillPath(new SolidBrush(radar.CustomLineColor), _gp); }
public void DrawItem(Radar radar, Graphics g) { PointF cp = radar.AzEl2XY(_azimuth, _elevation); PointF topLeft = new PointF(cp.X - ((float)_width / 2), cp.Y - ((float)_height / 2)); g.FillEllipse(new SolidBrush(radar.CustomLineColor), new RectangleF(topLeft, new SizeF((float)_width, (float)_height))); }
/// <summary> Populate the form's controls with default settings. </summary> private void InitializeControlValues() { cmbParity.Items.Clear(); cmbParity.Items.AddRange(Enum.GetNames(typeof(Parity))); cmbStopBits.Items.Clear(); cmbStopBits.Items.AddRange(Enum.GetNames(typeof(StopBits))); cmbParity.Text = Settings.Default.Parity.ToString(); cmbStopBits.Text = Settings.Default.StopBits.ToString(); cmbDataBits.Text = Settings.Default.DataBits.ToString(); cmbParity.Text = Settings.Default.Parity.ToString(); cmbBaudRate.Text = Settings.Default.BaudRate.ToString(); CurrentDataMode = Settings.Default.DataMode; cmbPortName.Items.Clear(); cmbPortName.Items.AddRange(SerialPort.GetPortNames()); if (cmbPortName.Items.Contains(Settings.Default.PortName)) cmbPortName.Text = Settings.Default.PortName; else if (cmbPortName.Items.Count > 0) cmbPortName.SelectedIndex = 0; else { MessageBox.Show(this, "There are no COM Ports detected on this computer.\nPlease install a COM Port and restart this app.", "No COM Ports Installed", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } radar = new Radar(pbRadar.Width); pbRadar.Image = radar.Image; radar.ImageUpdate += radar_ImageUpdate; radar.DrawScanInterval = 60; radar.DrawScanLine = true; }