求教,VCL中如何使图像按指定角度旋转
比如我有40x40的图像,要旋转30度,如何实现?
[解决办法]
http://download.csdn.net/source/1424476希望对你有用!!
[解决办法]
如果要求不是很高的话,可以直接用SetWorldTransform搞定,不过没有GDI+那么好看
void __fastcall InsertBmpToRich(TRichEdit *re, WideString wstrBmpFile){ IRichEditOle *RichOle; SendMessage(re->Handle, EM_GETOLEINTERFACE, 0, int(&RichOle)); ILockBytes *FLockBytes; CreateILockBytesOnHGlobal(0,1,&FLockBytes); IStorage *FStorage; StgCreateDocfileOnILockBytes(FLockBytes,STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE,0,&FStorage); TFormatEtc FormatEtc; FormatEtc.cfFormat=0; FormatEtc.ptd=NULL; FormatEtc.dwAspect=DVASPECT_CONTENT; FormatEtc.lindex=-1; FormatEtc.tymed=TYMED_NULL; IOleObject *FOle; OleCreateFromFile(GUID_NULL, wstrBmpFile, ::IID_IOleObject, 0, &FormatEtc, NULL, FStorage, (void**)&FOle); OleSetContainedObject(FOle, true); REOBJECT ReObject; ZeroMemory(&ReObject, sizeof(REOBJECT)); ReObject.cbStruct=sizeof(REOBJECT); CLSID xt; FOle->GetUserClassID(&xt); ReObject.clsid=xt; ReObject.cp=REO_CP_SELECTION; ReObject.dvaspect=DVASPECT_CONTENT; ReObject.dwFlags=REO_STATIC | REO_BELOWBASELINE; ReObject.dwUser=0; ReObject.poleobj=FOle; IOleClientSite *FClientSite; RichOle->GetClientSite(&FClientSite); ReObject.polesite=FClientSite; ReObject.pstg=FStorage; ReObject.sizel.cx=0; ReObject.sizel.cy=0; RichOle->InsertObject(&ReObject);}//---------------------------------------void __fastcall TForm1::FormCreate(TObject *Sender){ AnsiString str = "D:\\ydlchina\\01.bmp"; InsertBmpToRich(RichEdit1,WideString(str));}