求VC++载入并显示JPG图片的源代码

求VC++载入并显示JPG图片的源代码,第1张

原型:冲尺

int WINAPI icePub_dispImg(HWND hWnd,char *strImgFilename,int x,int y)

输入:hWnd 窗明弯体或控件句柄

strImgFilename 待显示的图片文件名

x x坐标

y y坐标

输出激判闷:

{

typedef int (WINAPI ICEPUB_DISPIMG)(HWND hWnd,char *strImgFilename,int x,int y)

ICEPUB_DISPIMG *icePub_dispImg = 0

HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll")

if(hDLLDrv)

{

icePub_dispImg = (ICEPUB_DISPIMG *)GetProcAddress(hDLLDrv, "icePub_dispImg")

}

if(icePub_dispImg != NULL)

icePub_dispImg(m_hWnd,"b.png",10,10)

// icePub_dispImg(m_ctrlText.m_hWnd,"b.jpg",0,0)

if(hDLLDrv)

FreeLibrary(hDLLDrv)

}

TCanvas *ca=new TCanvas

Graphics::TBitmap b1=new Graphics::TBitmap()

Graphics::TBitmap b2=new Graphics::TBitmap()

Graphics::TBitmap b3=new Graphics::TBitmap()

b1->Picture->LoadFromFile(pic1)

b2->Picture->LoadFromFile(pic2)

b3->Picture->Width=b1->Picture->简枝橘Width+b2->Picture->Width//此处可以耕具实拦团际情况更改

b3->Picture->Height=b1->Height>b2->Height?b1->Height:b2->Height处可以耕具实际情况更改

b3->Canvas->CopyRect(b1->ClientRect,b1->ClientRect,scrCopy)

b3->搭羡Canvas->CopyRect(TRect(b1->Width,0,b1->Width+b2->Width,b2->Height),b2->ClientRect,scrCopy)

b3->Picture->SaveToFile(pic3)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12453754.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存