C# Graphics CopyFromScreen issue

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);

Comments

  • 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).
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion