ITPub博客

首页 > Linux操作系统 > Linux操作系统 > C#(winform)项目中自制alert提示窗体

C#(winform)项目中自制alert提示窗体

原创 Linux操作系统 作者:iDotNetSpace 时间:2009-12-15 16:30:11 0 删除 编辑

先来个图片:

再上代码

代码
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;


namespace FB.FormHelper
{
public partial class CloseForm. Form
{
///
/// 构造函数
///

public CloseForm()
{
InitializeComponent();
this.DialogResult = DialogResult.Cancel;
}
///
/// 确定按钮点击事件
///

///
///
private void button1_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
this.DialogResult = DialogResult.OK;
}
else
{
this.DialogResult = DialogResult.No;
}
this.Close();
}
///
/// 绘图事件
///

///
protected override void OnPaint(PaintEventArgs e)
{
Graphics g
= e.Graphics;
Icon icon
= SystemIcons.Question;
g.DrawIcon(icon,
30, 16);
}
///
/// 取消按钮点击事件
///

///
///
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}

}
}

其中绘图事件的代码比较重要

全靠这两句代码让这个窗体有了系统icon资源

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12639172/viewspace-622489/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-01-04

  • 博文量
    2376
  • 访问量
    5766206