CreateGraphics()...

BlackStone

Well-known member
Joined
Jun 14, 2004
Messages
75
When you get a Graphics object using the aforementioned method, are you receiving the controls underlying Device Context, or is a new DC created each time?
 
I tested it with this code
Code:
    [color=Blue]Private Sub[/color] Form1_Load([color=Blue]ByVal[/color] sender [color=Blue]As[/color] System.[color=Blue]Object[/color], [color=Blue]ByVal[/color] e [color=Blue]As[/color] System.EventArgs) [color=Blue]Handles MyBase[/color].Load
        GFX = [color=Blue]Me[/color].CreateGraphics()
        DFX = [color=Blue]Me[/color].CreateGraphics()
        MessageBox.Show(GFX.GetHdc().ToString())
        MessageBox.Show(DFX.GetHdc().ToString())
    [color=Blue]End Sub[/color]
And yes, both Graphics objects return different handle numbers (16842835 and 67176468), so Id assume from this that a new DC is created each time.
 
Back
Top