请问:自己扩展的RichTextBox实现插入QQ表情(附源码)的有关问题

   阅读
请教:自己扩展的RichTextBox实现插入QQ表情(附源码)的问题
自己尝试着扩展.Net的RichTextBox控件,能够实现插入QQ表情,
1. 可是我想写入的文本显示不出来
2. 如何实现在RichTextBox的中的文本末尾插入该表情,且能够用BackSpace键实现删除该表情,就像删除文本一样?
3. 插入多个表情时如何实现?

Imports System.Windows.Forms
Imports System.Drawing


Public Class ExRichTextBox
  Inherits RichTextBox

  'Create a Bitmpap Object.
  Private animatedImage As New Bitmap("shy.gif")
  'Private animatedImage As Image
  Private currentlyAnimating As Boolean = False


  Public Sub New()

  Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
  Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
  Me.SetStyle(ControlStyles.UserPaint, True)
  AnimateImage()
  End Sub


  'This method begins the animation.
  Public Sub AnimateImage()

  If Not currentlyAnimating Then

  'Begin the animation only once.
  ImageAnimator.Animate(animatedImage, New EventHandler(AddressOf Me.OnFrameChanged))
  currentlyAnimating = True
  End If
  End Sub

  Private Sub OnFrameChanged(ByVal o As Object, ByVal e As EventArgs)

  'Force a call to the Paint event handler.
  Me.Invalidate()
  End Sub

  Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  MyBase.OnPaint(e)

  'Get the next frame ready for rendering.
  ImageAnimator.UpdateFrames(animatedImage)

  'Draw the next frame in the animation.
  e.Graphics.DrawImage(Me.animatedImage, New Point(20, 0))

  '下面文本显示不出来
  e.Graphics.DrawString("您好", New Font("Arial", 12, FontStyle.Bold), Brushes.AliceBlue, 0, 0)
  End Sub
end class

------解决方案--------------------
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  

'Get the next frame ready for rendering.
ImageAnimator.UpdateFrames(animatedImage)

'Draw the next frame in the animation.
e.Graphics.DrawImage(Me.animatedImage, New Point(20, 0))

'下面文本显示不出来
e.Graphics.DrawString("您好", New Font("Arial", 12, FontStyle.Bold), Brushes.AliceBlue, 0, 0)
MyBase.OnPaint(e)'这句话应该放在过程的最后面
End Sub
阅读