How to repaint the whole screen?
-
Hi, with:
IntPtr deviceContext = GetDC(IntPtr.Zero);
Graphics deviceGraphics = Graphics.FromHdc(deviceContext)it is possible to draw on the screen. But how can I delete the drawn objects from screen? It still appears until something changed on the screen so Windows Mobile repaint that area. I tried RedrawWindow() and also SendMessage(with WM_PAINT) to repaint the whole screen, but nothing works :(
-
Hi, with:
IntPtr deviceContext = GetDC(IntPtr.Zero);
Graphics deviceGraphics = Graphics.FromHdc(deviceContext)it is possible to draw on the screen. But how can I delete the drawn objects from screen? It still appears until something changed on the screen so Windows Mobile repaint that area. I tried RedrawWindow() and also SendMessage(with WM_PAINT) to repaint the whole screen, but nothing works :(
I you want to paint the full screen then why don't you run your application in full screen mode?
Joel Ivory Johnson
Meet my dev team: RDA Architecture Evangelist Team Blog
My site: J2i.net
Twitter: J2iNet
-
I you want to paint the full screen then why don't you run your application in full screen mode?
Joel Ivory Johnson
Meet my dev team: RDA Architecture Evangelist Team Blog
My site: J2i.net
Twitter: J2iNet
I want to paint directly on the screen. No Form, no Control. A hidden application which paints directly on the screen. For example a text in the top bar where the start-button is. This works fine and is not the problem. The problem is, that i'm not able to delete the things I drawed on the screen. They will dissaper when Windows Mobile force the controls, forms, etc. to be repaint. For example if I draw text on the top bar the text still appears until I open the start menu, because then the bar will be repaint. After closing my hidden application I want to delete the text, which I drawed. So I have to force the whole desktop to repaint (because the text on top bar was only an example). But I tried RedrawWindow (with IntPtr.Zero) and also SendMessage (with WM_PAINT to IntPtr.Zero). This force Windows Mobile to repaint everything, but it doesnt work :(
-
I want to paint directly on the screen. No Form, no Control. A hidden application which paints directly on the screen. For example a text in the top bar where the start-button is. This works fine and is not the problem. The problem is, that i'm not able to delete the things I drawed on the screen. They will dissaper when Windows Mobile force the controls, forms, etc. to be repaint. For example if I draw text on the top bar the text still appears until I open the start menu, because then the bar will be repaint. After closing my hidden application I want to delete the text, which I drawed. So I have to force the whole desktop to repaint (because the text on top bar was only an example). But I tried RedrawWindow (with IntPtr.Zero) and also SendMessage (with WM_PAINT to IntPtr.Zero). This force Windows Mobile to repaint everything, but it doesnt work :(
Use InvalidateRect() and then wait for the OS to send you a WM_PAINT in response so you can redraw.
-
Use InvalidateRect() and then wait for the OS to send you a WM_PAINT in response so you can redraw.
Thanks, but it doesn't work, too :-(
IntPtr deviceContext = GetDC(IntPtr.Zero);
Rectangle rectangle = Screen.PrimaryScreen.Bounds; using (Bitmap capture = new Bitmap(rectangle.Width, rectangle.Height)) //Get screen context using (Graphics deviceGraphics = Graphics.FromHdc(deviceContext)) //Get graphics from bitmap using (Graphics captureGraphics = Graphics.FromImage(capture)) { // Blit the image data BitBlt(captureGraphics.GetHdc(), 0, 0, rectangle.Width, rectangle.Height, deviceGraphics.GetHdc(), rectangle.Left, rectangle.Top, SRCCOPY); deviceGraphics.DrawString("Hello", Font, new SolidBrush(Color.Black), 10, 10); } // Doesn't work: InvalidateRect(deviceContext, IntPtr.Zero, true); //Doesn't work: RedrawWindow(deviceContext, IntPtr.Zero, IntPtr.Zero, RDW\_ERASE | RDW\_INTERNALPAINT | RDW\_UPDATENOW | RDW\_INVALIDATE); // Doesn't work: SendMessage(deviceContext, WM\_PAINT, 0, 0); // I tried RedrawWindow with all possibile combinations of all parameters (RDW\_XXXX)! // I also tried to add directly IntPtr.Zero as Handle parameter // In all cases the text "Hello" is still drawn until I click on the start button // I run the code on WM 6.1.4 Professional (Emulator)
-
Hi, with:
IntPtr deviceContext = GetDC(IntPtr.Zero);
Graphics deviceGraphics = Graphics.FromHdc(deviceContext)it is possible to draw on the screen. But how can I delete the drawn objects from screen? It still appears until something changed on the screen so Windows Mobile repaint that area. I tried RedrawWindow() and also SendMessage(with WM_PAINT) to repaint the whole screen, but nothing works :(
Hi sushilange, try this this.Refresh();
Pavan Pareta
-
Hi sushilange, try this this.Refresh();
Pavan Pareta
I want to repaint/refresh Windows Mobile! And not my own application, because my own application isn't shown on the screen. If I draw directly on the screen above EVERYTHING, I want to delete this after closing my app. So I have to inform Windows Mobile that it has to repaint EVERTHING displayed on the screen.