Configurator.Net: Transmitter Calibration - Max/Min watermarks for indicator controls

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1580 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
mandrolic 2011-01-30 21:49:14 +00:00
parent ff5ce694a2
commit caeee35fce
3 changed files with 127 additions and 68 deletions

View File

@ -259,12 +259,15 @@
this.indicatorRollGyro.IsVertical = false; this.indicatorRollGyro.IsVertical = false;
this.indicatorRollGyro.Location = new System.Drawing.Point(12, 28); this.indicatorRollGyro.Location = new System.Drawing.Point(12, 28);
this.indicatorRollGyro.Max = 500; this.indicatorRollGyro.Max = 500;
this.indicatorRollGyro.MaxWaterMark = 0;
this.indicatorRollGyro.Min = -500; this.indicatorRollGyro.Min = -500;
this.indicatorRollGyro.MinWatermark = 0;
this.indicatorRollGyro.Name = "indicatorRollGyro"; this.indicatorRollGyro.Name = "indicatorRollGyro";
this.indicatorRollGyro.Offset = 0; this.indicatorRollGyro.Offset = 0;
this.indicatorRollGyro.Size = new System.Drawing.Size(109, 20); this.indicatorRollGyro.Size = new System.Drawing.Size(109, 20);
this.indicatorRollGyro.TabIndex = 32; this.indicatorRollGyro.TabIndex = 32;
this.indicatorRollGyro.Value = 100; this.indicatorRollGyro.Value = 100;
this.indicatorRollGyro.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// indicatorRollAccel // indicatorRollAccel
// //
@ -278,12 +281,15 @@
this.indicatorRollAccel.IsVertical = false; this.indicatorRollAccel.IsVertical = false;
this.indicatorRollAccel.Location = new System.Drawing.Point(12, 78); this.indicatorRollAccel.Location = new System.Drawing.Point(12, 78);
this.indicatorRollAccel.Max = 500; this.indicatorRollAccel.Max = 500;
this.indicatorRollAccel.MaxWaterMark = 0;
this.indicatorRollAccel.Min = -500; this.indicatorRollAccel.Min = -500;
this.indicatorRollAccel.MinWatermark = 0;
this.indicatorRollAccel.Name = "indicatorRollAccel"; this.indicatorRollAccel.Name = "indicatorRollAccel";
this.indicatorRollAccel.Offset = 0; this.indicatorRollAccel.Offset = 0;
this.indicatorRollAccel.Size = new System.Drawing.Size(109, 20); this.indicatorRollAccel.Size = new System.Drawing.Size(109, 20);
this.indicatorRollAccel.TabIndex = 33; this.indicatorRollAccel.TabIndex = 33;
this.indicatorRollAccel.Value = 100; this.indicatorRollAccel.Value = 100;
this.indicatorRollAccel.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl1 // linearIndicatorControl1
// //
@ -297,12 +303,15 @@
this.linearIndicatorControl1.IsVertical = true; this.linearIndicatorControl1.IsVertical = true;
this.linearIndicatorControl1.Location = new System.Drawing.Point(199, 21); this.linearIndicatorControl1.Location = new System.Drawing.Point(199, 21);
this.linearIndicatorControl1.Max = 500; this.linearIndicatorControl1.Max = 500;
this.linearIndicatorControl1.MaxWaterMark = 0;
this.linearIndicatorControl1.Min = -500; this.linearIndicatorControl1.Min = -500;
this.linearIndicatorControl1.MinWatermark = 0;
this.linearIndicatorControl1.Name = "linearIndicatorControl1"; this.linearIndicatorControl1.Name = "linearIndicatorControl1";
this.linearIndicatorControl1.Offset = 0; this.linearIndicatorControl1.Offset = 0;
this.linearIndicatorControl1.Size = new System.Drawing.Size(20, 82); this.linearIndicatorControl1.Size = new System.Drawing.Size(20, 82);
this.linearIndicatorControl1.TabIndex = 34; this.linearIndicatorControl1.TabIndex = 34;
this.linearIndicatorControl1.Value = 100; this.linearIndicatorControl1.Value = 100;
this.linearIndicatorControl1.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl2 // linearIndicatorControl2
// //
@ -316,12 +325,15 @@
this.linearIndicatorControl2.IsVertical = true; this.linearIndicatorControl2.IsVertical = true;
this.linearIndicatorControl2.Location = new System.Drawing.Point(264, 21); this.linearIndicatorControl2.Location = new System.Drawing.Point(264, 21);
this.linearIndicatorControl2.Max = 500; this.linearIndicatorControl2.Max = 500;
this.linearIndicatorControl2.MaxWaterMark = 0;
this.linearIndicatorControl2.Min = -500; this.linearIndicatorControl2.Min = -500;
this.linearIndicatorControl2.MinWatermark = 0;
this.linearIndicatorControl2.Name = "linearIndicatorControl2"; this.linearIndicatorControl2.Name = "linearIndicatorControl2";
this.linearIndicatorControl2.Offset = 0; this.linearIndicatorControl2.Offset = 0;
this.linearIndicatorControl2.Size = new System.Drawing.Size(20, 82); this.linearIndicatorControl2.Size = new System.Drawing.Size(20, 82);
this.linearIndicatorControl2.TabIndex = 35; this.linearIndicatorControl2.TabIndex = 35;
this.linearIndicatorControl2.Value = 100; this.linearIndicatorControl2.Value = 100;
this.linearIndicatorControl2.WatermarkLineColor = System.Drawing.Color.Red;
// //
// linearIndicatorControl3 // linearIndicatorControl3
// //
@ -334,13 +346,16 @@
this.linearIndicatorControl3.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.FlightDataVmBindingSource, "MotorLeft", true)); this.linearIndicatorControl3.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.FlightDataVmBindingSource, "MotorLeft", true));
this.linearIndicatorControl3.IsVertical = true; this.linearIndicatorControl3.IsVertical = true;
this.linearIndicatorControl3.Location = new System.Drawing.Point(15, 157); this.linearIndicatorControl3.Location = new System.Drawing.Point(15, 157);
this.linearIndicatorControl3.Max = 1000; this.linearIndicatorControl3.Max = 2000;
this.linearIndicatorControl3.Min = 0; this.linearIndicatorControl3.MaxWaterMark = 0;
this.linearIndicatorControl3.Min = 1000;
this.linearIndicatorControl3.MinWatermark = 0;
this.linearIndicatorControl3.Name = "linearIndicatorControl3"; this.linearIndicatorControl3.Name = "linearIndicatorControl3";
this.linearIndicatorControl3.Offset = 0; this.linearIndicatorControl3.Offset = 0;
this.linearIndicatorControl3.Size = new System.Drawing.Size(20, 84); this.linearIndicatorControl3.Size = new System.Drawing.Size(20, 84);
this.linearIndicatorControl3.TabIndex = 36; this.linearIndicatorControl3.TabIndex = 36;
this.linearIndicatorControl3.Value = 100; this.linearIndicatorControl3.Value = 100;
this.linearIndicatorControl3.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl4 // linearIndicatorControl4
// //
@ -353,13 +368,16 @@
this.linearIndicatorControl4.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.FlightDataVmBindingSource, "MotorFront", true)); this.linearIndicatorControl4.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.FlightDataVmBindingSource, "MotorFront", true));
this.linearIndicatorControl4.IsVertical = true; this.linearIndicatorControl4.IsVertical = true;
this.linearIndicatorControl4.Location = new System.Drawing.Point(71, 157); this.linearIndicatorControl4.Location = new System.Drawing.Point(71, 157);
this.linearIndicatorControl4.Max = 1000; this.linearIndicatorControl4.Max = 2000;
this.linearIndicatorControl4.Min = 0; this.linearIndicatorControl4.MaxWaterMark = 0;
this.linearIndicatorControl4.Min = 1000;
this.linearIndicatorControl4.MinWatermark = 0;
this.linearIndicatorControl4.Name = "linearIndicatorControl4"; this.linearIndicatorControl4.Name = "linearIndicatorControl4";
this.linearIndicatorControl4.Offset = 0; this.linearIndicatorControl4.Offset = 0;
this.linearIndicatorControl4.Size = new System.Drawing.Size(20, 84); this.linearIndicatorControl4.Size = new System.Drawing.Size(20, 84);
this.linearIndicatorControl4.TabIndex = 37; this.linearIndicatorControl4.TabIndex = 37;
this.linearIndicatorControl4.Value = 100; this.linearIndicatorControl4.Value = 100;
this.linearIndicatorControl4.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl5 // linearIndicatorControl5
// //
@ -372,13 +390,16 @@
this.linearIndicatorControl5.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.FlightDataVmBindingSource, "MotorRear", true)); this.linearIndicatorControl5.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.FlightDataVmBindingSource, "MotorRear", true));
this.linearIndicatorControl5.IsVertical = true; this.linearIndicatorControl5.IsVertical = true;
this.linearIndicatorControl5.Location = new System.Drawing.Point(124, 157); this.linearIndicatorControl5.Location = new System.Drawing.Point(124, 157);
this.linearIndicatorControl5.Max = 1000; this.linearIndicatorControl5.Max = 2000;
this.linearIndicatorControl5.Min = 0; this.linearIndicatorControl5.MaxWaterMark = 0;
this.linearIndicatorControl5.Min = 1000;
this.linearIndicatorControl5.MinWatermark = 0;
this.linearIndicatorControl5.Name = "linearIndicatorControl5"; this.linearIndicatorControl5.Name = "linearIndicatorControl5";
this.linearIndicatorControl5.Offset = 0; this.linearIndicatorControl5.Offset = 0;
this.linearIndicatorControl5.Size = new System.Drawing.Size(20, 84); this.linearIndicatorControl5.Size = new System.Drawing.Size(20, 84);
this.linearIndicatorControl5.TabIndex = 38; this.linearIndicatorControl5.TabIndex = 38;
this.linearIndicatorControl5.Value = 100; this.linearIndicatorControl5.Value = 100;
this.linearIndicatorControl5.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl6 // linearIndicatorControl6
// //
@ -391,13 +412,16 @@
this.linearIndicatorControl6.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.FlightDataVmBindingSource, "MotorRear", true)); this.linearIndicatorControl6.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.FlightDataVmBindingSource, "MotorRear", true));
this.linearIndicatorControl6.IsVertical = true; this.linearIndicatorControl6.IsVertical = true;
this.linearIndicatorControl6.Location = new System.Drawing.Point(179, 157); this.linearIndicatorControl6.Location = new System.Drawing.Point(179, 157);
this.linearIndicatorControl6.Max = 1000; this.linearIndicatorControl6.Max = 2000;
this.linearIndicatorControl6.Min = 0; this.linearIndicatorControl6.MaxWaterMark = 0;
this.linearIndicatorControl6.Min = 1000;
this.linearIndicatorControl6.MinWatermark = 0;
this.linearIndicatorControl6.Name = "linearIndicatorControl6"; this.linearIndicatorControl6.Name = "linearIndicatorControl6";
this.linearIndicatorControl6.Offset = 0; this.linearIndicatorControl6.Offset = 0;
this.linearIndicatorControl6.Size = new System.Drawing.Size(20, 84); this.linearIndicatorControl6.Size = new System.Drawing.Size(20, 84);
this.linearIndicatorControl6.TabIndex = 39; this.linearIndicatorControl6.TabIndex = 39;
this.linearIndicatorControl6.Value = 100; this.linearIndicatorControl6.Value = 100;
this.linearIndicatorControl6.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl7 // linearIndicatorControl7
// //
@ -411,12 +435,15 @@
this.linearIndicatorControl7.IsVertical = false; this.linearIndicatorControl7.IsVertical = false;
this.linearIndicatorControl7.Location = new System.Drawing.Point(225, 157); this.linearIndicatorControl7.Location = new System.Drawing.Point(225, 157);
this.linearIndicatorControl7.Max = 500; this.linearIndicatorControl7.Max = 500;
this.linearIndicatorControl7.MaxWaterMark = 0;
this.linearIndicatorControl7.Min = -500; this.linearIndicatorControl7.Min = -500;
this.linearIndicatorControl7.MinWatermark = 0;
this.linearIndicatorControl7.Name = "linearIndicatorControl7"; this.linearIndicatorControl7.Name = "linearIndicatorControl7";
this.linearIndicatorControl7.Offset = 0; this.linearIndicatorControl7.Offset = 0;
this.linearIndicatorControl7.Size = new System.Drawing.Size(109, 20); this.linearIndicatorControl7.Size = new System.Drawing.Size(109, 20);
this.linearIndicatorControl7.TabIndex = 40; this.linearIndicatorControl7.TabIndex = 40;
this.linearIndicatorControl7.Value = 100; this.linearIndicatorControl7.Value = 100;
this.linearIndicatorControl7.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl8 // linearIndicatorControl8
// //
@ -430,12 +457,15 @@
this.linearIndicatorControl8.IsVertical = true; this.linearIndicatorControl8.IsVertical = true;
this.linearIndicatorControl8.Location = new System.Drawing.Point(353, 21); this.linearIndicatorControl8.Location = new System.Drawing.Point(353, 21);
this.linearIndicatorControl8.Max = 500; this.linearIndicatorControl8.Max = 500;
this.linearIndicatorControl8.MaxWaterMark = 0;
this.linearIndicatorControl8.Min = -500; this.linearIndicatorControl8.Min = -500;
this.linearIndicatorControl8.MinWatermark = 0;
this.linearIndicatorControl8.Name = "linearIndicatorControl8"; this.linearIndicatorControl8.Name = "linearIndicatorControl8";
this.linearIndicatorControl8.Offset = 0; this.linearIndicatorControl8.Offset = 0;
this.linearIndicatorControl8.Size = new System.Drawing.Size(20, 82); this.linearIndicatorControl8.Size = new System.Drawing.Size(20, 82);
this.linearIndicatorControl8.TabIndex = 41; this.linearIndicatorControl8.TabIndex = 41;
this.linearIndicatorControl8.Value = 100; this.linearIndicatorControl8.Value = 100;
this.linearIndicatorControl8.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// FlightDataView // FlightDataView
// //

View File

@ -175,12 +175,15 @@
this.linearIndicatorControl3.IsVertical = true; this.linearIndicatorControl3.IsVertical = true;
this.linearIndicatorControl3.Location = new System.Drawing.Point(16, 30); this.linearIndicatorControl3.Location = new System.Drawing.Point(16, 30);
this.linearIndicatorControl3.Max = 2000; this.linearIndicatorControl3.Max = 2000;
this.linearIndicatorControl3.MaxWaterMark = 0;
this.linearIndicatorControl3.Min = 1000; this.linearIndicatorControl3.Min = 1000;
this.linearIndicatorControl3.MinWatermark = 0;
this.linearIndicatorControl3.Name = "linearIndicatorControl3"; this.linearIndicatorControl3.Name = "linearIndicatorControl3";
this.linearIndicatorControl3.Offset = 0; this.linearIndicatorControl3.Offset = 0;
this.linearIndicatorControl3.Size = new System.Drawing.Size(20, 111); this.linearIndicatorControl3.Size = new System.Drawing.Size(20, 111);
this.linearIndicatorControl3.TabIndex = 43; this.linearIndicatorControl3.TabIndex = 43;
this.linearIndicatorControl3.Value = 1600; this.linearIndicatorControl3.Value = 1600;
this.linearIndicatorControl3.WatermarkLineColor = System.Drawing.Color.Red;
// //
// linearIndicatorControl1 // linearIndicatorControl1
// //
@ -194,12 +197,15 @@
this.linearIndicatorControl1.IsVertical = true; this.linearIndicatorControl1.IsVertical = true;
this.linearIndicatorControl1.Location = new System.Drawing.Point(67, 30); this.linearIndicatorControl1.Location = new System.Drawing.Point(67, 30);
this.linearIndicatorControl1.Max = 2000; this.linearIndicatorControl1.Max = 2000;
this.linearIndicatorControl1.MaxWaterMark = 0;
this.linearIndicatorControl1.Min = 1000; this.linearIndicatorControl1.Min = 1000;
this.linearIndicatorControl1.MinWatermark = 0;
this.linearIndicatorControl1.Name = "linearIndicatorControl1"; this.linearIndicatorControl1.Name = "linearIndicatorControl1";
this.linearIndicatorControl1.Offset = 0; this.linearIndicatorControl1.Offset = 0;
this.linearIndicatorControl1.Size = new System.Drawing.Size(20, 111); this.linearIndicatorControl1.Size = new System.Drawing.Size(20, 111);
this.linearIndicatorControl1.TabIndex = 44; this.linearIndicatorControl1.TabIndex = 44;
this.linearIndicatorControl1.Value = 1100; this.linearIndicatorControl1.Value = 1100;
this.linearIndicatorControl1.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl2 // linearIndicatorControl2
// //
@ -213,12 +219,15 @@
this.linearIndicatorControl2.IsVertical = true; this.linearIndicatorControl2.IsVertical = true;
this.linearIndicatorControl2.Location = new System.Drawing.Point(155, 131); this.linearIndicatorControl2.Location = new System.Drawing.Point(155, 131);
this.linearIndicatorControl2.Max = 2000; this.linearIndicatorControl2.Max = 2000;
this.linearIndicatorControl2.MaxWaterMark = 0;
this.linearIndicatorControl2.Min = 1000; this.linearIndicatorControl2.Min = 1000;
this.linearIndicatorControl2.MinWatermark = 0;
this.linearIndicatorControl2.Name = "linearIndicatorControl2"; this.linearIndicatorControl2.Name = "linearIndicatorControl2";
this.linearIndicatorControl2.Offset = 0; this.linearIndicatorControl2.Offset = 0;
this.linearIndicatorControl2.Size = new System.Drawing.Size(20, 73); this.linearIndicatorControl2.Size = new System.Drawing.Size(20, 73);
this.linearIndicatorControl2.TabIndex = 45; this.linearIndicatorControl2.TabIndex = 45;
this.linearIndicatorControl2.Value = 1050; this.linearIndicatorControl2.Value = 1050;
this.linearIndicatorControl2.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl4 // linearIndicatorControl4
// //
@ -232,12 +241,15 @@
this.linearIndicatorControl4.IsVertical = true; this.linearIndicatorControl4.IsVertical = true;
this.linearIndicatorControl4.Location = new System.Drawing.Point(206, 131); this.linearIndicatorControl4.Location = new System.Drawing.Point(206, 131);
this.linearIndicatorControl4.Max = 2000; this.linearIndicatorControl4.Max = 2000;
this.linearIndicatorControl4.MaxWaterMark = 0;
this.linearIndicatorControl4.Min = 1000; this.linearIndicatorControl4.Min = 1000;
this.linearIndicatorControl4.MinWatermark = 0;
this.linearIndicatorControl4.Name = "linearIndicatorControl4"; this.linearIndicatorControl4.Name = "linearIndicatorControl4";
this.linearIndicatorControl4.Offset = 0; this.linearIndicatorControl4.Offset = 0;
this.linearIndicatorControl4.Size = new System.Drawing.Size(20, 73); this.linearIndicatorControl4.Size = new System.Drawing.Size(20, 73);
this.linearIndicatorControl4.TabIndex = 46; this.linearIndicatorControl4.TabIndex = 46;
this.linearIndicatorControl4.Value = 1900; this.linearIndicatorControl4.Value = 1900;
this.linearIndicatorControl4.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl5 // linearIndicatorControl5
// //
@ -251,12 +263,15 @@
this.linearIndicatorControl5.IsVertical = false; this.linearIndicatorControl5.IsVertical = false;
this.linearIndicatorControl5.Location = new System.Drawing.Point(174, 80); this.linearIndicatorControl5.Location = new System.Drawing.Point(174, 80);
this.linearIndicatorControl5.Max = 2000; this.linearIndicatorControl5.Max = 2000;
this.linearIndicatorControl5.MaxWaterMark = 0;
this.linearIndicatorControl5.Min = 1000; this.linearIndicatorControl5.Min = 1000;
this.linearIndicatorControl5.MinWatermark = 0;
this.linearIndicatorControl5.Name = "linearIndicatorControl5"; this.linearIndicatorControl5.Name = "linearIndicatorControl5";
this.linearIndicatorControl5.Offset = 0; this.linearIndicatorControl5.Offset = 0;
this.linearIndicatorControl5.Size = new System.Drawing.Size(100, 20); this.linearIndicatorControl5.Size = new System.Drawing.Size(100, 20);
this.linearIndicatorControl5.TabIndex = 47; this.linearIndicatorControl5.TabIndex = 47;
this.linearIndicatorControl5.Value = 1300; this.linearIndicatorControl5.Value = 1300;
this.linearIndicatorControl5.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// linearIndicatorControl6 // linearIndicatorControl6
// //
@ -270,12 +285,15 @@
this.linearIndicatorControl6.IsVertical = false; this.linearIndicatorControl6.IsVertical = false;
this.linearIndicatorControl6.Location = new System.Drawing.Point(174, 30); this.linearIndicatorControl6.Location = new System.Drawing.Point(174, 30);
this.linearIndicatorControl6.Max = 2000; this.linearIndicatorControl6.Max = 2000;
this.linearIndicatorControl6.MaxWaterMark = 0;
this.linearIndicatorControl6.Min = 1000; this.linearIndicatorControl6.Min = 1000;
this.linearIndicatorControl6.MinWatermark = 0;
this.linearIndicatorControl6.Name = "linearIndicatorControl6"; this.linearIndicatorControl6.Name = "linearIndicatorControl6";
this.linearIndicatorControl6.Offset = 0; this.linearIndicatorControl6.Offset = 0;
this.linearIndicatorControl6.Size = new System.Drawing.Size(100, 20); this.linearIndicatorControl6.Size = new System.Drawing.Size(100, 20);
this.linearIndicatorControl6.TabIndex = 48; this.linearIndicatorControl6.TabIndex = 48;
this.linearIndicatorControl6.Value = 1200; this.linearIndicatorControl6.Value = 1200;
this.linearIndicatorControl6.WatermarkLineColor = System.Drawing.Color.DarkGray;
// //
// TransmitterChannelsView // TransmitterChannelsView
// //

View File

@ -1,12 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Data;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
/* /*
@ -21,55 +15,19 @@ namespace ArducopterConfigurator.Views.controls
[ToolboxBitmap(typeof(System.Windows.Forms.ProgressBar))] [ToolboxBitmap(typeof(System.Windows.Forms.ProgressBar))]
public partial class LinearIndicatorControl : UserControl public partial class LinearIndicatorControl : UserControl
{ {
/// <summary>
/// This enum represents the diffrent states the control can take.
/// Animation for ex. makes the procent bar "Rubber band" to the new procent value
/// </summary>
public enum BarType
{
Static, // Plain and simple bar with procent display
Progressbar, // This makes the control act as a progressbar
Animated // This makes the control "Rubber band" to new procent values (Animated).
};
#region Static Members
public static readonly Color PreBarBaseDark = Color.FromArgb(199, 200, 201); public static readonly Color PreBarBaseDark = Color.FromArgb(199, 200, 201);
public static readonly Color PreBarBaseLight = Color.WhiteSmoke; public static readonly Color PreBarBaseLight = Color.WhiteSmoke;
public static readonly Color PreBarLight = Color.FromArgb(102, 144, 252); public static readonly Color PreBarLight = Color.FromArgb(102, 144, 252);
public static readonly Color PreBarDark = Color.FromArgb(40, 68, 202); public static readonly Color PreBarDark = Color.FromArgb(40, 68, 202);
public static readonly Color PreBorderColor = Color.DarkGray; public static readonly Color PreBorderColor = Color.DarkGray;
#endregion
#region Private Members
/// <summary>
/// The Light background color
/// </summary>
private Color _barBgLightColour = PreBarBaseLight; private Color _barBgLightColour = PreBarBaseLight;
/// <summary>
/// The Dark background color
/// </summary>
private Color _barBgDarkColor = PreBarBaseDark; private Color _barBgDarkColor = PreBarBaseDark;
/// <summary>
/// The Light bar color
/// </summary>
private Color _barLightColour = PreBarLight; private Color _barLightColour = PreBarLight;
/// <summary>
/// The Dark bar color
/// </summary>
private Color _barDarkColour = PreBarDark; private Color _barDarkColour = PreBarDark;
/// <summary>
/// The Border color for the control
/// </summary>
private Color _borderColor = PreBorderColor; private Color _borderColor = PreBorderColor;
private Color _watermarkLineColor = PreBorderColor;
/// <summary>
/// The border width
/// </summary>
private float _borderWidth = 1.0F; private float _borderWidth = 1.0F;
private int _min = 0; private int _min = 0;
@ -77,14 +35,12 @@ namespace ArducopterConfigurator.Views.controls
private int _val = 50; private int _val = 50;
private int _offset = 0; private int _offset = 0;
/// <summary>
/// The number of dividers to draw in the bar
/// </summary>
private int iNumDividers = 10; private int iNumDividers = 10;
private bool _isVertical = false; private bool _isVertical = false;
private int _minWatermark;
private int _maxWatermark;
#endregion
public LinearIndicatorControl() public LinearIndicatorControl()
@ -119,8 +75,6 @@ namespace ArducopterConfigurator.Views.controls
// g is the graphics of the whole control // g is the graphics of the whole control
private void GenerateBar(Graphics g, float x, float y, float width, float height, bool isVertical) private void GenerateBar(Graphics g, float x, float y, float width, float height, bool isVertical)
{ {
float totalWidth = width;
var rect = new RectangleF(x, y, width, height); var rect = new RectangleF(x, y, width, height);
// Fill the background // Fill the background
@ -155,16 +109,14 @@ namespace ArducopterConfigurator.Views.controls
// Now the line that represents the Offset/Origin // Now the line that represents the Offset/Origin
if (_offset > _min && _offset < _max) DrawLine(width, height, isVertical, g, _offset,_borderColor);
using (Pen p = new Pen(_borderColor, _borderWidth))
{
var linePos = (float)(_offset - _min) / (_max - _min) * (isVertical ? height : width);
if (isVertical) // Draw the high/low watermarks
g.DrawLine(p, 0, linePos, width, linePos); if (_minWatermark!=_offset)
else DrawLine(width, height, isVertical, g, _minWatermark, _watermarkLineColor);
g.DrawLine(p, linePos, 0, linePos, height);
} if (_maxWatermark!=_offset)
DrawLine(width, height, isVertical, g, _maxWatermark, _watermarkLineColor);
// Border around the whole thing // Border around the whole thing
@ -202,6 +154,20 @@ namespace ArducopterConfigurator.Views.controls
// } // }
} }
private void DrawLine(float width, float height, bool isVertical, Graphics g, int position, Color color)
{
if (position > _min && _offset < _max)
using (Pen p = new Pen(color, _borderWidth))
{
var linePos = (float)(position - _min) / (_max - _min) * (isVertical ? height : width);
if (isVertical)
g.DrawLine(p, 0 ,height - linePos, width, height - linePos);
else
g.DrawLine(p, linePos, 0, linePos, height);
}
}
private Bitmap GenerateProcentBarBitmap(int width, int height,Color bgColor) private Bitmap GenerateProcentBarBitmap(int width, int height,Color bgColor)
{ {
@ -310,7 +276,7 @@ namespace ArducopterConfigurator.Views.controls
/// Gets or sets the color of the border. /// Gets or sets the color of the border.
/// </summary> /// </summary>
/// <value>The color of the border.</value> /// <value>The color of the border.</value>
[System.ComponentModel.Description("Gets or sets the border color")] [System.ComponentModel.Description("The border color")]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)] [System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
public Color BarBorderColor public Color BarBorderColor
{ {
@ -318,6 +284,18 @@ namespace ArducopterConfigurator.Views.controls
set { _borderColor = value; Refresh(); } set { _borderColor = value; Refresh(); }
} }
/// <summary>
/// Gets or sets the color of the border.
/// </summary>
/// <value>The color of the border.</value>
[System.ComponentModel.Description("The color for the watermark lines")]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
public Color WatermarkLineColor
{
get { return _watermarkLineColor; }
set { _watermarkLineColor = value; Refresh(); }
}
[System.ComponentModel.Description("Gets or sets the Minimum Value")] [System.ComponentModel.Description("Gets or sets the Minimum Value")]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)] [System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
@ -360,6 +338,39 @@ namespace ArducopterConfigurator.Views.controls
} }
} }
[System.ComponentModel.Description("The position of the Max watermark line. Set to Offset if not needed")]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
public int MaxWaterMark
{
get { return _maxWatermark; }
set
{
if (_maxWatermark != value)
{
_maxWatermark = value;
Refresh();
}
}
}
[System.ComponentModel.Description("The position of the Min watermark line. Set to Offset if not needed")]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
public int MinWatermark
{
get { return _minWatermark; }
set
{
if (_minWatermark != value)
{
_minWatermark = value;
Refresh();
}
}
}
[System.ComponentModel.Description("Gets or sets whether the indicator is vertical")] [System.ComponentModel.Description("Gets or sets whether the indicator is vertical")]
[System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)] [System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.Repaint)]
public bool IsVertical public bool IsVertical