GDI+ DrawImage使用?
Gdiplus::Bitmap GpBmp(WideString("Climber.jpg"));
HBITMAP HBmp;
GpBmp.GetHBITMAP(0, &HBmp);
Image2->Picture->Bitmap->Handle = HBmp;
Gdiplus::Graphics gr(Image3->Canvas->Handle);
gr.SetInterpolationMode(InterpolationModeHighQualityBilinear);
gr.DrawImage(&GpBmp, Gdiplus::Rect(0, 0, Image3->Width, Image3->Height), 20, 20, 100, 100, UnitPixel);//UnitPixel
上面这段代码是把Image2的部分缩放到Image3上,如果采用像素为单位可以,如果采用英寸就不行,怎么办?
Gdiplus::Bitmap GpBmp(WideString("Climber.jpg"));
HBITMAP HBmp;
GpBmp.GetHBITMAP(0, &HBmp);
Image2->Picture->Bitmap->Handle = HBmp;
Gdiplus::Graphics gr(Image3->Canvas->Handle);
gr.SetPageUnit(Gdiplus::UnitInch ); //UnitInch 用英寸为单位
gr.SetInterpolationMode(InterpolationModeHighQualityBilinear);
gr.DrawImage(&GpBmp, Gdiplus::Rect(0, 0, Image3->Width, Image3->Height), 0, 0, 1, 1, UnitInch);
这样就画不出图来,0, 0, 1, 1,怎么改都不行,请问是怎么回事?