问题描述
我认为,如果我使用图像,那将是最好的:
I think that if I use image it would be best:
我需要将控件作为datetimepicker日历放在窗口之外。我正在使用 panelKalendar = new PanelDoubleBuffer();
然后在方法中: void panelKalendar_Paint(object sender,PaintEventArgs e)
我画一切。但是它可以绘制到窗口并喜欢所有其他控件。如何获得DateTimePicker中使用的效果?
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?
推荐答案
组合框的下拉列表(以及日历控件的下拉面板)可能是桌面的子窗口。那也是您必须做的:将控件嵌套在无边界表单中,并为该表单提供一个空父级,这样它就是一个顶层窗口,而不是应用程序窗口的子窗口。
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.
由于您的表单将是顶级窗口,因此需要在屏幕坐标中而不是在表单本地坐标中指定其位置。您可以使用 PointToScreen
方法获得这些坐标。
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.
这篇关于在窗口(和控件)之外绘制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!