![]() |
|
[C#] Rectangle not removing quickly enough? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Rectangle not removing quickly enough? (/showthread.php?tid=5367557) |
Rectangle not removing quickly enough? - DannyTM - Aug 8, 2016 So im trying to capture a region within my rectangle that is being drawn but the rectangle is not dissapearing quickly enough ![]() All code currently: http://pastebin.com/raw/LvMfNGGj * - Visual Freedom - Aug 8, 2016 You should wait until the rectangle is actually invisible. * - DannyTM - Aug 9, 2016 (Aug 8, 2016 04:44 AM)Visual Freedom Wrote: You should wait until the rectangle is actually invisible. How exactly can i check for that? * - 0xDEAD10CC - Aug 9, 2016 You don't check for it, you've programmed it so that it takes the snapshot before the rectangle is drawn over to be no rectangle. Code private void Form1_MouseUp(object sender, MouseEventArgs e)All you do is showrect=false, but this won't get checked until the function returns unless you call Invalidate() before SnapshotImage(rect), and after showrect=false... * - DannyTM - Aug 10, 2016 (Aug 9, 2016 10:55 AM)0xDEAD10CC Wrote: You don't check for it, you've programmed it so that it takes the snapshot before the rectangle is drawn over to be no rectangle. Code private void Form1_MouseUp(object sender, MouseEventArgs e)I tried that but that also doesn't work and still shows the red lines from the rectangle. * - Chappie - Aug 10, 2016 (Aug 10, 2016 09:25 PM)DannyTM Wrote: I tried that but that also doesn't work and still shows the red lines from the rectangle. Forgive my ignorance as far as some of this goes. But I'm bored and figured I would butt-in. According to MSDN Quote:Calling the Invalidate method does not force a synchronous paint; to force a synchronous paint, call the Update method after calling the Invalidate method. When this method is called with no parameters, the entire client area is added to the update region. https://msdn.microsoft.com/en-us/library/598t492a(v=vs.110).aspx Try calling this.Invalidate and then this.Update Just shooting in the dark here. * - 0xBB - Aug 10, 2016 (Aug 10, 2016 09:25 PM)DannyTM Wrote: -snip What do you mean by the red lines are still visible ? Like it cut through the screenshot itself or it's visible on the borders of the screenshot ? If it's visible on the border of the screenshot, that's normal since you are getting the size of your rectangle as area to shoot. Try to redefine the screen areas width/height to match a bit less than your visual display of the area. |