如何在WPF中的MDI表单的标题栏上创建时钟 [英] How to create a clock on Title bar of MDI form in WPF

查看:84
本文介绍了如何在WPF中的MDI表单的标题栏上创建时钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我必须通过MDI表单的标题栏在我的WPF项目中创建和显示数字时钟。

时钟应与Title的宽度相同bar&应该坚持下去,即调整大小调整大小。



问候,

honeyashu

Hi,
I have to create and display a digital clock in my WPF project over the MDI form's title bar.
Clock should be of same width as of Title bar & should be sticked with it i.e. resized accordingly with form resizing.

Regards,
honeyashu

推荐答案

为时钟创建一个单独的窗口。

您也可以将所有逻辑放在那里。

使用这些设置:

WindowStyle =无ShowInTaskbar =False



初始化mainWindow中的时钟窗口。



现在回复你的mainWindow_SizeChanged并设置时钟窗口的位置和宽度。



不要忘记关闭MainWindow.Close上的clockWindow。



并将WindowClock.Owner设置为MainWindow。



如果这样,请随意提出问题你不清楚。
Create a separate window for the clock.
You can put all the logic in there as well.
use these settings:
WindowStyle="None" ShowInTaskbar="False"

Initialize the clock window in your mainWindow.

Now respond to your mainWindow_SizeChanged and set the position and width of the clock window.

Don't forget to close the clockWindow on MainWindow.Close.

And set the WindowClock.Owner to the MainWindow.

Feel free to ask a question if this is not clear to you.


这篇关于如何在WPF中的MDI表单的标题栏上创建时钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆