简体   繁体   English

如何在.net Compact Framework的底部显示确定按钮?

[英]How to display ok button at bottom in .net compact framework?

I am developing mobile application in C#. 我正在用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. 我在应用程序中使用以下代码显示消息框,但按钮ok显示在右上角。 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? 您能否提供任何代码或链接来解决上述问题?

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). 紧凑框架中的标准MessageBox行为是在右上角显示“确定”按钮(除非,我认为您使用的是Windows Mobile 6.5.x,否则它将显示在底部)。

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. 我看到的“移动”底部的“确定”按钮的唯一方法是创建一个表单并使用它而不是MessageBox。 That means creating a kind of custom MessageBox class. 这意味着创建一种自定义MessageBox类。

This is quite annoying i agree. 我同意这很烦人。 Especially when working on small touchscreens where pressing the OK in the top right is difficult. 特别是在小型触摸屏上工作时,很难按右上角的OK。

Since you just want to present the OK button id suggest using MessageBox.OKCancel instead and just treat any button press as OK. 由于您只想显示OK按钮ID,建议您改用MessageBox.OKCancel并将任何按钮按下都视为OK。 Setting anything other than OK will show the buttons at the bottom. 设置除“确定”外的其他任何内容都将在底部显示按钮。

MessageBox.Show("Records successfully inserted","Customer Entry",MessageBoxButtons.OKCancel,MessageBoxIcon.None,MessageBoxDefaultButton.Button1);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM