C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2722
Number of posts: 5749

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
C# Graphics CopyFromScreen issue Posted by DeadBroke on 3 Sept 2009 at 3:08 AM
I have a DX scrolling banner running at the bottom of the desktop. The banner renders, as its backbround, anything beneath it. The problem is that if the background is renewed, I get a copy of the scrolling banner as its own background, even though I've made it invisible before using "CopyFromScreen". I'm probably being an idiot and it maybe obvious to others. Many thanks in advance.

RECT rct = new RECT();
GetWindowRect((IntPtr)SBHnd, ref rct);

Bitmap bmp = new Bitmap(PanWidth, PanHeight);

Graphics g = Graphics.FromImage(bmp);

ShowWindow(SBHnd, INVISIBLE);

g.CopyFromScreen(rct.x, rct.y, 0, 0, new Size(rct.Width, rct.Height));
ShowWindow(SBHnd, VISIBLE);

Report
Re: C# Graphics CopyFromScreen issue Posted by DataDink on 3 Sept 2009 at 4:55 PM
I think you need to add a "Application.DoEvents()" after making your form invisible. This will tell the UI to process pending commands (including your invisible request).



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.