Click here to Skip to main content
16,018,664 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello
i want to change the array elemnts font to italics.
can any body help me plz...
regards
haseeb
Posted

You cannot change the font of an array or any other code construct.

What you probably want to do is change the font of the control that is displaying values of the array.
For e.g. the textbox has a fontstyle that can be used - textbox.Font = new Font(this.Font, FontStyle.Italic);
 
Share this answer
 
Comments
haseebsvirgo 26-Jun-11 2:45am    
i know that but what i want to do is change array element to italics.
e.g
haseeb is my friend.

so change friend word to italics in a sentence.
haseebsvirgo 26-Jun-11 2:47am    
lets assume friend word is in an array
Abhinav S 26-Jun-11 2:55am    
Ok. This can not be done in a normal text box.
Try using a Rich Text Box - see this sample.
An array does not have a font. It doesn't have a color, it doesn't have a size - only User Interface (UI, or GUI) elements such as TextBox, Label, Button, and RichTextBox have these. An array of strings for example will only have strings as its content - which have a length, and a set of characters, but very little else.

If you want to display some text differently to other strings within the same control, then you need to look at the correct UI control, (a RichTextBox, for example) or write your own control and possibly class to hold the array elements.
 
Share this answer
 
You cannot change, or even set, a font in an array such as you describe. However you could create a class that has a font (or font values) as one of its properties, and then store your elements as objects of that class, each with its own font property. Then when displaying your data you set each element's font as you display it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900