谁有RZrichedit 插入图片的DEMOS呀 ?(20分)

  • 主题发起人 主题发起人 zengguocai
  • 开始时间 开始时间
Z

zengguocai

Unregistered / Unconfirmed
GUEST, unregistred user!
谁有RZrichedit 插入图片的DEMOS呀 ?
或者发表一下插入图片的代码.小弟感激不尽..
EMAIL:zengguocai001@163.com
 
在Delphi中就有一个显示GIF动画的DEMO.
 
没找到哦..我D7版的..你是哪个版本呀?在问一下,,你看到的那个插入GIF的DEMO是用什么控件做的?
 
procedure RichEditAddGifAnimator(GifFile:string;Editor:TRxRichEdit);
type
tagSize = TSize;
var
FRTF: IRichEditOle;
FLockBytes: ILockBytes;
FStorage: ISTORAGE;
FClientSite: IOLECLIENTSITE;
clsid: TGUID;
m_lpObject: IOleObject;
m_lpAnimator: TGifAnimator;
i_GifAnimator: IGifAnimator;
reobject: TReObject;
sizel: tagSize;
Rect: TRect;
begin
try
if CreateILockBytesOnHGlobal(0, True, FLockBytes) <> S_OK then
begin
showmessage('Error to create Global Heap');
exit;
end;
//建立一个混合文档存取对象
if StgCreateDocfileOnILockBytes(FLockBytes, STGM_SHARE_EXCLUSIVE or STGM_CREATE or STGM_READWRITE, 0, FStorage) <> S_OK then
begin
showmessage('Error to create storage');
exit;
end;
//取得RichEdit的接口
Sendmessage(Editor.handle, EM_GETOLEINTERFACE, 0, LongInt(@FRTF));
if FRTF.GetClientSite(FClientSite) <> S_OK then
begin
showmessage('Error to get ClentSite');
exit;
end;
CoInitializeEx(nil, COINIT_APARTMENTTHREADED);
m_lpAnimator := TGifAnimator.Create(Application);
i_GifAnimator := m_lpAnimator.ControlInterface;
i_GifAnimator.LoadFromFile(GifFile);
i_GifAnimator.QueryInterface(IID_IOleObject, m_lpObject);
OleSetContainedObject(m_lpObject, True);
FillChar(reobject, SizeOf(reobject), 0);
reobject.cbStruct := SizeOf(reobject);
m_lpObject.GetUserClassID(clsid);
reobject.clsid := clsid;
reobject.cp := REO_CP_SELECTION;
//content, but not static
reobject.dvaspect := DVASPECT_CONTENT;
reobject.dwFlags := REO_BELOWBASELINE; //REO_RESIZABLE |
reobject.dwUser := 0;
//the very object
reobject.poleobj := m_lpObject;
//client site contain the object
reobject.polesite := FClientSite;
//the storage
reobject.pstg := FStorage;
sizel.cx := 0;
sizel.cy := 0;
reobject.sizel := sizel;
FRTF.InsertObject(reobject);
Sendmessage(Editor.handle, EM_SCROLLCARET, 0, 0);
//VARIANT_BOOL ret;
//do frame changing
m_lpAnimator.TriggerFrameChange();
//show it
m_lpObject.DoVerb(OLEIVERB_UIACTIVATE, nil, FClientSite, 0, Editor.handle, Rect);
// m_lpObject.DoVerb(
m_lpObject.DoVerb(OLEIVERB_SHOW, nil, FClientSite, 0, Editor.handle, Rect);
//redraw the window to show animation
redrawwindow(Editor.handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_FRAME or RDW_ERASENOW or RDW_ALLCHILDREN);
finally
FRTF := nil;
FClientSite := nil;
FStorage := nil;
end;
end;
 
TO Pau1 请问一下你在函数里面定义的那些变量需要引用哪些单元呀?
 
windows.pas
InsRich.pas
ActiveX.pas
system.pas
ImageOle_Lib_TLB.pas
 
TO  paul
两天没上线了..你给的这些unit 单元我都引用了.但还是通不过.你可以做个简单的DEMO发到我的邮箱里面吗?谢谢.
 
多人接受答案了。
 
后退
顶部