vb.net - Winforms groupbox with colored border -
I used the following code to create a group box with colored boundaries:
Public Square BorderGroupBox inherits GroupBox Private _borderColor color Private _borderWidth Integer Private _borderStyle as ButtonBorderStyle as the shape ... dim tSize protected override as sub-OnPaint (ByVal E as PaintEventArgs) = TextRenderer.MeasureText (Me .Text, Me.Font) dim borderRect as rectangle = e.ClipRectangle borderRect.Y = CInt ((borderRect.Y + (tSize.Height / 2)) borderRect.Height = CInt ((borderRect.Height - (tS Ize.Height / 2)) ControlPaint.DrawBorder (e.Graphics, Borders, _borderColor, _borderWidth, _borderStyle, BorderColor, _borderWidth, _borderStyle, BorderColor, _borderWidth, _borderStyle, BorderColor, _borderWidth, _borderStyle) = e.ClipRectangle textRect.X = (TextRect.X + 6) textRect.Width = TSize.Width + 6 textRect.Height = tSize.Height e.Graphics.FillRectangle (New SolidBrush (Me.BackColor), textRec t) e.Graphics.DrawString (Me.Text , Me.Font, New SolidBrush (Me.ForeColor, textRect) End Sub Ending Class
The problem is, it is placed inside the scrollable container, and if If it is scrolled, then the boundary has not been created properly:
Bad can behave worse than this:
This is incorrect using your code e.ClipRectangle Note that this appears twice in your snippet. This variable not lets you rectify the range, it tells you how many areas of your customer area will need to be reproduced, it is an customizable chance, some of the client areas Leaving the parts can attract less, which does not need to be refreshed. This usually has the same shape as the display rectangle, which is why it seemed to be fine like it worked fine. But when you do not put it inside a scroll container, then the Windows Client optimizes the scroll by pushing parts of the area which can be easily moved and then produces a color for those parts which are used by the scroll Appear. In a small e.cliprackengeline you can see that in the screenshot, note the small rectangles. Replace e.ClipRectangle with me. Displayarengal
Comments
Post a Comment