void DrawElemBound(AutoElem ae, Graphics g, Color ForeColor, string Text) { if (ae == null || !ae.Available()) { return; } Rect BudRc = ae.Current.BoundingRectangle; if (BudRc == Rect.Empty) { return; } var ClientRc = this.RectangleToClient(BudRc.ToRectangle()); var ForeBrush = new SolidBrush(ForeColor); var ForePen = new Pen(ForeBrush, 3); var BackBrush = new SolidBrush(ForeColor.RevColor()); var BackPen = new Pen(BackBrush, 5); g.DrawRectangle(BackPen, ClientRc); g.DrawRectangle(ForePen, ClientRc); if (Text != "" && Text != null) { GraphicsPath gp = new GraphicsPath(); gp.AddString(Text, this.Font.FontFamily, (int)Font.Style, Font.Size, new Point(ClientRc.Left, ClientRc.Top), StringFormat.GenericDefault); var ogp = (GraphicsPath)gp.Clone(); gp.Widen(BackPen); g.FillPath(BackBrush, gp); g.FillPath(ForeBrush, ogp); } }
protected void VerifyCurElem() { if (!_curElem.Available()) { _curElem = AutoElem.FromHandle(GetDesktopWindow()); Console.WriteLine("Desktop Fallback"); if (CondMode) { Walker = UncondWalker; } } }