Originally posted by raysoft_jack
You can use gdi32 instead.

Code:
using System.Runtime.InteropServices;
using System.Drawing;

public class API {
    [DllImport("user32.dll", EntryPoint="GetWindowDC")]
    public static extern int GetWindowDC (
        int hwnd
    );

    [DllImport("user32.dll", EntryPoint="ReleaseDC")]
    public static extern int ReleaseDC (
        int hwnd,
        int hdc
    );
}


public class Form1 : System.Windows.Forms.Form {

    private TreeView       TV;

    //
    // IDE generated codes ............
    //

    private void DrawOnTheControl( ref Control c ) {

        int hWnd= c.Handle.ToInt32();
        int hDC = API.GetWindowDC( hWnd );

        Graphics canvas = Graphics.FromHdc( new IntPtr( hDC ) );
        // Do some drawings;

        // Don't forget to release the gdi object
        API.REleaseDC( hWnd , hDC );
    }

}
I wouldn't use this unmanaged code . You can get same functionality in managed GDI+ .Just a thought ...