R Insert an animationcontrol in RichtextBox

xiaoxiao2021-03-06  18

http://blog.9cbs.net/gloser/

Inserting a picture in RichTextBox, but generally can't move, to achieve an animation at least an ActiveX control, but .NET has a poor support for ActiveX, I tried to write an ActiveX with C #, but the effect is very poor, fundamental I can't move long time.

(Remarks) Almost here is from others' C code (Jiang Wei) and MSDN (so I am not a master)

This is some of my code (with deletion) in GOWK to learn together.

Using system; using system.windows.forms; using system.runtime.interopservices;

USING GOWK.COMMON;

namespace gowk.controls {public class GRichTextBox_: RichTextBox {public GRichTextBox_ () {} #region insert ole public void Insersert (IOleObject oleObj) {RichEidtOle ole = new RichEidtOle (this); ole.InsertOle (oleObj);} public void Insersert ( Control control) {RichEidtOle ole = new RichEidtOle (this); ole.InsertControl (control);} public void InsertImage (string imageFile) {Image img = Image.FromFile (imageFile); Type t = Type.GetTypeFromProgID ( "ImageOle.GifAnimator .1 "); Object o = system.activator.createInstance (T); BOOL B = O is ioleObject; if (! B) throw (" Unable to create OLE object "); T. InvokeMember (" LoadFromFile ", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod, null, o, new object [] {imageFile}); if (b) this.Insersert ((IOleObject ) o);} class richeidtole {private richtextbox _richedit; private ironheditole _richeditole; public richeidtole (richtextbox richedit) {This._richEdit = richEdit;} private IRichEditOle IRichEditOle {get {if (this._RichEditOle == null) {this._RichEditOle = SendMessage (this._richEdit.Handle, API.EM_GETOLEINTERFACE, 0);} return this._RichEditOle;} } public void InsertControl (Control control) {if (control == null) return; IntPtr pLockBytes = API.CreateILockBytesOnHGlobal (IntPtr.Zero, true); IntPtr pStorage = API.StgCreateDocfileOnILockBytes (pLockBytes, STGM.STGM_SHARE_EXCLUSIVE | STGM.STGM_CREATE | STGM .Stgm_readwrite, 0); INTPTR POLECLIENTSITE = THIS.IRICHEDITOLE.GETCLIENTSIENTSIENTSIENTSIENTSIENTSIENTSITETE (); Reobject RoeObject = New Reobject (); RoeObject.clsid =

转载请注明原文地址:https://www.9cbs.com/read-41893.html

New Post(0)