private void RunMouseMove() { Random rng; rng = new Random(); while (IsRunning) { if (_nextInterval < DateTime.Now) { if (User32Integration.GetCursorPosition(out int x, out int y)) { switch (rng.Next(0, 4)) { case 0: x++; break; case 1: x--; break; case 2: y++; break; case 3: y--; break; } User32Integration.SetCursorPosition(x, y); } _nextInterval = DateTime.Now.AddMilliseconds(_delayMS); } Thread.Sleep(cDELAYMS_MINIMUM); } }
/// <summary> /// Prevents the control from drawing until the EndUpdate() method is called. /// </summary> /// <param name="control">A Control that will have drawing prevented.</param> public static void BeginUpdate(this Control control) { User32Integration.SetWindowRedraw(control.Handle, false); }
/// <summary> /// Resumes drawing of the list view control after drawing is suspended by the BeginUpdate() method. /// </summary> /// <param name="control">A Control that will have drawing resumed.</param> public static void EndUpdate(this Control control) { User32Integration.SetWindowRedraw(control.Handle, true); }
/// <summary> /// Setup the ListView so that all existing groups are collapsible. /// </summary> /// <remarks>This will only set the collapsible state on existing groups. If new groups are added, this method must be invoked again.</remarks> public void SetupCollapsibleGroups() { User32Integration.SetListViewGroupsCollapsible(Handle, GetGroupIDs()); }