恶搞代码

Form1.cs:
using System;
using System.Collections.Generic;
using http://meihuicollege.com/doc/6d32c4a2bcd126fff6050b38.html ponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MakeAJoke
{
public partial class Form1 : Form
{
public Bitmap mybit;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
mybit = new Bitmap("123.png");
mybit.MakeTransparent(Color.Yellow);
this.StartPosition = FormStartPosition.CenterScreen;
this.WindowState = FormWindowState.Normal;

this.timer1.Enabled = true;
this.timer1.Interval = 10;
this.timer2.Enabled = true;
this.timer2.Interval = 200;
int ptx = this.Size.Width;
int pty = SystemInformation.MaxWindowTrackSize.Height;
this.Location = new Point(-ptx, pty);
}

protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawImage((Image)mybit, new Point(0, 0));
}

private void timer1_Tick(object sender, EventArgs e)
{
int y = SystemInformation.MaxWindowTrackSize.Height;
int i = this.Location.X;
int j = this.Location.Y;
if (j>y-this.Size.Height)
{
j -= 20;
}
if (i<0-120)
{
i += 20;
}
this.Location = new Point(i, j);
}

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

private void timer2_Tick(object sender, EventArgs e)
{
Form2 myForm2 = new Form2();
myForm2.Show();
}
}
}

Form2.cs:

using System;
using System.Collections.Generic;
using http://meihuicollege.com/doc/6d32c4a2bcd126fff6050b38.html ponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MakeAJoke
{
public partial class Form2 : Form
{
public Bitmap mybit;

public Form2()
{
InitializeComponent();
}

private void Form2_Load(object sender, EventArgs e)
{
mybit = new Bitmap("ps1.png");
mybit.MakeTransparent(Color.Yellow);
this.StartPosition = FormStartPosition.CenterScreen;
this.WindowState = FormWindowState.Normal;

Point screenpoint = Control.MousePosition;
this.Location = new Point(screenpoint.X, screenpoint.Y);
}

protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawImage((Image)mybit, new Point(0, 0));
}
}
}

新疆时时彩
相关推荐
相关主题
热门推荐