开发者

Can I rotate strings with string.format() or any other function in c#?

I am trying to rotate a string 90' and displa it vertically on a graph instead of displaying it in the normal horizontal fashion.I am actually using this on a web application (asp.net mvc 2 website) and not a console o开发者_如何学运维r other project .. Is there any built in function or method I can use to achieve that ?


The only thing that has control of the display of a string is the item actually displaying it. Examples are label and textbox controls, graphing controls, etc

The String class itself has no knowledge of what you are going to do with this.

UPDATE
Based on the question update and comments: This is flash specific and has nothing at all to do with .net. You'll need to modify the SWF to display the content at the rotation you want.


How is the string being displayed? string.Format is for altering the textual representation of an object (token substitution, formatting of numbers and dates, etc.); it doesn't actually do anything visual (screen location, font, size, orientation, etc.).

If you're drawing the strings yourself with a Graphics object, take a look at the overloads for DrawString that take a StringFormat object.


You're going to need to use CSS to do this. Here's a tutorial (be aware it can be very browser specific)

http://snook.ca/archives/html_and_css/css-text-rotation


String.Format() only handles the textual aspect...not the styling (location, font, etc.) of the string being displayed.

Since you mention that this is an ASP.NET MVC 2 application, I would suggest using CSS to rotate your text. Here's a good tutorial on how to implement rotation in a cross-browser manner:

Text Rotation with CSS - Snook.ca


It is presentation. C# string has nothing to do to it. Use CSS or JavaScript to do this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜