如题
3Q各位大侠

解决方案 »

  1.   

    放一个窗体,什么也不用加,直接把代码贴近去,好玩的
    ==========================================
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    namespace timecard
    {
    /// <summary>
    /// about 的摘要说明。
    /// </summary>
    public class about : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.PictureBox pictureBox1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.Timer timer1;
    private System.Windows.Forms.Button button1;
    [DllImport("kernel32.dll")]
    public static extern bool Beep(int frequency, int duration); 
    [System.Runtime.InteropServices.DllImport("user32")]
    private static extern bool AnimateWindow(IntPtr hwnd,int dwTime, int dwFlags);
    const int AW_HOR_POSITIVE = 0x0001;
    const int AW_HOR_NEGATIVE = 0x0002;
    const int AW_VER_POSITIVE = 0x0004;
    const int AW_VER_NEGATIVE = 0x0008;
    const int AW_CENTER = 0x0010;
    const int AW_HIDE = 0x10000;
    const int AW_ACTIVATE = 0x20000;
    const int AW_SLIDE = 0x40000;
    const int AW_BLEND = 0x80000;
    private System.ComponentModel.IContainer components; public about()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent();
    //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if(components != null)
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.components = new System.ComponentModel.Container();
    System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(about));
    this.label1 = new System.Windows.Forms.Label();
    this.pictureBox1 = new System.Windows.Forms.PictureBox();
    this.label2 = new System.Windows.Forms.Label();
    this.label3 = new System.Windows.Forms.Label();
    this.label4 = new System.Windows.Forms.Label();
    this.button1 = new System.Windows.Forms.Button();
    this.timer1 = new System.Windows.Forms.Timer(this.components);
    this.SuspendLayout();
    // 
    // label1
    // 
    this.label1.Font = new System.Drawing.Font("华文行楷", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
    this.label1.ForeColor = System.Drawing.Color.Purple;
    this.label1.Location = new System.Drawing.Point(120, 24);
    this.label1.Name = "label1";
    this.label1.Size = new System.Drawing.Size(196, 32);
    this.label1.TabIndex = 0;
    this.label1.Text = "考 勤 管 理 系 统";
    // 
    // pictureBox1
    // 
    this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
    this.pictureBox1.Location = new System.Drawing.Point(372, 72);
    this.pictureBox1.Name = "pictureBox1";
    this.pictureBox1.Size = new System.Drawing.Size(40, 40);
    this.pictureBox1.TabIndex = 1;
    this.pictureBox1.TabStop = false;
    // 
    // label2
    // 
    this.label2.Font = new System.Drawing.Font("隶书", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
    this.label2.Location = new System.Drawing.Point(12, 88);
    this.label2.Name = "label2";
    this.label2.Size = new System.Drawing.Size(312, 24);
    this.label2.TabIndex = 2;
    this.label2.Text = "程序制作:张珂";
    // 
    // label3
    // 
    this.label3.Font = new System.Drawing.Font("隶书", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
    this.label3.Location = new System.Drawing.Point(12, 124);
    this.label3.Name = "label3";
    this.label3.Size = new System.Drawing.Size(420, 24);
    this.label3.TabIndex = 3;
    this.label3.Text = "编写环境:WIN2KPROSP4+MSSQL2KSP4+MS.NET 1.14322SP1";
    // 
    // label4
    // 
    this.label4.Font = new System.Drawing.Font("隶书", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
    this.label4.Location = new System.Drawing.Point(12, 160);
    this.label4.Name = "label4";
    this.label4.Size = new System.Drawing.Size(336, 20);
    this.label4.TabIndex = 4;
    this.label4.Text = "编写工具:MS VISUAL STUDIO.NET 2003(C#)";
    // 
    // button1
    // 
    this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
    this.button1.Location = new System.Drawing.Point(416, 4);
    this.button1.Name = "button1";
    this.button1.Size = new System.Drawing.Size(20, 20);
    this.button1.TabIndex = 5;
    this.button1.Text = "×";
    this.button1.Click += new System.EventHandler(this.button1_Click);
    // 
    // timer1
    // 
    this.timer1.Enabled = true;
    this.timer1.Interval = 1;
    this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
    // 
    // about
    // 
    this.AcceptButton = this.button1;
    this.AutoScaleBaseSize = new System.Drawing.Size(7, 16);
    this.ClientSize = new System.Drawing.Size(440, 224);
    this.Controls.Add(this.button1);
    this.Controls.Add(this.label4);
    this.Controls.Add(this.label3);
    this.Controls.Add(this.label2);
    this.Controls.Add(this.pictureBox1);
    this.Controls.Add(this.label1);
    this.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
    this.Name = "about";
    this.ShowInTaskbar = false;
    this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
    this.Text = "about";
    this.TopMost = true;
    this.Closing += new System.ComponentModel.CancelEventHandler(this.about_Closing);
    this.Load += new System.EventHandler(this.about_Load);
    this.Activated += new System.EventHandler(this.about_Activated);
    this.ResumeLayout(false); }
    #endregion private void button1_Click(object sender, System.EventArgs e)
    {
    this.Close();
    } private void about_Load(object sender, System.EventArgs e)
    {
    AnimateWindow(this.Handle,200, AW_CENTER | AW_VER_NEGATIVE);
    } private void about_Activated(object sender, System.EventArgs e)
    {
    } private void about_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
    AnimateWindow(this.Handle,200, AW_HIDE | AW_BLEND );
    timer1.Enabled=false;
    } private void timer1_Tick(object sender, System.EventArgs e)
    {
    Random random = new Random();
    Beep(random.Next(10000),100);
    } }
    }
      

  2.   

    对了你把那些picturebox和label去掉才行啊。
      

  3.   

    先引入
    using System.Runtime.InteropServices;然后
    [DllImport("kernel32.dll")]
    public static extern bool Beep(int frequency, int duration); //你的api然后就可以用了
      

  4.   

    如果调用外部API需要先先调入using System.Runtime.InteropServices;然后添加属性[
    DllImport("User32.dll")]
    public static extern int MessageBox(int p,string msg,string cap,int type);
      

  5.   

    DllImport("User32.dll")]
    public static extern int MessageBox(int p,string msg,string cap,int type)
      

  6.   

    eg:using System.Runtime.InteropServices;[DllImport("kernel32.dll")]
    public static extern bool Beep(int frequency, int duration); 
      

  7.   

    [System.Runtime.InteropServices.DllImport("user32")]
    下面是API函数声明