画出窗外(和控件)

发布于 2024-12-26 13:37:24 字数 310 浏览 3 评论 0原文

我认为如果我使用图像那就最好了: 在此处输入图像描述

我需要我的控件可以作为日期时间选择器日历在窗口之外。我使用 panelKalendar = new PanelDoubleBuffer(); 然后在方法中: void panelKalendar_Paint(object sender, PaintEventArgs e) 我绘制所有内容。但它会绘制到窗口并喜爱所有其他控件。如何获得 DateTimePicker 中使用的“效果”?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天涯沦落人 2025-01-02 13:37:24

组合框的下拉列表(也可能是日历控件的下拉面板)是桌面的子窗口。这就是您还必须做的:将控件嵌套在无边框窗体中,并为该窗体提供空父级,以便它是顶级窗口,而不是应用程序窗口的子级。

由于您的窗体将是顶级窗口,因此需要在屏幕坐标中指定其位置,而不是在窗体的本地坐标中。您可以使用 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.

软糖 2025-01-02 13:37:24

恐怕您无法使用 formchild 控件实现您想要的效果(这就是您实际上正在做的事情),因为它将被截断父(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 the panel appears now.

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文