public LBAnalogMeter()
        {
            // Initialization
            InitializeComponent();

            // Properties initialization
            this.bodyColor         = Color.Red;
            this.needleColor       = Color.Yellow;
            this.scaleColor        = Color.White;
            this.meterStyle        = AnalogMeterStyle.Circular;
            this.viewGlass         = false;
            this.startAngle        = 225;
            this.endAngle          = 315;
            this.minValue          = 0;
            this.maxValue          = 1000;
            this.currValue         = 0;
            this.scaleDivisions    = 10;
            this.scaleSubDivisions = 10;
            this.renderer          = null;

            // Set the styles for drawing
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);

            // Create the default renderer
            this.defaultRenderer             = new LBDefaultAnalogMeterRenderer();
            this.defaultRenderer.AnalogMeter = this;
        }
Beispiel #2
0
        public LBAnalogMeter()
        {
            // Initialization
            InitializeComponent();

            // Properties initialization
            this.bodyColor         = Color.Red;
            this.needleColor       = Color.Yellow;
            this.scaleColor        = Color.White;
            this.meterStyle        = AnalogMeterStyle.Circular;
            this.viewGlass         = true;
            this.startAngle        = 135;
            this.endAngle          = 405;
            this.minValue          = 0;
            this.maxValue          = 1;
            this.currValue         = 0;
            this.scaleDivisions    = 11;
            this.scaleSubDivisions = 4;
            this.renderer          = null;

            // Create the sector list
            this.listThreshold = new LBMeterThresholdCollection();

            // Set the styles for drawing
            SetStyle(ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.ResizeRedraw |
                     ControlStyles.DoubleBuffer |
                     ControlStyles.SupportsTransparentBackColor,
                     true);

            // Transparent background
            this.BackColor = Color.Transparent;

            // Create the default renderer
            this.defaultRenderer             = new LBAnalogMeterRenderer();
            this.defaultRenderer.AnalogMeter = this;

            this.CalculateDimensions();
        }
Beispiel #3
0
        public LBAnalogMeter()
        {
            // Initialization
            InitializeComponent();

            // Properties initialization
            this.bodyColor = Color.Red;
            this.needleColor = Color.Yellow;
            this.scaleColor = Color.White;
            this.meterStyle = AnalogMeterStyle.Circular;
            this.viewGlass = true;
            this.startAngle = 135;
            this.endAngle = 405;
            this.minValue = 0;
            this.maxValue = 1;
            this.currValue = 0;
            this.scaleDivisions = 11;
            this.scaleSubDivisions = 4;
            this.renderer = null;

            // Create the sector list
            this.listThreshold = new LBMeterThresholdCollection();

            // Set the styles for drawing
            SetStyle(ControlStyles.AllPaintingInWmPaint |
                ControlStyles.ResizeRedraw |
                ControlStyles.DoubleBuffer |
                ControlStyles.SupportsTransparentBackColor,
                true);

            // Transparent background
            this.BackColor = Color.Transparent;

            // Create the default renderer
            this.defaultRenderer = new LBAnalogMeterRenderer();
            this.defaultRenderer.AnalogMeter = this;

            this.CalculateDimensions();
        }
        public void ToggleBackGroundImage(int which = -1)
        {
            int cur      = Settings.Default.SMeterBackgroundImg;
            var renderer = Renderer;

            if (renderer == null)
            {
                renderer = this.defaultRenderer;
            }
            if (m_console != null)
            {
                Image skinpic = m_console.PrettySMeterSkin();
                if (skinpic != null)
                {
                    renderer.BackGroundCustomImage = skinpic;
                    m_backGroundChoice             = BackGroundChoices.Skin;
                    goto done;
                }
            }

            if (which >= 0)
            {
                Settings.Default.SMeterBackgroundImg = which;
                if (which == 1)
                {
                    renderer.BackGroundCustomImage = Thetis.Properties.Resources.OLDAnalogSignalGauge;
                    m_backGroundChoice             = BackGroundChoices.Default;
                }
                else if (which == 0)
                {
                    renderer.BackGroundCustomImage = Thetis.Properties.Resources.NewVFOAnalogSignalGauge;
                    m_backGroundChoice             = BackGroundChoices.Default;
                }
                else
                {
                    renderer.BackGroundCustomImage = Thetis.Properties.Resources.SMeterTango;
                    m_backGroundChoice             = BackGroundChoices.Tango;
                }
            }
            else
            {
                if (cur == 0)
                {
                    Settings.Default.SMeterBackgroundImg = 1;
                    renderer.BackGroundCustomImage       = Resources.OLDAnalogSignalGauge;
                    m_backGroundChoice = BackGroundChoices.Blue;
                }
                else if (cur == 1)
                {
                    Settings.Default.SMeterBackgroundImg = 2;
                    renderer.BackGroundCustomImage       = Resources.SMeterTango;
                    m_backGroundChoice = BackGroundChoices.Tango;
                }
                else
                {
                    Settings.Default.SMeterBackgroundImg = 0;
                    renderer.BackGroundCustomImage       = Resources.NewVFOAnalogSignalGauge;
                    m_backGroundChoice = BackGroundChoices.Default;
                }
            }
done:

            Settings.Default.Save();
            Invalidate();
            Refresh();
            BackGndChanged e = new BackGndChanged();

            e.which = Settings.Default.SMeterBackgroundImg;
            this.BackGndImgChanged?.Invoke(this, e);

            if (m_console != null)
            {
                m_console.PrettySMeter.defaultRenderer.BackGroundCustomImage =
                    renderer.BackGroundCustomImage;
            }
        }