更改消息框BackgroundImage [英] change message box BackgroundImage

查看:85
本文介绍了更改消息框BackgroundImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

如何在Windows窗体上更改消息框的BackgroundImage ????

hello,
how i can change the BackgroundImage of the message box on windows forms ????

推荐答案

你可以'吨。请参见 this [ ^ ]其他方法的链接。



/ ravi
You can't. See this[^] link for alternative approaches.

/ravi


代码项目,我们甚至有一篇文章:自定义消息框 [ ^ ]。
Here at Code Project, we have even an article on that: "A Custom Message Box"[^].


正如Ravi所说:你做不到。



您将找到的所有替代可自定义消息框,包括链接到此主题的消息框,使用表单,并使用'ShowDialog显示表单很好的理由,包括:



1.原生的WinForms对话框做了一些复杂的事情,当它们占用UI事件时,将Message Pump暂停到应用程序的其他窗口。模态显示的表单也是如此:为了重现这种功能,你必须拔掉牙齿。示例:[ ^ ]。相信我你不想去那里。



2.你可以使用当模板显示模式关闭时返回的DialogResult枚举值。



3.具有按钮的便利性您可以在设计时在属性浏览器中设置DialogResult属性。



但是,我鼓励你考虑一下这样一个事实:对话框的外观和感觉以及行为方式是Windows用户社交的东西;视觉线索组和典型的控制装饰(关闭,保存,取消等)具有含义



我建议你考虑一下,如果你的Dialog UI的目的与标准的Win Dialogs不相似,你就会重新考虑go modal的价值。如果你真的需要显示另一个表格,你可以根据需要设置它的'TopLevel和'TopMost属性来显示它半模式。



但是,如果你得到模态,然后我建议刻意使你的表格的外观与标准对话框的模态不同,并确保其设计与最终用户沟通其目的。 ...很可能此时 你的目标:)



如果你真的想要一个模拟使用二级表格的代码示例,请问。
As Ravi said: "you can't."

All the substitute customizable Message Boxes you'll find, including the ones linked to in this thread, use a Form, and use 'ShowDialog to display the Form for very good reasons, including:

1. native WinForms Dialogs do some complex stuff to suspend the Message Pump to the Application's other windows while they hog the UI Events. Forms shown modally do the same: to reproduce that functionality you will have to have teeth pulled. Example: [^]. Trust me you don't want to go there.

2. You can use the DialogResult Enumeration value returned when a Form shown modally closes.

3. The convenience of having Buttons you can set the DialogResult property of in the Property Browser at design-time.

But, I'd encourage you to think about the fact that the way a Dialog looks-and-feels, and behaves, is something that Windows users are socialized to; the set of visual cues, and typical Control decorations ("Close," "Save," "Cancel," etc.) have meaning.

I suggest you consider that if the purpose of your Dialog UI is not similar to standard Win Dialogs, you reconsider the value of "going modal." If you really need to display another Form, you can display it "semi-modal" by setting its 'TopLevel and 'TopMost properties as needed.

But, if you gotta go modal, then I'd suggest deliberately making the look-and-feel of your Form shown modally different from the standard Dialogs, and make sure its design communicates to end-users its purpose. ... Quite likely that is your goal at this time :)

If you really desire a code example of using a secondary Form modally, just ask.


这篇关于更改消息框BackgroundImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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