c# 动态添加lable,怎么让lable里的字左对齐
Label lblbl = new Label();lblbl.BackColor = System.Drawing.Color.BurlyWood;
lblbl.Width = GridViewShowAll.Width;
lblbl.Height = 25;
lblbl.Font.Name = "微软雅黑";
lblbl.Font.Size = 12;
lblbl.Text = "此专业需求比例为:" + "本科生:" + benbl.ToString() + "硕博:" + sbbl.ToString();
让左对齐的是什么属性啊 --------------------编程问答-------------------- TextAlign属性。 --------------------编程问答-------------------- TextAlign这个属性没有啊,我是动态创建的 --------------------编程问答-------------------- Label lblbl = new Label();
lblbl.BackColor = System.Drawing.Color.BurlyWood;
lblbl.Width = GridViewShowAll.Width;
lblbl.Height = 25;
lblbl.Font.Name = "微软雅黑";
lblbl.Font.Size = 12;
lblbl.TextAlign = ContentAlignment.MiddleLeft;
lblbl.Location = new Point(x, y);//?
lblbl.Text = "此专业需求比例为:" + "本科生:" + benbl.ToString() + "硕博:" + sbbl.ToString();
默认就是左对齐的啊?
是不是你生成了多个label,位置没有放整齐?
--------------------编程问答-------------------- 帮忙顶一下,很感兴趣 --------------------编程问答-------------------- 是这个属性。。。 --------------------编程问答-------------------- 除 --------------------编程问答-------------------- 换行能达到你的效果不?? --------------------编程问答--------------------
--------------------编程问答-------------------- label.TextAlign = ContentAlignment.TopLeft; --------------------编程问答-------------------- winform
Label label=new Label();
label.TextAlign = ContentAlignment.TopLeft;
lblbl.TextAlign = ContentAlignment.TopLeft;
webform
lblbl.Style["text-align"] = "left"; --------------------编程问答--------------------
lbl.TextAlign = ContentAlignment.MiddleLeft;--------------------编程问答-------------------- lblbl.TextAlign = ContentAlignment.MiddleLeft;
跟动态创建没关系
补充:.NET技术 , C#