Paint out of window (and controls)

你离开我真会死。 提交于 2019-12-11 08:25:03

问题


I think that if I use image it would be best:

I need that my control could be out of window as datetimepicker calendar. I am using panelKalendar = new PanelDoubleBuffer(); then in method: void panelKalendar_Paint(object sender, PaintEventArgs e) I paint everything. But it´s painting to window and belov all other controls. How can I get "effect" that is use in DateTimePicker?


回答1:


The drop-down list of a combo box (and also possibly the drop-down panel of a calendar control) is a child window of the desktop. That's what you also have to do: nest your control inside a borderless form, and give that form a null parent, so that it is a top-level window, not a child of your application window.

Since your form will be a top-level window, its location will need to be specified in screen coordinates, not in coordinates local to your form. You can get those coordinates using the PointToScreen method.




回答2:


I'm afraid you can't achieve what you want with the child control of your form (that is what you're doing actually), cause it will be truncated by the parent (form) bounds.

Imo, you can try to use a seprate WidnowdForm control, that appears exactly in the place where the panel appears now.

Hope this helps.



来源:https://stackoverflow.com/questions/8836255/paint-out-of-window-and-controls

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