| View previous topic :: View next topic |
| Author |
Message |
AndrewMan Grandmaster Cheater Supreme
Reputation: 0
Joined: 01 Aug 2007 Posts: 1257
|
Posted: Sun Jun 22, 2008 9:59 pm Post subject: .Net ~screenshot help~ |
|
|
Edit 2: FIXED | Code: | Me.Hide()
Threading.Thread.Sleep(500)
|
YESSSSSSSSSSSSSSSS!!!!!!!!!!!!!!!!!!!!!!!!
Edit: Okay this is really weird, when I hit the "take screenshot" button like 5 times in a row, the 5th time I press it, it doesnt take a picture of the program. I changed the "Me.Visible = True" to "Me.Hide".
This is the code I made to take a screenshot in VB:
| Code: | Me.Visible = False
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
PictureBox1.Image = screenshot
Me.Visible = True |
Although, its still taking a picture of the program itself, and I need the program "to go away" somehow, and re-appear after the screenshot.
Help?
_________________
Last edited by AndrewMan on Sun Jun 22, 2008 11:29 pm; edited 4 times in total |
|
| Back to top |
|
 |
Overload Master Cheater
Reputation: 0
Joined: 08 Feb 2008 Posts: 293
|
Posted: Sun Jun 22, 2008 10:01 pm Post subject: |
|
|
| make it hide in the tray or something, then use hotkeys to take the screen shot?
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Jun 22, 2008 10:32 pm Post subject: |
|
|
Didn't you ask this before and got answered? (I swear this has been asked before with that code.)
_________________
- Retired. |
|
| Back to top |
|
 |
AndrewMan Grandmaster Cheater Supreme
Reputation: 0
Joined: 01 Aug 2007 Posts: 1257
|
Posted: Sun Jun 22, 2008 10:41 pm Post subject: |
|
|
| Wiccaan wrote: | | Didn't you ask this before and got answered? (I swear this has been asked before with that code.) |
Yeah, never got answer though (was looking through some of my projects, and bumped into this one).
Thought id give another thread a try.
_________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Jun 22, 2008 11:05 pm Post subject: |
|
|
Based on what I can find on Google and various VB sites, Me.Hide() should do what you need to get the form to hide when that function is called. So:
| Code: | Me.Hide()
// Other Code Here...
Me.Show() |
_________________
- Retired. |
|
| Back to top |
|
 |
AndrewMan Grandmaster Cheater Supreme
Reputation: 0
Joined: 01 Aug 2007 Posts: 1257
|
Posted: Sun Jun 22, 2008 11:08 pm Post subject: |
|
|
| Wiccaan wrote: | Based on what I can find on Google and various VB sites, Me.Hide() should do what you need to get the form to hide when that function is called. So:
| Code: | Me.Hide()
// Other Code Here...
Me.Show() |
|
I dont know whats going on. It works "sometimes"....
Getting so damn tired of this stupid .Net shit.
Edit: and | Code: | | threadstate.standby |
may work, just gotta figure out how to use them.
_________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Jun 22, 2008 11:19 pm Post subject: |
|
|
| AndrewMan wrote: | | Wiccaan wrote: | Based on what I can find on Google and various VB sites, Me.Hide() should do what you need to get the form to hide when that function is called. So:
| Code: | Me.Hide()
// Other Code Here...
Me.Show() |
|
I dont know whats going on. It works "sometimes"....
Getting so damn tired of this stupid .Net shit. |
That's what debuggers are for.
Also, real men write native code.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Jun 22, 2008 11:23 pm Post subject: |
|
|
Sometimes might just because it is happening too fast. Trying adding Sleeps, not long ones, after the first call to hide the form. Such as:
| Code: | Me.Hide()
Sleep( 100 )
// Other code...
Me.Show() |
Giving the form a chance to hide before taking the pic.
_________________
- Retired. |
|
| Back to top |
|
 |
AndrewMan Grandmaster Cheater Supreme
Reputation: 0
Joined: 01 Aug 2007 Posts: 1257
|
Posted: Sun Jun 22, 2008 11:28 pm Post subject: |
|
|
| Wiccaan wrote: | Sometimes might just because it is happening too fast. Trying adding Sleeps, not long ones, after the first call to hide the form. Such as:
| Code: | Me.Hide()
Sleep( 100 )
// Other code...
Me.Show() |
Giving the form a chance to hide before taking the pic. |
Yup just figured it out. Was playing around with Threading
Im so damn happy now.
| Code: | Me.Hide()
Threading.Thread.Sleep(500)
\\code
Me.show |
_________________
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Mon Jun 23, 2008 6:17 pm Post subject: |
|
|
That doesn't seem like it would matter.
I've done things like
| Code: |
OtherForm otherForm = new OtherForm();
this.Hide();
otherForm.ShowDialog();
this.Show();
|
And has never not worked.
Also, as Slovach mentioned, you should try to make use of Visual Studio's amazing debugging feature.
_________________
|
|
| Back to top |
|
 |
AndrewMan Grandmaster Cheater Supreme
Reputation: 0
Joined: 01 Aug 2007 Posts: 1257
|
Posted: Mon Jun 23, 2008 6:36 pm Post subject: |
|
|
| samuri25404 wrote: | That doesn't seem like it would matter.
I've done things like
| Code: |
OtherForm otherForm = new OtherForm();
this.Hide();
otherForm.ShowDialog();
this.Show();
|
And has never not worked.
Also, as Slovach mentioned, you should try to make use of Visual Studio's amazing debugging feature. |
Just doesnt work with .Net
_________________
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Mon Jun 23, 2008 6:38 pm Post subject: |
|
|
| AndrewMan wrote: | | samuri25404 wrote: | That doesn't seem like it would matter.
I've done things like
| Code: |
OtherForm otherForm = new OtherForm();
this.Hide();
otherForm.ShowDialog();
this.Show();
|
And has never not worked.
Also, as Slovach mentioned, you should try to make use of Visual Studio's amazing debugging feature. |
Just doesnt work with .Net |
That was C#...
In case you didn't know, C# is part of the .NET framework... >_>
_________________
|
|
| Back to top |
|
 |
AndrewMan Grandmaster Cheater Supreme
Reputation: 0
Joined: 01 Aug 2007 Posts: 1257
|
Posted: Mon Jun 23, 2008 6:41 pm Post subject: |
|
|
| samuri25404 wrote: | | AndrewMan wrote: | | samuri25404 wrote: | That doesn't seem like it would matter.
I've done things like
| Code: |
OtherForm otherForm = new OtherForm();
this.Hide();
otherForm.ShowDialog();
this.Show();
|
And has never not worked.
Also, as Slovach mentioned, you should try to make use of Visual Studio's amazing debugging feature. |
Just doesnt work with .Net |
That was C#...
In case you didn't know, C# is part of the .NET framework... >_> |
I dont know maybe my vb 2008 is glitched or somethin
_________________
|
|
| Back to top |
|
 |
Typhoon808 Expert Cheater
Reputation: 0
Joined: 27 Mar 2008 Posts: 175 Location: Wales
|
Posted: Tue Jun 24, 2008 4:47 am Post subject: |
|
|
| Try minimizing the form instead of hiding it.
|
|
| Back to top |
|
 |
AndrewMan Grandmaster Cheater Supreme
Reputation: 0
Joined: 01 Aug 2007 Posts: 1257
|
Posted: Tue Jun 24, 2008 12:23 pm Post subject: |
|
|
Guys i've already figured this out lol. I just sleep it.
_________________
|
|
| Back to top |
|
 |
|