zoukankan      html  css  js  c++  java
  • Winform与WPF对话框(MessageBox, Dialog)之比较

    Winform:使用System.Windows.Forms命名空间中相应控件; WPF则调用Microsoft.Win32。

    MessageBox:
    // WinForm
            private void WFMessageBoxClicked(object sender, RoutedEventArgs e)
            {
                System.Windows.Forms.MessageBox.Show("Hello from Windows Forms!", "Hello World!");
            }
    
    // WPF
            private void WPFMessageBoxClicked(object sender, RoutedEventArgs e)
            {
                System.Windows.MessageBox.Show("Hello from WPF!", "Hello world!");
            }

    OpenFileDialog / SaveFileDialog:

    // WinForm
            private void WinFormsDialogClicked(object sender, RoutedEventArgs e)
            {
                System.Windows.Forms.OpenFileDialog dialogOpenFile = new System.Windows.Forms.OpenFileDialog();
                dialogOpenFile.ShowDialog();
    
                //System.Windows.Forms.SaveFileDialog dialogSaveFile = new System.Windows.Forms.SaveFileDialog();
                //dialogSaveFile.ShowDialog();
            }
    
    // WPF
            private void WPFDialogClicked(object sender, RoutedEventArgs e)
            {
                Microsoft.Win32.OpenFileDialog dialogOpenFile = new Microsoft.Win32.OpenFileDialog();
                dialogOpenFile.ShowDialog();
    
                //Microsoft.Win32.SaveFileDialog dialogSaveFile = new Microsoft.Win32.SaveFileDialog();
                //dialogSaveFile.ShowDialog();
            }
  • 相关阅读:
    java 输出质数
    各大OJ
    使用css让图片居中
    poj 1250 Tanning Salon
    Struts2 中整合DWR3实现文件上传
    C语言I博客作业02
    The first essay.
    tar命令
    wBox Demo
    缓存记录
  • 原文地址:https://www.cnblogs.com/dinotang/p/3272298.html
Copyright © 2011-2022 走看看