Configurator.Net: Added visual indication of origin for gyro/accel indicators

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1573 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
mandrolic 2011-01-29 09:07:42 +00:00
parent 4cf16f67c4
commit bb32628194
3 changed files with 34 additions and 16 deletions

View File

@ -101,7 +101,7 @@
//
// textBox1
//
this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.FlightDataVmBindingSource, "MotorLeft", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "N0"));
this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.FlightDataVmBindingSource, "MotorLeft", true));
this.textBox1.Location = new System.Drawing.Point(2, 247);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
@ -144,9 +144,9 @@
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(12, 62);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(57, 13);
this.label6.Size = new System.Drawing.Size(55, 13);
this.label6.TabIndex = 15;
this.label6.Text = "Roll Accell";
this.label6.Text = "Roll Accel";
//
// textBox4
//

View File

@ -180,7 +180,7 @@
this.linearIndicatorControl3.Offset = 0;
this.linearIndicatorControl3.Size = new System.Drawing.Size(20, 111);
this.linearIndicatorControl3.TabIndex = 43;
this.linearIndicatorControl3.Value = 1000;
this.linearIndicatorControl3.Value = 1600;
//
// linearIndicatorControl1
//
@ -199,7 +199,7 @@
this.linearIndicatorControl1.Offset = 0;
this.linearIndicatorControl1.Size = new System.Drawing.Size(20, 111);
this.linearIndicatorControl1.TabIndex = 44;
this.linearIndicatorControl1.Value = 1000;
this.linearIndicatorControl1.Value = 1100;
//
// linearIndicatorControl2
//
@ -218,7 +218,7 @@
this.linearIndicatorControl2.Offset = 0;
this.linearIndicatorControl2.Size = new System.Drawing.Size(20, 73);
this.linearIndicatorControl2.TabIndex = 45;
this.linearIndicatorControl2.Value = 1000;
this.linearIndicatorControl2.Value = 1050;
//
// linearIndicatorControl4
//
@ -237,7 +237,7 @@
this.linearIndicatorControl4.Offset = 0;
this.linearIndicatorControl4.Size = new System.Drawing.Size(20, 73);
this.linearIndicatorControl4.TabIndex = 46;
this.linearIndicatorControl4.Value = 1000;
this.linearIndicatorControl4.Value = 1900;
//
// linearIndicatorControl5
//
@ -256,7 +256,7 @@
this.linearIndicatorControl5.Offset = 0;
this.linearIndicatorControl5.Size = new System.Drawing.Size(100, 20);
this.linearIndicatorControl5.TabIndex = 47;
this.linearIndicatorControl5.Value = 1000;
this.linearIndicatorControl5.Value = 1300;
//
// linearIndicatorControl6
//
@ -275,7 +275,7 @@
this.linearIndicatorControl6.Offset = 0;
this.linearIndicatorControl6.Size = new System.Drawing.Size(100, 20);
this.linearIndicatorControl6.TabIndex = 48;
this.linearIndicatorControl6.Value = 1000;
this.linearIndicatorControl6.Value = 1200;
//
// TransmitterChannelsView
//

View File

@ -127,13 +127,7 @@ namespace ArducopterConfigurator.Views.controls
using (var white = new LinearGradientBrush(rect, _barBgLightColour, _barBgDarkColor, isVertical ? 0 : 90.0F, false))
g.FillRectangle(white, rect);
// Border around the whole thing
using (Pen p = new Pen(_borderColor, _borderWidth * 2))
{
p.Alignment = PenAlignment.Outset;
p.LineJoin = LineJoin.Round;
g.DrawRectangle(p, x, y, width, height);
}
// Now do the progress bar that represents the value
var barSize = (float)Math.Abs(_val - _offset) / (_max - _min) * (isVertical ? height : width);
@ -149,6 +143,8 @@ namespace ArducopterConfigurator.Views.controls
using (var bg = new LinearGradientBrush(rect, _barLightColour, _barDarkColour, isVertical ? 0 : 90.0F, false))
g.FillRectangle(bg, rect);
using (Pen p = new Pen(_borderColor, _borderWidth))
{
p.Alignment = PenAlignment.Inset;
@ -157,6 +153,28 @@ namespace ArducopterConfigurator.Views.controls
}
}
// Now the line that represents the Offset/Origin
if (_offset > _min && _offset < _max)
using (Pen p = new Pen(_borderColor, _borderWidth))
{
var linePos = (float)(_offset - _min) / (_max - _min) * (isVertical ? height : width);
if (isVertical)
g.DrawLine(p, 0, linePos, width, linePos);
else
g.DrawLine(p, linePos, 0, linePos, height);
}
// Border around the whole thing
using (Pen p = new Pen(_borderColor, _borderWidth * 2))
{
p.Alignment = PenAlignment.Outset;
p.LineJoin = LineJoin.Round;
g.DrawRectangle(p, x, y, width, height);
}
// using (Pen p = new Pen(_barDarkColour, _borderWidth))
// {
// p.Alignment = PenAlignment.Inset;