locked
How to add or insert png or emoticon in a textbox ? RRS feed

  • Question

  • I develop chat box for my project.
    I want add support for emoticons (like msn) to mu chat box.
    Can you tell me simple way to add or insert image (png) in textbox ? (VB code if possible ?  or xaml ? )
    Thanks a lot

    try chat here : UserName : guest / Pass : guest

    http://www.furukoo.fr/furukoov2/TestPage.html


    Thanks a lot

    Yvan

    Saturday, October 17, 2009 5:57 PM

All replies

  • Hello,  I don't think it's possible to add the image in TextBox. You can take a look at this sample http://michaelsync.net/2008/04/14/silverlight-2-beta1-rich-text-viewer

    I got your comment. Do you think that it's so complex? I think it's not that complex.

     

    Saturday, October 17, 2009 11:52 PM
  • try this,

    http://www.codeplex.com/richtextedit

    Sharker Khaleed Mahmud
    Software Developer
    (MCP,MCTS,MCPD[web])

    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.

    Sunday, October 18, 2009 1:59 AM
  • Thanks for quick reply ...

    I got your comment. Do you think that it's so complex? I think it's not that complex.

    Your RichTextBox is fully fonctionalities. Great.

    I just want TextBox whit emoticon support. Il dont need full option like your RichTextBox.
    What is your way for adding msn emoticones and insert in the text ?

    I just want to understand how to.

    Yvan

    Sunday, October 18, 2009 3:19 AM
  • A textbox is inherently a bit limited in what it can do, mainly so we don't have fully-featured high-graphics textboxes for every input method. Basically, all it can hold is text. The ability to actually put an image - an object of its own, inside, a rich textbox is kind of necessary. I might bet that most existing IM clients use something like that. Hope that helps.
    Wednesday, October 21, 2009 7:20 PM
  • I try to learn RichTextBox editeur.
    But they don't work.
    I try :
    - one TextBox for enter message (SendBox)
    - one TextBox for displaying (ChatBox)

    Have you sample ?

    Thanks

    Wednesday, October 28, 2009 6:40 AM
  • Hi Furukoo !

     

    I think we can add image in TextBox, I got your forum link from google while facing same issue.

    Try this :

    <TextBox x:Name="txt" Width="16" Height="16" HorizontalAlignment="Left" BorderThickness="0" Padding="0" Margin="0">
         <TextBox.Background>
             <ImageBrush ImageSource="Images/icon_error.png" />
         </TextBox.Background> 
        </TextBox>

     

    Hope it works.

     

     

     

    Thursday, July 15, 2010 11:22 PM
  • Thanks dheeraj,

    I am trying to use Silverlight 4 RichTextBox.



    Friday, July 16, 2010 3:23 PM
  • You can try this code and this works:

    RichTextBox rtb = new RichTextBox();

    Paragraph _para = new Paragraph();

    InlineUIContainer _inLine = new InlineUIContainer();

     _img.Source = new BitmapImage(new Uri("images/someimage.png", UriKind.RelativeOrAbsolute));
    _img.Width = 20;
    _img.Height = 20;

    _inLine.Child = _img;
     
    _para.Inlines.Add(_inLine);
    _para.Inlines.Add(new LineBreak());

    rtb.Blocks.Add(_para);

    Friday, January 27, 2012 4:54 PM
  • InlineUIContainer is the solution, the unfortunate thing is though that you can't store the whole thing and load it again with some easy to use method (you have to implement it yourself, probably by inserting ASCII for the emoticons in the text and at load time detecting and replacing them - you may need it anyway to allow users to type-in emoticons in classic ASCII form instead of inserting an image from a menu)

    Microsoft MVP J# 2004-2010, Borland Spirit of Delphi 2001

    Tuesday, February 25, 2014 8:17 AM