Is it possible for me to draw ABOVE all controls on a form
?
I have some controls (textboxes
, buttons
, COM objects
) on my form,
and I wish to draw ON them, overriding any pixels previously drawn by them.
I am using Windows Forms
on C#
.
NOTE: the Graphics
class draws under the controls...
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Take a look at the code in this article:
Draw Over WinForms Controls
The author has created a component that (as he describes it) is like a piece of glass over your form. Your code then draws on this 'glass,' over controls, the form it overlays, etc.
One serious limitation which will affect you is that it does not draw over some controls (including the TextBox). These limitations (and the reasons for them) are described in the article but the code in the article might be what you're looking for (or might serve as a starting point for your own solution).