Results 1 to 4 of 4

Thread: Keeping stuff on the screen

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Keeping stuff on the screen

    Im using setpixel, but it dissapears every time something moves over it, is there a way to make it stay?

  2. #2
    Zaei
    Guest
    Call your drawing code everytime the application recieves a WM_PAINT message.

    Z.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    thanks that works.....but now It is setting pixels outside of my program!!!!!!

    Code:
    case WM_PAINT:
                                                                    HDC myDC = GetDC(ghWnd_Main);
    COLORREF color = RGB(50,50,50); // Create the color green
    				color = RGB(255,255,255);
    				for(i=1; i<=200; i++)  {
    						SetPixel(myDC,i,200,color); // Plot the pixel
    				}
    			return 0;

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    perhaps you validate the handle first?

    PHP Code:
    case WM_PAINT:

    if (
    hWnd == ghWnd_Main)
    {
        
    HDC myDC GetDC(ghWnd_Main);
        
    COLORREF color RGB(50,50,50); // Create the color green
        
    color RGB(255,255,255);
        for(
    i=1i<=200i++)
        {
            
    SetPixel(myDC,i,200,color); // Plot the pixel
        
    }
    }

    return 
    0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width