如何在.net紧凑框架底部显示确定按钮?
我正在用 C# 开发移动应用程序。我在应用程序中使用以下代码来显示消息框,但“确定”按钮显示在右上角。我想在底部显示确定按钮。这是我的代码
MessageBox.Show("Records successfully inserted","Customer Entry",MessageBoxButtons.OK,MessageBoxIcon.None,MessageBoxDefaultButton.Button1);
我的代码有什么问题吗?或者我应该需要做不同的事情?您能给我提供任何可以解决上述问题的代码或链接吗?
I am developing mobile application in C#. I am using the following code in my application to display the messagebox but the button ok is displayed at the top right corner. I want to display the ok button at the bottom. This is my code
MessageBox.Show("Records successfully inserted","Customer Entry",MessageBoxButtons.OK,MessageBoxIcon.None,MessageBoxDefaultButton.Button1);
Is anything wrong in my code? or should I need to do different things ? Can you please provide me any code or link through which I can resolve the above issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是紧凑框架中标准的 MessageBox 行为,在右上角显示“确定”按钮(我认为,除非您使用的是 Windows Mobile 6.5.x,否则它将显示在底部)。
我能看到“移动”底部的“确定”按钮的唯一方法是创建一个表单并使用它而不是 MessageBox。这意味着创建一种自定义 MessageBox 类。
It is the standard MessageBox behaviour in the compact framework to display the OK button at the top right corner (unless, I think, you are on a Windows Mobile 6.5.x, in that case it would be displayed at the bottom).
The only way I can see of "moving" that OK button at the bottom would be to create a form and use it instead of the MessageBox. That means creating a kind of custom MessageBox class.
我同意这很烦人。特别是在小型触摸屏上工作时,很难按右上角的“确定”。
由于您只想显示“确定”按钮 ID,建议使用
MessageBox.OKCancel
代替,并将任何按钮按下视为“确定”。设置除“确定”之外的任何内容都会在底部显示按钮。This is quite annoying i agree. Especially when working on small touchscreens where pressing the OK in the top right is difficult.
Since you just want to present the OK button id suggest using
MessageBox.OKCancel
instead and just treat any button press as OK. Setting anything other than OK will show the buttons at the bottom.