This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
2020-05-23 17:22:45 +02:00
|
|
|
|
using CC_Functions.W32.Native;
|
2020-01-15 17:59:29 +01:00
|
|
|
|
|
|
|
|
|
namespace CC_Functions.W32.DCDrawer
|
|
|
|
|
{
|
|
|
|
|
public class DCUnbuffered : IDCDrawer
|
|
|
|
|
{
|
2020-01-16 19:50:31 +01:00
|
|
|
|
private readonly IntPtr hWnd;
|
2020-01-15 17:59:29 +01:00
|
|
|
|
private readonly IntPtr ptr;
|
|
|
|
|
|
|
|
|
|
public DCUnbuffered(IntPtr ptr, IntPtr hWnd)
|
|
|
|
|
{
|
|
|
|
|
this.ptr = ptr;
|
|
|
|
|
this.hWnd = hWnd;
|
|
|
|
|
Graphics = Graphics.FromHdc(ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DCUnbuffered(IntPtr ptr)
|
|
|
|
|
{
|
|
|
|
|
this.ptr = ptr;
|
|
|
|
|
hWnd = IntPtr.Zero;
|
|
|
|
|
Graphics = Graphics.FromHdc(ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Graphics Graphics { get; }
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
Graphics.Dispose();
|
|
|
|
|
user32.ReleaseDC(hWnd, ptr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|