BOOL MetrocomShowBmp(int i_port, HDC hdc, int dest_x, int dest_y,
int dest_width, int dest_height, int src_x, int src_y, int src_width, int src_height, BOOL stretch);Parameters:
i_port - [in] communication port number (0 for COM1, 1 for COM2, etc.).
hdc - [in] handle to a Windows device context where the image will be displayed.
dest_x - [in] x-coordinate (in pixels) of the top left corner of the rectangular area in the destination window where the image will be displayed.
dest_y - [in] y-coordinate (in pixels) of the top left corner of the rectangular area in the destination window where the image will be displayed.
dest_width - [in] width (in pixels) of the rectangular area in the destination window where the image will be displayed.
dest_height - [in] height (in pixels) of the rectangular area in the destination window where the image will be displayed
src_x - [in] x-coordinate of the top left corner of the rectangular area of the image in DLL memory.
src_y - [in] y-coordinate of the top left corner of the rectangular area of the image in DLL memory.
src_width - [in] width (in pixels) of the rectangular area of the image in DLL memory.
src_height - [in] height (in pixels) of the rectangular area of the image in DLL memory.
fstretch - [in] If 1, the displayed image will be stretched to completely fit in the destination window.如何转换成C#可以引用的,主要是HDC,也知道是转成IntPtr,但是不懂得调用,要怎么传入参数?
int dest_width, int dest_height, int src_x, int src_y, int src_width, int src_height, BOOL stretch);Parameters:
i_port - [in] communication port number (0 for COM1, 1 for COM2, etc.).
hdc - [in] handle to a Windows device context where the image will be displayed.
dest_x - [in] x-coordinate (in pixels) of the top left corner of the rectangular area in the destination window where the image will be displayed.
dest_y - [in] y-coordinate (in pixels) of the top left corner of the rectangular area in the destination window where the image will be displayed.
dest_width - [in] width (in pixels) of the rectangular area in the destination window where the image will be displayed.
dest_height - [in] height (in pixels) of the rectangular area in the destination window where the image will be displayed
src_x - [in] x-coordinate of the top left corner of the rectangular area of the image in DLL memory.
src_y - [in] y-coordinate of the top left corner of the rectangular area of the image in DLL memory.
src_width - [in] width (in pixels) of the rectangular area of the image in DLL memory.
src_height - [in] height (in pixels) of the rectangular area of the image in DLL memory.
fstretch - [in] If 1, the displayed image will be stretched to completely fit in the destination window.如何转换成C#可以引用的,主要是HDC,也知道是转成IntPtr,但是不懂得调用,要怎么传入参数?
这是windows编程里很重要的一个类型,它唯一标识了一个对象 比如窗口,按钮,视图等;这里你可以传入窗口的句柄;
using (Graphics g = this.CreateGraphics())
{
IntPtr hdc = g.GetHdc();
MetrocomShowBmp(i_port, hdc, ...);
g.ReleaseHdc(hdc);
}
另,HDC不同于窗口句柄,它是设备场境句柄。