📄 gdimage.cs
字号:
int UseSize, // The size of the font in pixel.
int ObjID, // The unique object IDentifier (each object MUST USE A UNIQUE one).
int ZS_STYLE, // The object Generic STYLE (use at least ZS_VISIBLE to show it).
int UseShadow, // The shadow 3D offset.
int Orientation // The text orientation (%ZD_TextHorzUp, %ZD_TextVertUp, %ZD_TextVertDn).
);
[DllImport(GDIMAGE)] // Save image to file using a valid GDIPLUS image handle.
public static extern uint ZD_ColorARGB(
byte AlphaChannel, // The translucency level ranging from 0 to 255.
int RGB // The classical RGB() color to use.
);
[DllImport(GDIMAGE)] // Create empty image background (Bitmap) into a GDImage control.
public static extern int ZI_CreateImageBackground(
IntPtr hCtrl, // The GDImage control
int Width, // Width
int Height // Height
);
[DllImport(GDIMAGE)] // Create a valid GDI BITMAP handle from FILE using any of the supported GDImage format.
public static extern IntPtr ZI_CreateBitmapFromFile(
string zFullName, // Name of an image file.
out int Width, // Width of the bitmap.
out int Height // Height of the bitmap.
// Return:
// A valid GDI bitmap handle (do not confuse GDI bitmap handle and GDI+ Image handle).
// Important:
// You must use DeleteObject(GDIBitmapHandle) when you do not need it anymore.
);
[DllImport(GDIMAGE)] // Create a sprite BITMAP.
public static extern int ZD_DrawBitmapToCtrl(
IntPtr hCtrl, // The GDImage control
int x, int y, IntPtr Bitmap, uint ColorARGB, int ID, int Style
);
[DllImport(GDIMAGE)] // Create a sprite BITMAP.
public static extern void ZD_SetObjectImageLabel(
int ObjID, // The unique sprite object identifier.
string zlabel // The label to use.
);
[DllImport(GDIMAGE)] // Setup the scroll with background property of a specific sprite object.
public static extern void ZD_SetObjectScroll(
int ObjID, // The unique sprite object identifier.
Boolean TrueFalse // The TRUE or FALSE scroll mode.
// Remark:
// If scroll mode is set to false (default),
// then the sprite looks floating above the backround when you scroll it.
);
[DllImport(GDIMAGE)] // Use full variable opacity with 32-bit PNG transparent.
public static extern void ZD_UsePngOpacity(
int ObjID, // The unique sprite object identifier.
Boolean TrueFalse // The TRUE or FALSE scroll mode.
// Remark:
// Feature only available with PNG 32-bit, because they have an alpha channel.
);
[DllImport(GDIMAGE)] // Get the current GDImage version #
public static extern string ZI_Version();
[DllImport(GDIMAGE)] // Create a simplified GDImage control window
public static extern IntPtr ZI_CreateWindow(
IntPtr hParent, // The Window/Dialog container
int x, // The control top left corner horizontal location
int y, // The control top left corner vertical location
int xW, // The control width
int yH, // The control height
int ControlID // The control unique IDentifier
);
[DllImport(GDIMAGE)] // Retrieve the unique IDentifier of the sprite being moved.
public static extern int ZI_GetMovingSpriteID();
[DllImport(GDIMAGE)] // Retrieve sprite overlay object X, Y coordinates
public static extern void ZD_GetObjectXY(
int ObjID, // The unique sprite object identifier.
out int x, // The X coordinate
out int y // The Y coordinate
);
[DllImport(GDIMAGE)] // Retrieve the GDImage mouse captured X,Y location.
public static extern void ZD_GetObjectXYcapture(
int ObjID, // The unique sprite object identifier.
out int x, // The X coordinate
out int y // The Y coordinate
);
[DllImport(GDIMAGE)] // Set the X,Y coordinates of an overlay object.
public static extern void ZD_SetObjectXY(
int ObjID, // The unique object IDentifier (each object MUST USE A UNIQUE one)
int x, // The X coordinate
int y, // The Y coordinate
int RedrawParent // TRUE causes immediat redraw of the object parent
);
[DllImport(GDIMAGE)] // Retrieve unique object IDentifier of the sprite hover the mouse.
public static extern int ZI_MouseOverObjectID();
[DllImport(GDIMAGE)] // Retrieve the label matching a specific sprite object identifier.
public static extern string ZD_GetObjectImageLabel(
int ObjID // The unique object IDentifier (each object MUST USE A UNIQUE one)
);
[DllImport(GDIMAGE)] // Retrieve bounding size that best fit sprite overlay region
public static extern void ZD_GetObjectBound(
int ObjID, // The unique object IDentifier (each object MUST USE A UNIQUE one)
out int BoundWidth, // Bounding Width
out int BoundHeight // Bounding Height
);
[DllImport(GDIMAGE)] // Force immediate refresh of a GDImage control display
public static extern void ZI_UpdateWindow(
IntPtr hCtrl, // The GDImage control
Boolean EraseFlag // Boolean flag to erase first the background.
);
[DllImport(GDIMAGE)] // Retrieve the DIB bitmap handle of the GDImage control background.
public static extern IntPtr ZI_GetBMP(
IntPtr hCtrl // The GDImage control
);
[DllImport(GDIMAGE)] // Retrieve the scroll status of a specific sprite object identifier.
public static extern bool ZD_GetObjectScroll(
int ObjID // The unique object IDentifier (each object MUST USE A UNIQUE one)
);
[DllImport(GDIMAGE)] // Retrieve the unique object IDentifier of the sprite that has the GDImage focus.
public static extern int ZI_GetObjectFocusID();
[DllImport(GDIMAGE)] // Determines whether the Ctrl key is up or down at the time the function is called.
public static extern bool ZI_IsCtrlKeyPressed();
[DllImport(GDIMAGE)] // Determines whether a the Shift key is up or down at the time the function is called.
public static extern bool ZI_IsShiftKeyPressed();
[DllImport(GDIMAGE)] // Determines whether a the Alt key is up or down at the time the function is called.
public static extern bool ZI_IsAltKeyPressed();
[DllImport(GDIMAGE)] // Determines whether a key is up or down at the time the function is called.
public static extern bool ZI_IsKeyDown(
int CheckKey // One of 256 possible virtual-key codes.
);
[DllImport(GDIMAGE, EntryPoint = "ZI_IsLButtonDown")] // Determines whether the left mouse button is up or down at the time the function is called.
public static extern bool IsLButtonDown();
[DllImport(GDIMAGE, EntryPoint = "ZI_IsRButtonDown")] // Determines whether the right mouse button is up or down at the time the function is called.
public static extern bool IsRButtonDown();
[DllImport(GDIMAGE, EntryPoint = "ZI_UseGLPanoramaView")]
public static extern void UseGLPanoramaView(double latitude, double longitude);
[DllImport(GDIMAGE, EntryPoint = "ZI_UpdateGLWindow")]
public static extern void UpdateGLWindow(IntPtr hCtrl);
[DllImport(GDIMAGE, EntryPoint = "ZI_ResizeGLWindow")]
public static extern void ResizeGLWindow(IntPtr hWnd);
public static void CaptureDesktop(IntPtr hCtrl) // The GDImage control
{
int SysXRes = Screen.PrimaryScreen.Bounds.Width;
int SysYRes = Screen.PrimaryScreen.Bounds.Height;
GI.ZI_CreateImageBackground(hCtrl, SysXRes, SysYRes);
int hDCDest = GI.ZI_GetDC(hCtrl);
IntPtr hDeskTop = Api.GetDesktopWindow();
int hDCSrce = Api.GetWindowDC(hDeskTop);
Api.BitBlt(hDCDest, 0, 0, SysXRes, SysYRes, hDCSrce, 0, 0, Api.SRCCOPY);
Api.ReleaseDC(hDeskTop, hDCSrce);
}
public static IntPtr CreateOpenGLWindow(IntPtr hParent, int x, int y, int xW, int yH, int ControlID)
{
IntPtr hWin = IntPtr.Zero;
uint Style = Api.WS_CHILD | Api.WS_VISIBLE;
uint StyleEx = Api.WS_EX_STATICEDGE;
IntPtr Instance = Api.GetModuleHandle("");
hWin = Api.CreateWindowEx(StyleEx,
GLImageClassName, // window class name
"", // window title
Style, // window style
x, // x location
y, // y location
xW, // Width
yH, // Height
hParent, // parent window handle
ControlID, // ControlID
Instance, // program instance handle
0); // creation parameters
return hWin;
}
public static IntPtr CreateGLcontrol(Control T, int ID)
{
System.IntPtr hCtrl;
hCtrl = CreateOpenGLWindow(
T.Parent.Handle, // The Window/Dialog container
T.Location.X, // Horizontal location
T.Location.Y, // Vertical location
T.Size.Width, // Width
T.Size.Height, // Height
ID); // Unique IDentifier
return hCtrl;
}
public static IntPtr CreateControl(Control T, int ID)
{
System.IntPtr hCtrl;
hCtrl = ZI_CreateWindow(
T.Parent.Handle, // The Window/Dialog container
T.Location.X, // Horizontal location
T.Location.Y, // Vertical location
T.Size.Width, // Width
T.Size.Height, // Height
ID); // Unique IDentifier
return hCtrl;
}
public static IntPtr CreateZoomControl(Control T, int ID)
{
System.IntPtr hCtrl = CreateControl(T, ID);
GI.SetProperty(hCtrl, GI.ZI_ZoomWindow, -1);
return hCtrl;
}
public static IntPtr CreateThumbControl(Control T, int ID)
{
System.IntPtr hCtrl = CreateControl(T, ID);
GI.SetProperty(hCtrl, GI.ZI_FitToWindow, GI.ZI_QualityDefault);
return hCtrl;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -