您的位置:首页 > 编程语言 > C#

c# 窗体重画,形状自定义

2011-08-11 20:35 295 查看
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;
namespace Case01_6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public Bitmap mybit;

private void Form1_Load(object sender, EventArgs e)
{

mybit = new Bitmap("bai.png");
mybit.MakeTransparent(Color.White);
this.StartPosition = FormStartPosition.CenterScreen;
this.WindowState = FormWindowState.Normal ;

}

protected override void OnPaint(PaintEventArgs e)//方法重写
{
e.Graphics.DrawImage((Image)mybit, new Point(0, 0));   //将图像画出
}

private void Form1_Click_1(object sender, EventArgs e)
{
//Application.Exit();

}

}
}


  效果图: 原窗体



重画窗体 白色全部过滤掉了

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: