Placing images in textBox - xaml

How can I place images in a XAML TEXTBOX?
I am looking for a control that I could place an image and a text next to it and it have to be
scrollable.

Use a RichTextBox. It provides functionality to display Text and Images.

Related

Transparent PNG over labels and textboxes on my .Net form

I have a project where I want to place a png on the form like a "Rubber Stamp". I have the transparent *.png but I need it to be transparent on TOP of all the textboxes, labels, etc. Every time that I use a label or picturebox to hold the image, you still see the form background. It's not being brought transparent on top.
Any assistance is appreciated.
Assuming I understood your question right, let's say you have a PictureBox called PictureBox1, and a Label called Label1, and you've placed PictureBox1 in front of Label1, and the PictureBox has a transparent background. In the form's load event:
PictureBox1.Parent = Label1
If this doesn't work, try adding
PictureBox1.BringToFront()

tabpage icon change on text change

I have a tab_control on a form and couple of tab_pages. Each tab_page has some controls like text_box, check_box etc. I have assigned an image list to tab_control and have assigned image_key property with respective image.
Now what I want to achieve is, when the text changes in any of the tab_page the image of respective tab_page should also change.
Please be informed that I am not talking about background image, I am talking about icons of tab_pages.
Thanks

Positioning Image and Text in a button

I have a Button on my Form. I want to have an image on the left and text on the right like :
Image Text
But the problem is that image is not stretched here. I mean it does not fit the button.
So I tried to set the BackGroundImage Property instead of Image Property.
Now I get the Image stretched. But I cant get the proper Format. I mean now I cant get Image on the left and Text on the right.
Is there any other control which I can use instead of button to Overcome this problem?
The button has a TextImageRelation property, set it to ImageBeforeText. Set the Image property with your image and there you go.
I don't think using stretch will in any case. How is it supposed to determine the border to stretch to?
With the imagealign set middleleft and the textalign set middleright I was able to make this button, it's 82X48. The image I used is 52X39. I used paint to resize the image.
A simple method that may work out good is to put both an image and button inside a panel. This gives you the flexibility of text placement, image scaling and use anchor or dock options to size the controls with the panel and form. Not tested but sounds like it could work...
If you used Button control .. and you want to add image to it
Create New Button and do domething in it's properties
Image : you can insert an image from anywhere (local or resource)
ImageAlign : Set it to Middle Left
TextAlign : Set it to Middle right
It tested on VB.NET 2005
To change a button's image size, you can use the image property . Your image will be resized to you specific dimension
Button2.Image = Image.FromFile("c:\image.jpg").GetThumbnailImage(20, 20, Nothing, IntPtr.Zero)

Resize buttons styled with AppBarButtonStyle

I like the AppBarButtonStyle idea of using font character as button icon because of its scaling abilities, but it is of no use if i cannot resize them properly.
Changing Width or Height of button does not work, because AppBarButtonStyle only resizes padding between button icon and button borders. Changing FontSize of button does not work either.
Is there any way of resizing buttons styled with AppBarButtonStyle in WinRT application? I dont mind if i have to override or modify AppBarButtonStyle, as long as it preserves the ability to use font character as button icon.
Any useful advices will be appreciated!
You can easily create your own custom button from AppBarButtonStyle from the original in the standardstyles.xaml .
I did so to create a custom smaller button with no text and the only hard part was aligning everything: you're not adding shapes, you're adding a character, so it may not be as aligned as you think. Default Buttons contain 3 charatctes: outline, fill and glyph.
If you want, I can share my simplified code for the control.

Tips on implementing a custom UITextView interface on the iPhone?

I am trying to implement a control to edit text that will display the text in multiple colors. None of the solutions I have attempted yet have been good enough.
UITextView cannot accomplish this. All of the text must be the same color.
Using CoreGraphics to draw the text does not allow the text to be selected.
Using a UIWebView, DIV and PRE tags cannot be set to contentEditable on Mobile Safari.
Currently playing with using an off-screen TEXTAREA and an on-screen DIV to show the rendered text. This works pretty well, except supporting all of these at the same time seems impossible: click-to-type, click-to-move-cursor, click-and-hold-select/copy/paste.
Anyone have any tips on this predicament?
I've been trying to find any preexisting library out there that will accomplish this in a good way, to no luck. I'm open to any ideas!
Well, just pulling an idea out of my... let's say hat.
Could you put a transparent UITextfield over a view that draws the text? If the background was clear and the text color was clear the user could not perceive it but it should still respond to all commands. As the user enters and edits text you could draw the results on the view underneath.
I think the selection would work without any modification at all. When the user selected the clear text, it should create the illusion of selecting the drawn text automatically.
Like this one? StyledText http://three20.info/gfx/overview/styledtext.png It's in Three20 .
Here is an idea. I have no idea if it would work.
If you are only using colors, and not styles, the a UIWebView with colored text might layout text in exactly the same way as a UITextView. You could put a UITextView with invisible ink (text and background fully transparent) over a UIWebView and mirror the contents with colors in the html. I assume you can do scrolling with javascript along with the colored layout.