2016-09-23 4 views
0

私はrichtextboxのテキストを顔文字に変えることができましたが、私は問題があります。vb.net Emoticon in richtextbox transparancy

私は、コードを次のように顔文字にテキストを変更すると、それはgifファイルのtransparancy表示されません。私は、Word文書のうち、まったく同じアイコンをコピーする際に奇妙なことがある

If LCase(MainWindow.RichTextBoxChatRoom.Text).IndexOf(":d") <> -1 Then 
       MainWindow.RichTextBoxChatRoom.Select(LCase(MainWindow.RichTextBoxChatRoom.Text).IndexOf(":d"), 2) 
       Clipboard.SetImage(My.Resources.teeth_smile) 
       MainWindow.RichTextBoxChatRoom.ReadOnly = False 
       MainWindow.RichTextBoxChatRoom.Paste() 
       MainWindow.RichTextBoxChatRoom.ReadOnly = True 
       Empty = Empty + 1 
      End If 

をと私はペーストリッチテキストボックスにマニュアルです。それは完璧に動作します。下の画像を参照してください。これは多分ソリューションをhapeningしている理由

Screenshot RichTextBox

誰かが説明することができます。

答えて

0

あなたRichTextBoxないを行う場合は、背景として画像(ほんの一部の色)を持っている:、おかげ

Using bmp As Bitmap = New Bitmap(My.Resources.teeth_smile.Width, My.Resources.teeth_smile.Height) 'use a bitmap with the same size of your image 
    Using g As Graphics = Graphics.FromImage(bmp) 
     g.Clear(MainWindow.RichTextBoxChatRoom.BackColor) 'set the color of the bitmap the same as RichTextBox 

     g.DrawImage(My.Resources.teeth_smile, 0, 0, My.Resources.teeth_smile.Width, My.Resources.teeth_smile.Height) 'draw your image to bmp 

     Clipboard.SetImage(bmp) 'use the bmp bitmap to paste in RichTextBox 

     MainWindow.RichTextBoxChatRoom.Paste() 
    End Using 
End Using 
+0

働いていました –