⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainform.cs

📁 window mobile 中非全屏显示对话框
💻 CS
字号:
using System;
using System.Windows.Forms;
using System.Collections.Generic;

namespace NonFullscreenDemo
{
  public partial class MainForm : Form
  {
    public MainForm()
    {
      InitializeComponent();
    }

    private void btnStandardMessageBox_Click(object sender, EventArgs e)
    {
      // First test, original dialog and our replacement dialog
      MessageBox.Show("hello this is my sample message", "this is the caption");

      // Second test, original dialog and our replacement dialog
      MessageBox.Show("this is a second test message", "this is my caption", MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);

      // Third test, a dialog with a very long message
      MessageBox.Show("this is a third test message which is very long, so I can see how I cope with word wrapping. Did i mention this was very very long, in fact too long!", "Word wrapping");
    }

    private void btnReplacementMessageBox_Click(object sender, EventArgs e)
    {
      // First test, original dialog and our replacement dialog
      MessageBoxForm.Show(this, "hello this is my sample message", "this is the caption");

      // Second test, original dialog and our replacement dialog
      Dictionary<string, DialogResult> buttons = new Dictionary<string, DialogResult>();
      buttons.Add("Yes", DialogResult.Yes);
      buttons.Add("No", DialogResult.No);

      MessageBoxForm.Show(this, "this is a second test message", "this is my caption", buttons);

      // Third test, a dialog with a very long message
      MessageBoxForm.Show(this, "this is a third test message which is very long, so I can see how I cope with word wrapping. Did i mention this was very very long, in fact too long!", "Word wrapping");

      // An example of something our replacement dialog supports which
      // the standard one does not (custom button labels)
      buttons = new Dictionary<string, DialogResult>();
      buttons.Add("Maybe", DialogResult.OK);
      buttons.Add("Never", DialogResult.Cancel);
 
      MessageBoxForm.Show(this, "this is a messagebox with custom button labels", "my caption", buttons);
    }

    private void btnCenteredDialog_Click(object sender, EventArgs e)
    {
      // This is an example of a dialog which is always
      // kept centered, even if it dynamically changes
      // size.
      CenteredForm dlg = new CenteredForm();
      dlg.Owner = this;
      dlg.ShowDialog();
    }

    private void btnInputForm_Click(object sender, EventArgs e)
    {
      InputForm dlg = new InputForm();
      dlg.Owner = this;

      switch (dlg.ShowDialog())
      {
        case DialogResult.OK:
          MessageBoxForm.Show(this, dlg.UserName, "Return value");
          break;

        case DialogResult.Cancel:
          MessageBoxForm.Show(this, "The user canceled the dialog", "Return value");
          break;

        default:
          MessageBoxForm.Show(this, "Unknown", "Return value");
          break;
      }
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -