ardupilot/Tools/ArdupilotMegaPlanner/Controls/LabelWithPseudoOpacity.cs
Michael Oborne 8bebf0c394 APM Planner 1.1.99
Convert to IActivate, IDeactivate scheme, thanks andrew
add support for rfcomm* interfaces on linux
fix guage off screen draw mono issue.
remove use of BackStageViewContentPanel
andrews spacer changes - not using dues to screen space issue
change configpanel constructor to load xml directly
remove IMavlink Interface
fix hsi off screen draw issue on mono
modify hud to use sprite fonts, instead of drawing via GDI+
modify progress reporter to use a 10hz timer to update screen, using invoke/begininvoke fails on mono at 50hz (over 100ms per call).
fix targetalt and target airspeed jumping issue.
lots of cleanup on tab switching, ie stoping timers/other
3dr radio status led update
update ardurover car icon
speedup georef image screen. tested on over 1000 images.
2012-07-22 15:51:05 +08:00

48 lines
1.4 KiB
C#

using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace ArdupilotMega.Controls
{
/// <summary>
/// Label which uses a painting trick to simulate opacity
/// </summary>
/// <remarks>
/// On Paint will put a rectangle with the same color as the background overtop
/// of the imapge. The Alpha of the rectangle's color is adjusted according to the
/// (new) Opacity property.
/// For this to appear as translucency, the background property must be set to the
/// same color as the background of the form.
/// </remarks>
public class LabelWithPseudoOpacity : Label
{
private float _opacity = 1.0F;
/// <summary>
/// The (simulated) Opacity. 0 is fully transparent, 1.0 is normal
/// </summary>
[Description("(Simulated) Opacity of the image"), Category("Appearance")]
[DefaultValue(typeof(float), "1.0")]
public float Opacity
{
get { return _opacity; }
set
{
if (_opacity == value)
return;
if (value > 1.0F || value < 0.0F)
throw new ArgumentOutOfRangeException();
_opacity = value;
Invalidate();
}
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
this.CoverWithRect(pe.Graphics, Opacity);
}
}
}