在自己的应用程序中显示Windows关于对话框

和在VB等语言中实现方式一样,调用Windows API.
None.gif using  System;
None.gif
using  System.Windows.Forms;
None.gif
using  System.Runtime.InteropServices;
None.gif
ExpandedBlockStart.gifContractedBlock.gif
namespace  Jacky.Win32API  dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// Show Windows About Box
ExpandedSubBlockEnd.gif    
/// </summary>

ExpandedSubBlockStart.gifContractedSubBlock.gif    public class AboutBox dot.gif{
InBlock.gif        [DllImport(
"shell32.dll")]
InBlock.gif        
private static extern long ShellAbout(int hWnd, string szApp, string szOtherStuff, int hIcon);
InBlock.gif
InBlock.gif        
private string _Title = Application.ProductName;
InBlock.gif        
private int   _FormHandle = 0;
InBlock.gif        
private int   _IconHandle = 0;
InBlock.gif        
private string _Version   = Application.ProductVersion;
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="FormHandle"></param>
InBlock.gif        
/// <param name="IconHandle"></param>
InBlock.gif        
/// <param name="Title"></param>
InBlock.gif        
/// <param name="Version"></param>
ExpandedSubBlockEnd.gif        
/// <example>new AboutBox(this.Handle.ToInt32(), this.Icon.Handle.ToInt32(), "软件名称", "版本号Version 1.0").Show();</example>

ExpandedSubBlockStart.gifContractedSubBlock.gif        public AboutBox(int FormHandle, int IconHandle, string Title, string Version) dot.gif{
InBlock.gif            
this._FormHandle = FormHandle;
InBlock.gif            
this._IconHandle = IconHandle;
InBlock.gif            
this._Title         = Title;
InBlock.gif            
this._Version     = Version;
ExpandedSubBlockEnd.gif        }

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

ExpandedSubBlockStart.gifContractedSubBlock.gif        public AboutBox(int FormHandle, int IconHandle) dot.gif{
InBlock.gif            
this._FormHandle = FormHandle;
InBlock.gif            
this._IconHandle = IconHandle;
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
public long Show()dot.gif{
InBlock.gif            
return ShellAbout(this._FormHandle, this._Title, this._Version, this._IconHandle);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

调用方式:

None.gif new  AboutBox( this .Handle.ToInt32(),  this .Icon.Handle.ToInt32(),  " 软件名称 " " 版本号Version 1.0 " ).Show();

转载于:https://www.cnblogs.com/jacky/archive/2004/08/29/37408.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值