C#中hWindowControl显示花屏怎么解决
如图,左边的是picturebox,右边是HalconWindow,为什么HalconWindow花了呢,显示同样的图片,
HalconWindow是经过格式转换的,是不是我转换有问题,我是通过例程里边的回调函数获得IFrameData格式的图片数据,转换代码如下
GX_VALID_BIT_LIST emValidBits;
emValidBits = __GetBestValudBit(objIFrameData.GetPixelFormat());
IntPtr BufferMono = IntPtr.Zero;
BufferMono = objIFrameData.ConvertToRaw8(emValidBits);
HOperatorSet.GenEmptyObj(out ho_Image);
ho_Image.Dispose();
hv_Width = hWindowControl1.Width;
hv_Height = hWindowControl1.Height;
HOperatorSet.GenImage1(out ho_Image, "byte", hv_Width, hv_Height, BufferMono);
hWindowControl1.HalconWindow.SetPart(0, 0, hv_Height, hv_Width);
HOperatorSet.DispObj(ho_Image, hv_ExpDefaultWinHandle);