Can I draw on a Form, above all controls?

落花浮王杯 提交于 2020-01-01 09:28:08

问题


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).



来源:https://stackoverflow.com/questions/7060555/can-i-draw-on-a-form-above-all-controls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!