如何在.net环境下设置竖排文字

来源:互联网 发布:付费问答软件 编辑:程序博客网 时间:2024/05/16 05:33

很简单:

            button1.Text = "竖排文字测试";

            //这里面一定要保证button1的宽度大于一个字宽而小于两个字宽

            button1.Size = new System.Drawing.Size((int)button1.Font.Size + 12, label1.Font.Height * button1.Text.Length);

            //设置文字居中

            button1.TextAlign = ContentAlignment.MiddleCenter;

            button1.AutoSize = false;//一定要设为false,不让他自动计算