Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var charSizeF = e.Graphics.MeasureString(Text.Substring(0,1), Font);
- var textSizeF = e.Graphics.MeasureString(Text, Font);
- Size = new Size((int)(textSizeF.Width + _textPaddingMultiplierWidth * charSizeF.Width), (int)(charSizeF.Height * _textPaddingMultiplierHeight));
- var screenLocParent = Parent.PointToScreen(Parent.Location);
- var screenLocThis = new Point(screenLocParent.X + Parent.ClientRectangle.Width - Size.Width, screenLocParent.Y + _matchingItemOnRight.Location.Y - (Size.Height / 2));
- Location = Parent.PointToClient(screenLocThis);
- var crX = ClientRectangle.X;
- var crY = ClientRectangle.Y;
- var crWidth = ClientRectangle.Width;
- var crHeight = ClientRectangle.Height;
- if (Padding != Padding.Empty)
- {
- crX += Padding.Left;
- crY += Padding.Top;
- crWidth -= (Padding.Left + Padding.Right);
- crHeight -= (Padding.Top + Padding.Bottom);
- }
- var paintRect = new Rectangle(crX, crY, crWidth, crHeight);
- e.Graphics.DrawString(
- Text,
- Font,
- new SolidBrush(ForeColor),
- paintRect, style);
Add Comment
Please, Sign In to add comment