本文介绍了绘制/绘制外部表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以在表格外绘制图像和绘制文本吗?.我的意思是在表格外...
Can we paint images and draw text... outside a form.. i mean literally outside...
我知道有个愚蠢的问题要问,但是我们可以...
i know its stupid question to ask but CAN we...
推荐答案
您可以通过创建表单并将其TransparentColor属性设置为背景颜色来作弊",然后在其上进行绘制.但是,这会禁止您绘制透明颜色,因为它不会显示.
You can "cheat" by creating a form, and setting its TransparentColor property to its background color, then draw on it. However, this prohibits you from drawing the transparent color because it won't show.
或者您实际上可以直接绘制到桌面上.
Or you could actually draw directly to the desktop.
[DllImport("User32.dll")]
public static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("User32.dll")]
public static extern void ReleaseDC(IntPtr dc);
IntPtr desktopPtr = GetDC(IntPtr.Zero);
Graphics g = Graphics.FromHdc(desktopPtr);
// Do graphics manipulation here with "g" object
// Very important - free desktop graphics.
g.Dispose();
ReleaseDC(desktopPtr);
这篇关于绘制/绘制外部表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!