コード例 #1
0
        protected override void OnRender(Gdi graphics, Rectangle clipRect)
        {
            if (_leftBorder != null && _rightBorder != null && _topBorder != null && _bottomBorder != null)
            {
                Rectangle rect = new Rectangle(clipRect.Left + _leftBorderSize.Width,
                                               clipRect.Top + _topBorderSize.Height,
                                               clipRect.Width - _leftBorderSize.Width - _rightBorderSize.Width,
                                               _leftBorderSize.Height - _topBorderSize.Height - _bottomBorderSize.Height);

                if (_leftBorder != null)
                {
                    graphics.DrawImageAlphaChannel(_leftBorder, clipRect.Left, clipRect.Top);
                }
                if (_rightBorder != null)
                {
                    graphics.DrawImageAlphaChannel(_rightBorder, rect.Right,
                                                   clipRect.Top);
                }
                if (_topBorder != null)
                {
                    graphics.DrawImageAlphaChannel(_topBorder,
                                                   new Rectangle(rect.Left, clipRect.Top,
                                                                 rect.Width, _topBorderSize.Height));
                }
                if (_bottomBorder != null)
                {
                    graphics.DrawImageAlphaChannel(_bottomBorder,
                                                   new Rectangle(rect.Left,
                                                                 rect.Bottom,
                                                                 rect.Width, _topBorderSize.Height));
                }

                if (BackColor != Color.Empty)
                {
                    graphics.FillRect(rect, BackColor);
                }
            }
            else
            {
                //if (BackColor != Color.Empty)
                //    graphics.FillRect(clipRect, BackColor);
            }

            if (_textbox.Visible)
            {
                //
            }
            else
            {
                _label.Render(graphics, clipRect);
            }
        }