• 在自己的应用程序中显示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();
  • 相关阅读:
    图像滤镜艺术---乐高像素拼图特效滤镜的代码实现
    假设你也23
    seajs载入流程图
    android 怎样将主菜单图标改成按安装时间排序
    热力学第一定律的社会学思考
    Django创建数据表
    KeyPress 和KeyDown 、KeyPress之间的区别
    Delphi 制作自定义数据感知控件并装入包(dpk文件)中(与DBText类似的数据感知控件)
    Delphi中的窗体创建与销毁
    Delphi ADOQuery连接数据库的查询、插入、删除、修改
  • 原文地址:https://www.cnblogs.com/jacky/p/37408.html
Copyright © 2020-2023  润新知