WPF TextBlock Text Portrait arrangement

Source: Internet
Author: User

I. The TextBlock text is arranged vertically with two modes of output.

1. Text is placed normally, just vertically.

2. The text also rotates 90 degrees, arranged vertically.

Two. See examples below

1. Normal placement of text, vertical arrangement.

(1) Backstage Code

string s = text01. Text;             "" ;             int a = s.length;              for (int0; i < A; i++) {                1) +"\ n";

(2) Front code

        <textblock name="text01" text=" input and output " textwrapping="  Wrap"/>

(3) Effect

(4) principle

Each time you get a character for the text, then wrap it, get the next character, continue wrapping, and loop to the end of all the characters.

2. The text is placed in a normal, vertical arrangement in another way.

(1) Code

        <textblock name="text01" textwrapping="Wrap" text="  input and output "  margin="30,10" fontsize="20   "width="/>

(2) Effect

(3) principle

You can do this by setting the width of the TextBlock smaller and then wrapping it automatically.

3. The text also rotates 90 degrees, arranged vertically.

(1) Code

<Grid> <Grid.RowDefinitions> <rowdefinition height="Auto"/> <rowdefinition height="*"/> </Grid.RowDefinitions> <textblock name="text01"text="Input and Output"textwrapping="Wrap"height=" -"Horizontalalignment=" Left"Fontsize=" -"margin="30,10"> <TextBlock.LayoutTransform> <rotatetransform angle=" -"/> </TextBlock.LayoutTransform> </TextBlock> </Grid>

(2) Effect

3. Principle: Just use a rotation method.

WPF TextBlock Text Portrait arrangement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.