Ejemplo n.º 1
0
        public LedArrow()
        {
            InitializeComponent();

            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.Selectable, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.SetStyle(ControlStyles.UserPaint, true);



            this.Cursor = Cursors.Arrow;
            this.Size   = new Size(60, 30);
            this.Value  = false;

            this.OnColor    = Color.Lime;
            this.OffColor   = Color.DarkGreen;
            this.BlinkColor = Color.Lime;
            this.Style      = LedArrowStyle.SingleHead;
            _direction      = DirectionQ.Right;
            this.Resize    += new EventHandler(LedArrow_Resize);

            _timer.Interval = _blinkInterval;
            _timer.Tick    += delegate(object o, EventArgs args)
            {
                LedArrowBlink();
            };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 判断一下是否需要Size的反转
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        private bool NeedsSizeSwap(DirectionQ value)
        {
            if (value == this._direction)
            {
                return(false);
            }
            bool flag  = this._direction == DirectionQ.Right || this._direction == DirectionQ.Left;
            bool flag2 = value == DirectionQ.Right || value == DirectionQ.Left;

            return(flag != flag2);
        }