Пример #1
0
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

            Rectangle rect = Rectangle.Inflate(ClientRectangle, 1, 1);

            using (GraphicsPath rr = BtnRenderer.GetRoundedRect(rect, _BtnInfo.CornerRadius))
            {
                Region = new Region(rr);
            }

            _BtnInfo.Rect = ClientRectangle;

            int top   = (int)(Height * 0.35);
            int width = (int)(Width / 2);

#if DEBUG1
            _PttRect     = new Rectangle(1, 10, 12, 12);
            _SquelchRect = new Rectangle(Width - (1 + 12), 10, 12, 12);
#else
            _PttRect     = new Rectangle(1, 4, 25, 25);
            _SquelchRect = new Rectangle(Width - 22, 4, 25, 25);
#endif

            _TxBtnInfo.Rect = new Rectangle(0, top, width, Height - top);
            _RxBtnInfo.Rect = new Rectangle(width, top, Width - width, Height - top);
        }
Пример #2
0
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

            Rectangle rect = Rectangle.Inflate(ClientRectangle, 1, 1);

            using (GraphicsPath rr = BtnRenderer.GetRoundedRect(rect, _BtnInfo.CornerRadius))
            {
                Region = new Region(rr);
            }

            _BtnInfo.Rect = ClientRectangle;
        }
Пример #3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (Enabled)
            {
                if (_TxBackColor != ButtonColor)
                {
                    using (GraphicsPath path = BtnRenderer.GetRoundedRect(_TxRect, _BtnInfo.CornerRadius))
                        using (Brush brush = new SolidBrush(Color.FromArgb(VisualStyle.UseModernStyle ? 175 : 255, _TxBackColor)))
                        {
                            e.Graphics.FillPath(brush, path);
                        }

                    //BtnRenderer.DrawString(e.Graphics, ClientRectangle, _TxBackColor, BtnState, Text, Font, ContentAlignment.TopCenter, ForeColor);
                }
                if (_RxBackColor != ButtonColor)
                {
                    using (GraphicsPath path = BtnRenderer.GetRoundedRect(_RxRect, _BtnInfo.CornerRadius))
                        using (Brush brush = new SolidBrush(Color.FromArgb(VisualStyle.UseModernStyle ? 175 : 255, _RxBackColor)))
                        {
                            e.Graphics.FillPath(brush, path);
                        }
                }
            }

            using (Pen linePen = new Pen(Enabled ? _BtnInfo.GetBorderColor(BtnState.Normal) : _BtnInfo.GetBorderColor(BtnState.Inactive), 2))
            {
                e.Graphics.DrawLine(linePen, 1, _RxRect.Top - 2, Width - 3, _RxRect.Top - 2);
            }

            if (_DrawX)
            {
                using (Pen p = new Pen(Color.Red, 5))
                {
                    e.Graphics.DrawLine(p, 6, 6, Width - 6, Height - 6);
                    e.Graphics.DrawLine(p, Width - 6, 6, 6, Height - 6);
                }
            }

            BtnRenderer.DrawString(e.Graphics, ClientRectangle, _TxBackColor, BtnState, Text, Font, ContentAlignment.TopCenter, ForeColor);
        }