Paint out of window (and controls)

2019-08-10 23:59发布

I think that if I use image it would be best: enter image description here

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?

2条回答
淡お忘
2楼-- · 2019-08-11 00:51

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.

查看更多
狗以群分
3楼-- · 2019-08-11 00:54

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.

查看更多
登录 后发表回答