private void DrawInstructor(string drawText, Graphics g) { if (Engine.ConfigUI.CropRegionHotkeyInfo) { Font posFont = new Font(FontFamily.GenericSansSerif, 8); Size textSize = TextRenderer.MeasureText(drawText, posFont); Point textPos = PointToClient(new Point(screenBound.Left + (screenBound.Width / 2) - ((textSize.Width + 10) / 2), screenBound.Top + 30)); Rectangle labelRect = new Rectangle(textPos, new Size(textSize.Width + 30, textSize.Height + 10)); if (PointIntersectsRectangle(mousePos, labelRect)) { textPos = PointToClient(new Point(screenBound.Left + (screenBound.Width / 2) - ((textSize.Width + 10) / 2), screenBound.Bottom - textSize.Height - 30)); labelRect = new Rectangle(textPos, new Size(textSize.Width + 30, textSize.Height + 10)); } using (GraphicsPath gPath = GraphicsEx.GetRoundedRectangle(labelRect, 7)) { g.FillPath(new LinearGradientBrush(new Point(labelRect.X, labelRect.Y), new Point(labelRect.X + labelRect.Width, labelRect.Y), Color.White, Color.FromArgb(150, Color.White)), gPath); g.DrawPath(labelBorderPen, gPath); } g.DrawString(drawText, posFont, new SolidBrush(Color.Black), labelRect.X + 5, labelRect.Y + 5); } }
private void DrawTooltip(string text, Point offset, Graphics g) { g.SmoothingMode = SmoothingMode.HighQuality; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; Font font = new Font(FontFamily.GenericSansSerif, 8); Point mPos = mousePos; Rectangle labelRect = new Rectangle(new Point(mPos.X + offset.X, mPos.Y + offset.Y), new Size(TextRenderer.MeasureText(text, font).Width + 10, TextRenderer.MeasureText(text, font).Height + 10)); if (labelRect.Right > clientBound.Right - 5) { labelRect.X = mPos.X - offset.X - labelRect.Width; } if (labelRect.Bottom > clientBound.Bottom - 5) { labelRect.Y = mPos.Y - offset.Y - labelRect.Height; } using (GraphicsPath gPath = GraphicsEx.GetRoundedRectangle(labelRect, 6)) { g.FillPath(new LinearGradientBrush(new Point(labelRect.X, labelRect.Y), new Point(labelRect.X + labelRect.Width, labelRect.Y), Color.FromArgb(200, Color.Black), Color.FromArgb(100, Color.Black)), gPath); g.DrawPath(labelBorderPen, gPath); } g.DrawString(text, font, new SolidBrush(Color.White), labelRect.X + 5, labelRect.Y + 5); if ((!selectedWindowMode || (selectedWindowMode && dragging)) && Engine.ConfigUI.CropShowMagnifyingGlass) { int posY = labelRect.Y - offset.Y * 2 - 100; if (posY < 5) { posY = labelRect.Y + labelRect.Height + 10; } g.DrawImage(HelpersLib.GraphicsHelper.Core.MagnifyingGlass((Bitmap)bmpClean, mousePos, 100, 5), labelRect.X, posY); } }
private void DrawHelpText(Graphics g) { if (Engine.ConfigUI.FreehandCropShowHelpText) { g.CompositingMode = CompositingMode.SourceOver; g.SmoothingMode = SmoothingMode.HighSpeed; using (Font helpTextFont = new XFont("Arial", 10)) { Size textSize = Size.Round(g.MeasureString(helpText, helpTextFont, 500, StringFormat.GenericTypographic)); Point textPos = PointToClient(new Point(this.Left + (this.Width / 2) - ((textSize.Width + 10) / 2), this.Top + 30)); Rectangle labelRect = new Rectangle(textPos, new Size(textSize.Width + 10, textSize.Height + 10)); using (GraphicsPath gPath = GraphicsEx.GetRoundedRectangle(labelRect, 7)) { g.FillPath(new SolidBrush(Color.FromArgb(200, Color.White)), gPath); g.DrawPath(Pens.Black, gPath); g.DrawString(helpText, helpTextFont, Brushes.Black, new PointF(labelRect.X + 5, labelRect.Y + 5)); } } } }