luckapple2

wpf中textblock竖立显示文本

xaml

<TextBlock HorizontalAlignment="Left" Text="竖立显示文本"  Name="textBlock1" Width="92" />

cs

 

 string s = textBlock1.Text;
            int a = s.Length;
            textBlock1.Text = "";
            for (int i = 0; i < a; i++)
            {
                Run run = new Run();
                run.Text = s.Substring(i, 1);
                LineBreak lb = new LineBreak();
                textBlock1.Inlines.Add(run);
                textBlock1.Inlines.Add(lb);

            }

 

posted on 2009-11-09 22:21  luckapple2  阅读(2416)  评论(1编辑  收藏  举报

导航