public Form1()
{
InitializeComponent(); this.TransparencyKey = Color.White; panel1.BackColor = Color.White;
} //用于截取panel1内图像的函数
private void printScreen()
{
Graphics g = Graphics.FromImage(image); Point panelLocation = new Point(0, 0);
panelLocation = panel1.PointToScreen(panelLocation); //PointToScreen——控件相对屏幕的相对坐标 //panelLocation.X\Y是panel1控件相对屏幕的位置;0、0是从image的(0,0)点开始画图
g.CopyFromScreen(panelLocation.X, panelLocation.Y, 0, 0, new Size(240, 320));
pictureBox1.Image = image2;
} private void loadBmp()
{
System.Drawing.Imaging.BitmapData imageData = image.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppRgb); //Get the address of the first line
IntPtr ptr = imageData.Scan0; // Copy the RGB values into the array.
System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes); image.UnlockBits(imageData);
}
private void printBmp()
{
System.Drawing.Imaging.BitmapData image2Data = image2.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppRgb); IntPtr ptr2 = image2Data.Scan0; //将数组里的数据重新装入到image2
System.Runtime.InteropServices.Marshal.Copy(rgbValues, 0, ptr2, bytes); image2.UnlockBits(image2Data);
}
就是这样的,把panel设置成透明的,然后在panel的区域截图,放到picturebox里面,但是有白色的部分,到picturebox里的时候都变成透明的了,不知道怎么回事儿。下面是这种情况的截图。http://photo.163.com/caterpillar12345/big/#aid=64077707&id=6649663826麻烦高手给指教
{
InitializeComponent(); this.TransparencyKey = Color.White; panel1.BackColor = Color.White;
} //用于截取panel1内图像的函数
private void printScreen()
{
Graphics g = Graphics.FromImage(image); Point panelLocation = new Point(0, 0);
panelLocation = panel1.PointToScreen(panelLocation); //PointToScreen——控件相对屏幕的相对坐标 //panelLocation.X\Y是panel1控件相对屏幕的位置;0、0是从image的(0,0)点开始画图
g.CopyFromScreen(panelLocation.X, panelLocation.Y, 0, 0, new Size(240, 320));
pictureBox1.Image = image2;
} private void loadBmp()
{
System.Drawing.Imaging.BitmapData imageData = image.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppRgb); //Get the address of the first line
IntPtr ptr = imageData.Scan0; // Copy the RGB values into the array.
System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes); image.UnlockBits(imageData);
}
private void printBmp()
{
System.Drawing.Imaging.BitmapData image2Data = image2.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppRgb); IntPtr ptr2 = image2Data.Scan0; //将数组里的数据重新装入到image2
System.Runtime.InteropServices.Marshal.Copy(rgbValues, 0, ptr2, bytes); image2.UnlockBits(image2Data);
}
就是这样的,把panel设置成透明的,然后在panel的区域截图,放到picturebox里面,但是有白色的部分,到picturebox里的时候都变成透明的了,不知道怎么回事儿。下面是这种情况的截图。http://photo.163.com/caterpillar12345/big/#aid=64077707&id=6649663826麻烦高手给指教
解决方案 »
- C#如何在已有的Excel模板中添加更多的sheet?
- 如何清除Panel空间的东西!!!
- String 的长度 C#
- C#程序中如何调用某一个的单击事件(如:button3_Click事件)过程?
- 解决就结帖! 往各位高手帮忙下! C#
- 关于Webbrowser和文件目录列表的问题!
- 线程问题:启动线程后如果手动结束?
- 100分变态问题:异步Socket快速发送时导致客户端缓冲区溢出,高手请进。
- combobox能不能显示textbox的样子??
- 关于streamread和数组的问题。
- 在DataGridView添加列的时候, 为什么有时候显示不了数据?
- DataColumn设置默认值的问题
但是把这个去了之后,那个panel就不透明了就显示不了后面的图像了