C#不规则窗口
2005-01-18 18:13 ☆野生架构师☆ 阅读(646) 评论(0) 收藏 举报前段时候看到QQ邮箱那漂亮的截面,心痒痒就弄了个FLASH播放不规则窗口!
各位不要笑哈!
namespace _123
{
partial class Form1 : Form
{
private Point mouseOffset;
private bool isMouseDown = false;
public Form1()
{
InitializeComponent();
}
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
int xOffset;
int yOffset;
if (e.Button == MouseButtons.Left)
{
xOffset = -e.X - SystemInformation.FrameBorderSize.Width;
yOffset = -e.Y - SystemInformation.CaptionHeight - SystemInformation.FrameBorderSize.Height;
mouseOffset = new Point(xOffset, yOffset);
isMouseDown = true;
}
}
private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (isMouseDown)
{
Point mousePos = Control.MousePosition;
mousePos.Offset(mouseOffset.X, mouseOffset.Y);
Location = mousePos;
}
}
private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
isMouseDown = false;
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
我把它也弄上了,这就是不规则窗口的重点代码哈! 嘿明白的!
FLASH播放就要用到COM+哈!我嘿简单的就弄上面去了 不过不是嘿好看!
原文件代码下载


浙公网安备 33010602011771号