this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);

 

private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            Point aa = new Point(e.X, e.Y);
            Rectangle r1 = new Rectangle(0, 0, this.pictureBox1.Width, ((int)this.pictureBox1.Height/2));

 

            Rectangle r2 = new Rectangle(0, ((int)this.pictureBox1.Height / 2), this.pictureBox1.Width, ((int)this.pictureBox1.Height / 2));

            if (r1.Contains(aa))
            {
                MessageBox.Show("r1");
            }

            if (r2.Contains(aa))
            {
                MessageBox.Show("r2");
            }
        }

posted on 2010-08-21 07:11  TsingCai  阅读(153)  评论(0编辑  收藏  举报