Beispiel #1
0
        public RegisterBox()
        {
            _imageDisabled = null;
            _imageDown = null;
            _imageNormal = null;
            _imageOver = null;
            _icon = null;
            _buttonMouseState = ButtonMouseState.Normal;
            _buttonStyle = ButtonStyle.Standard;
            _controlRegion = ControlRegion.RoundedRectangle;
            _iconSize = new Size(32, 32);
            _buttonArrow = ButtonArrow.None;

            BackColor = Color.Transparent;
            UseVisualStyleBackColor = false;

            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.SetStyle(ControlStyles.Selectable, false);
            this.Refresh();
        }
Beispiel #2
0
        public override void Refresh()
        {
            try
            {
                if (Parent == null) return;

                if (_buttonStyle == ButtonStyle.Standard)
                {
                    _controlRegion = ControlRegion.RoundedRectangle;
                }
                else if (_buttonStyle == ButtonStyle.Menu)
                {
                    _controlRegion = ControlRegion.Rectangle;
                }

                this.InitializeGraphics();
                PaintEventArgs e = new PaintEventArgs(this.CreateGraphics(), ClientRectangle);
                this.OnPaint(e);
            }
            catch (ObjectDisposedException)
            {
            }
            catch (Win32Exception)
            {
            }
            catch (Exception ex)
            {
                MessageBox.Show("HomaControls.Buttons.HomaButton.Refresh():\n\n" + ex.Message, Application.ProductName);
            }
        }