Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to clear screen when i draw to screen?

how to clear screen when i draw to screen?

Scheduled Pinned Locked Moved C#
tutorialgraphicsquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    ping_jacob
    wrote on last edited by
    #1

    how to clear this graphic? if i draw graphic to screen example: public static void DrawToScreen(int pointX, int pointY) { IntPtr deskDC = UnmanagedMethods.GetDC(IntPtr.Zero); Graphics g = Graphics.FromHdc(deskDC); GraphicsContainer cont = g.BeginContainer(); g.SmoothingMode = SmoothingMode.AntiAlias; g.SmoothingMode = SmoothingMode.HighQuality; g.FillRectangle(new SolidBrush(Color.FromArgb(255, Color.Blue)), pointX, pointY, 2, 2); g.EndContainer(cont); g.Dispose(); UnmanagedMethods.ReleaseDC(deskDC); } this fucntion fill rectangle to screen. if i need to clear screen(clear desktop), how i do? please give some tips or hints for me thanks a lot....

    T 1 Reply Last reply
    0
    • P ping_jacob

      how to clear this graphic? if i draw graphic to screen example: public static void DrawToScreen(int pointX, int pointY) { IntPtr deskDC = UnmanagedMethods.GetDC(IntPtr.Zero); Graphics g = Graphics.FromHdc(deskDC); GraphicsContainer cont = g.BeginContainer(); g.SmoothingMode = SmoothingMode.AntiAlias; g.SmoothingMode = SmoothingMode.HighQuality; g.FillRectangle(new SolidBrush(Color.FromArgb(255, Color.Blue)), pointX, pointY, 2, 2); g.EndContainer(cont); g.Dispose(); UnmanagedMethods.ReleaseDC(deskDC); } this fucntion fill rectangle to screen. if i need to clear screen(clear desktop), how i do? please give some tips or hints for me thanks a lot....

      T Offline
      T Offline
      Tony Richards
      wrote on last edited by
      #2

      Why do you need to paint to the Desktop? Have you considered using a full-screen application instead?

      My Blog: This Blog

      D P 2 Replies Last reply
      0
      • T Tony Richards

        Why do you need to paint to the Desktop? Have you considered using a full-screen application instead?

        My Blog: This Blog

        D Offline
        D Offline
        Dragonfly_Lee
        wrote on last edited by
        #3

        Maybe it is a hoax. :-D

        Tan Li I Love KongFu~

        1 Reply Last reply
        0
        • T Tony Richards

          Why do you need to paint to the Desktop? Have you considered using a full-screen application instead?

          My Blog: This Blog

          P Offline
          P Offline
          ping_jacob
          wrote on last edited by
          #4

          i can't using fullscreen because i need to draw to screen when i drag mouse now i can draw when drag but can't clear that screen if draw on form, can use invalidate() if not on form, how can i do? please give some hints or tips to me thanks a lot....

          T 1 Reply Last reply
          0
          • P ping_jacob

            i can't using fullscreen because i need to draw to screen when i drag mouse now i can draw when drag but can't clear that screen if draw on form, can use invalidate() if not on form, how can i do? please give some hints or tips to me thanks a lot....

            T Offline
            T Offline
            Tony Richards
            wrote on last edited by
            #5

            I'm really guessing now, but have you tried using Invalidate? It may force Windows to redraw the desktop (it is, after all, just a different kind of window). If not, I'm afraid I'm stumped, sorry.

            My Blog: This Blog

            P 1 Reply Last reply
            0
            • T Tony Richards

              I'm really guessing now, but have you tried using Invalidate? It may force Windows to redraw the desktop (it is, after all, just a different kind of window). If not, I'm afraid I'm stumped, sorry.

              My Blog: This Blog

              P Offline
              P Offline
              ping_jacob
              wrote on last edited by
              #6

              how to use invalidate? please advice me... i read invalidaterect from dllimport user32.dll but don't understand if have another function or other as same as invalidate. please advice me. thanks a lot...

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups