private void ss() ... { //this.Hide(); IntPtr dc1=CreateDC("DISPLAY",null,null,(IntPtr) null) ; //创建显示器的DC Graphics g1=Graphics.FromHdc(dc1) ; //由一个指定设备的句柄创建一个新的Graphics对象 Bitmap MyImage=new Bitmap(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height,g1); //根据屏幕大小创建一个与之相同大小的Bitmap对象 Graphics g2 = Graphics.FromImage ( MyImage ) ; //获得屏幕的句柄 IntPtr dc3 =g1.GetHdc(); //获得位图的句柄 IntPtr dc2 =g2.GetHdc(); //把当前屏幕捕获到位图对象中 BitBlt(dc2,0,0,Screen.PrimaryScreen.Bounds.Width ,Screen.PrimaryScreen.Bounds.Height,dc3,0,0,13369376); //把当前屏幕拷贝到图中 g1.ReleaseHdc(dc3); //释放屏幕句柄 g2.ReleaseHdc(dc2); textBox3.Text=MyImage.GetPixel(Convert.ToInt16(textBox1.Text),Convert.ToInt16(textBox2.Text)).Name.ToString(); //textBox3.Text=MyImage.GetPixel(812,16).Name.ToString(); //this.Show(); }