这是CSDN的VC论坛上的一个老FAQ了。我在写自定义在RichEdit中插入对象的图标(http://www.blogcn.com/user3/jiangsheng/blog/1319738.html)这片文章的时候就是想用这个技术做动画GIF的,但是怎么判断一个内嵌在RichEdit的对象是GIF这个问题一直没有解决。好在QQ附带的一个控件支持动画GIF,可以插入这个对象来解决问题。
然后在定时器的处理函数里面通知GIF控件更新显示。
首先需要一个定时器来定时更新GIF。
public: System::Void OnLoad(System::Object^ sender, System::EventArgs^ e)
{
this->typingRichTextBox->RichTextShortcutsEnabled=false;
this->timer1->Start();
}
private: System::Void OnFormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e)
{
this->timer1->Stop();
this->frameClosing=true;
}
然后在定时器的处理函数里面通知GIF控件更新显示。
private: System::Void OnTimer1Elapsed(System::Object^ sender, System::Timers::ElapsedEventArgs^ e)
{
if(this->frameClosing==false)
UnmanagedGifTriggerFrameChange(this->contentRichTextBox->Handle.ToInt32());
}