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();
  • 相关阅读:
    做题经验
    4906 删数问题
    1225 八数码难题
    1005 生日礼物
    1004 四子连棋 未完成
    1008 选数 2002年NOIP全国联赛普及组
    1068 乌龟棋 2010年NOIP全国联赛提高组
    2292 图灵机游戏
    实战数据结构(9)_单链表实现多项式的相乘
    最近招两个兼职的活(PHP和JSP)
  • 原文地址:https://www.cnblogs.com/jacky/p/37408.html
Copyright © 2011-2022 走看看