Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Rectangle not removing quickly enough?

So im trying to capture a region within my rectangle that is being drawn but the rectangle is not dissapearing quickly enough

[Image: zT6QRAW.png?1]

All code currently:
http://pastebin.com/raw/LvMfNGGj
You should wait until the rectangle is actually invisible.
(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?
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)
        {
            canResize = false;
            showrect = false;
            label2.Text = MousePosition.ToString();
            textBox1.Text += MousePosition.ToString();
            SnapshotImage(rect);
  
        }

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...
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
(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)
        {
            canResize = false;
            showrect = false;
            label2.Text = MousePosition.ToString();
            textBox1.Text += MousePosition.ToString();
            SnapshotImage(rect);
  
        }

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...



Code
private void Form1_MouseUp(object sender, MouseEventArgs e)
        {
            this.Invalidate();
            canResize = false;
            showrect = false;
            this.Invalidate();
            label2.Text = MousePosition.ToString();
            textBox1.Text += MousePosition.ToString();
            SnapshotImage(rect);

        }


I tried that but that also doesn't work and still shows the red lines from the rectangle.
(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....110).aspx

Try calling this.Invalidate and then this.Update

Just shooting in the dark here.

Μouse Wrote:  That's wrong. I don't have proof for that, it should just be common knowledge that it's wrong.

(Aug 10, 2016 09:25 PM)DannyTM Wrote:  -snip

I tried that but that also doesn't work and still shows the red lines from the rectangle.

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.
Accepting freelancing jobs ! PM me for more info !
Be the [BRAND NAME REMOVED] king ..


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Emre_Sep 6, 2019 11:17 PM 0 177 Sep 6, 2019 11:17 PM
Last Post: Emre_
[.NET] by 4h35i13n46u7Sep 18, 2016 03:06 PM 2 104 Sep 18, 2016 03:06 PM
Last Post: Ninja
[.NET] by tusharthegreatMar 21, 2016 07:22 AM 19 1,219 Mar 21, 2016 07:22 AM
Last Post: ΔΔΔΔΔΔ