画出窗外(和控件)
我认为如果我使用图像那就最好了:
我需要我的控件可以作为日期时间选择器日历在窗口之外。我使用 panelKalendar = new PanelDoubleBuffer();
然后在方法中: void panelKalendar_Paint(object sender, PaintEventArgs e)
我绘制所有内容。但它会绘制到窗口并喜爱所有其他控件。如何获得 DateTimePicker 中使用的“效果”?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
组合框的下拉列表(也可能是日历控件的下拉面板)是桌面的子窗口。这就是您还必须做的:将控件嵌套在无边框窗体中,并为该窗体提供空父级,以便它是顶级窗口,而不是应用程序窗口的子级。
由于您的窗体将是顶级窗口,因此需要在屏幕坐标中指定其位置,而不是在窗体的本地坐标中。您可以使用 PointToScreen 方法获取这些坐标。
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.恐怕您无法使用
form
的 child 控件实现您想要的效果(这就是您实际上正在做的事情),因为它将被截断父(form
)边界。在我看来,您可以尝试使用单独的
WidnowdForm
控件,它恰好出现在panel
现在出现的位置。希望这有帮助。
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 thepanel
appears now.Hope this helps.