Beispiel #1
0
 public void Disable()
 {
     if (!AVersion.MinWin10)
     {
         return;
     }
     for (AWnd w = default; ;)
     {
         w = AWnd.FindFast(null, "CLIPBRDWNDCLASS", true, w); if (w.Is0)
         {
             break;
         }
         int tid = w.GetThreadProcessId(out int pid); if (tid == 0)
         {
             continue;
         }
         if (!AProcess.GetName(pid, noSlowAPI: true).Eqi("svchost.exe"))
         {
             continue;
         }
         var ht = Api.OpenThread(Api.THREAD_SUSPEND_RESUME, false, tid); if (ht.Is0)
         {
             continue;
         }
         if (Api.SuspendThread(ht) < 0)
         {
             ht.Dispose(); continue;
         }
         _a ??= new List <Handle_>();
         _a.Add(ht);
     }
     ADebug.PrintIf(_a == null, "no suspended threads");
 }
Beispiel #2
0
    void _DrawItem(AuListControl.ZItemDrawArgs e)
    {
        //var p1 = APerf.Create();
        var g     = e.graphics;
        var ci    = _VisibleItem(e.index);
        var r     = e.bounds;
        int xText = _TextHorzOffset;
        var sym   = ci.FirstSymbol;

        //draw images: kind, access, static/abstract
        var imageKind = ci.KindImage;

        if (imageKind != null)
        {
            int imgX     = r.X + Au.Util.ADpi.ScaleInt(18);
            int imgY     = (r.Y + r.Bottom + 1) / 2 - imageKind.Height / 2;
            int overlayX = r.X + Au.Util.ADpi.ScaleInt(4);
            int overlayY = imgY + Au.Util.ADpi.ScaleInt(4);
            g.DrawImage(imageKind, imgX, imgY, imageKind.Width, imageKind.Height);             //note: would be very slow, but is very fast if DoubleBuffered = true (the control sets it in ctor).
            var imageAccess = ci.AccessImage;
            if (imageAccess != null)
            {
                g.DrawImage(imageAccess, overlayX, overlayY, imageAccess.Width, imageAccess.Height);
            }
            if (sym != null)
            {
                Bitmap b = null;
                if (sym.IsStatic && ci.kind != CiItemKind.Constant && ci.kind != CiItemKind.EnumMember && ci.kind != CiItemKind.Namespace)
                {
                    b = _imgStatic;
                }
                else if (ci.kind == CiItemKind.Class && sym.IsAbstract)
                {
                    b = _imgAbstract;
                }
                if (b != null)
                {
                    g.DrawImage(b, overlayX, overlayY, b.Width, b.Height);
                }
            }
        }
        //p1.Next();

        //draw selection
        r.Width -= xText; r.X += xText;
        if (e.isSelected)
        {
            g.FillRectangle(s_selectedBrush, r);
        }

        //draw text
        var s = ci.DisplayText;

        ADebug.PrintIf(!ci.ci.DisplayTextPrefix.NE(), s);         //we don't support prefix; never seen.
        int xEndOfText = 0;

        using (var tr = new GdiTextRenderer(g)) {
            ColorInt color = ci.moveDown.HasAny(CiItemMoveDownBy.Name | CiItemMoveDownBy.FilterText) ? 0x808080 : 0;
            tr.MoveTo(r.X, r.Y);
            if (ci.hilite != 0)
            {
                ulong h = ci.hilite;
                for (int normalFrom = 0, boldFrom, boldTo, to = s.Length; normalFrom < to; normalFrom = boldTo)
                {
                    for (boldFrom = normalFrom; boldFrom < to && 0 == (h & 1); boldFrom++)
                    {
                        h >>= 1;
                    }
                    tr.DrawText(s, color, normalFrom, boldFrom);
                    if (boldFrom == to)
                    {
                        break;
                    }
                    for (boldTo = boldFrom; boldTo < to && 0 != (h & 1); boldTo++)
                    {
                        h >>= 1;
                    }
                    tr.FontBold(); tr.DrawText(s, color, boldFrom, boldTo); tr.FontNormal();
                }
            }
            else
            {
                tr.DrawText(s, color);
            }

            if (ci.moveDown.Has(CiItemMoveDownBy.Obsolete))
            {
                xEndOfText = tr.GetCurrentPosition().x;
            }

            string green = _GreenSuffix(e.index);
            if (green != null)
            {
                tr.DrawText(green, 0x40A000);
            }
        }

        //draw red line over obsolete items
        if (ci.moveDown.Has(CiItemMoveDownBy.Obsolete))
        {
            int vCenter = r.Y + r.Height / 2;
            g.DrawLine(Pens.OrangeRed, r.X, vCenter, xEndOfText, vCenter);
        }
        //p1.NW('i');

        //draw group separator
        if (e.index > 0)
        {
            var cip = _VisibleItem(e.index - 1);
            if (cip.moveDown != ci.moveDown || (_groupsEnabled && cip.group != ci.group))
            {
                g.DrawLine(Pens.YellowGreen, 0, r.Y, r.Right, r.Y);
            }
        }
    }
Beispiel #3
0
 public override bool Equals(object obj)
 {
     ADebug.PrintIf(obj != this, "Equals");
     return(obj == this);
 }