drawing gone

This is a discussion on drawing gone within the C# Programming forums, part of the General Programming Boards category; Hey, I have button in a Form, I implemented its Click handler as when its clicked an X is drawn.... ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    164

    drawing gone

    Hey, I have button in a Form, I implemented its Click handler as when its clicked an X is drawn.... I obtained the Graphics using the CreateGraphics() method of the button used it to call the DrawLine methods..

    When I click it, it draws the line properly but when I move the mouse outside the button's boundary it vanishes. why?

    the code for the click event handler is
    Code:
      private void button1_Click(object sender, EventArgs e)
            {
                    Graphics g = button1.CreateGraphics();
                    g.DrawLine(new Pen(Color.Black), 20, 20, 200, 200);
                    g.DrawLine(new Pen(Color.Black), 200, 20, 20, 200);      
            }
    Last edited by manzoor; 01-18-2009 at 05:49 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Drawing HBITMAP into CWnd, Acquired from "screenshot"
    By DeusAduro in forum Windows Programming
    Replies: 6
    Last Post: 07-02-2009, 04:41 PM
  2. Slow drawing code
    By tjpanda in forum Windows Programming
    Replies: 5
    Last Post: 05-09-2008, 06:09 PM
  3. Line Drawing Algorithm
    By Axpen in forum Game Programming
    Replies: 15
    Last Post: 08-01-2005, 07:30 PM
  4. How to do double buffing with win32 drawing?
    By Josh Kasten in forum Windows Programming
    Replies: 2
    Last Post: 03-27-2004, 12:02 AM
  5. drawing minimaps and radar screens.
    By Eber Kain in forum Game Programming
    Replies: 4
    Last Post: 03-08-2002, 11:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21