|
-
Jul 27th, 2004, 02:40 AM
#6
Sleep mode
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 ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|