zoukankan      html  css  js  c++  java
  • 在自己的应用程序中显示Windows关于对话框

    和在VB等语言中实现方式一样,调用Windows API.
    using System;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;

    namespace Jacky.Win32API {
        
    /// <summary>
        
    /// Show Windows About Box
        
    /// </summary>

        public class AboutBox {
            [DllImport(
    "shell32.dll")]
            
    private static extern long ShellAbout(int hWnd, string szApp, string szOtherStuff, int hIcon);

            
    private string _Title = Application.ProductName;
            
    private int   _FormHandle = 0;
            
    private int   _IconHandle = 0;
            
    private string _Version   = Application.ProductVersion;

            
    /// <summary>
            
    /// 
            
    /// </summary>
            
    /// <param name="FormHandle"></param>
            
    /// <param name="IconHandle"></param>
            
    /// <param name="Title"></param>
            
    /// <param name="Version"></param>
            
    /// <example>new AboutBox(this.Handle.ToInt32(), this.Icon.Handle.ToInt32(), "软件名称", "版本号Version 1.0").Show();</example>

            public AboutBox(int FormHandle, int IconHandle, string Title, string Version) {
                
    this._FormHandle = FormHandle;
                
    this._IconHandle = IconHandle;
                
    this._Title         = Title;
                
    this._Version     = Version;
            }


            
    /// <summary>
            
    /// 
            
    /// </summary>
            
    /// <param name="FormHandle"></param>
            
    /// <param name="IconHandle"></param>
            
    /// <example>new AboutBox(this.Handle.ToInt32(), this.Icon.Handle.ToInt32(), "软件名称", "版本号Version 1.0").Show();</example>

            public AboutBox(int FormHandle, int IconHandle) {
                
    this._FormHandle = FormHandle;
                
    this._IconHandle = IconHandle;
            }


            
    public long Show(){
                
    return ShellAbout(this._FormHandle, this._Title, this._Version, this._IconHandle);
            }

        }

    }

    调用方式:

    new AboutBox(this.Handle.ToInt32(), this.Icon.Handle.ToInt32(), "软件名称""版本号Version 1.0").Show();
  • 相关阅读:
    oracle启动的三步
    Solaris下vi的简单使用帮助
    Solaris下ftp配置(初稿待补充)
    soap笔记1
    Solaris 10 查看机器的网卡mac地址
    查看表空间名称与对应文件
    [转]Ubuntu10.04的网络配置
    [转]红帽企业版RHEL6使用Fedora13的yum源
    [转]linux忘记密码怎么办法
    [转]个人管理 - IT人士书籍推荐(已读)
  • 原文地址:https://www.cnblogs.com/jacky/p/37408.html
Copyright © 2011-2022 走看看