本文介绍了改变任何控件中每个角色的风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过从下拉列表中选择颜色,字体,阴影来动态更改任何控件中每个字符的样式
i am using this code
I want to change the style of every character within any control dynamically by choosing a color,font,shadow from drop down list
i am using this code
string first = txttext.Text;
ViewState["first"] = first;
//ViewState["first"] += first;
//first = ViewState["first"].ToString();
textsize();
Label1.Height = Convert.ToInt32(txtheight.Text);
Label1.Width = Unit.Parse(txtwidth.Text);
Label1.ForeColor = System.Drawing.Color.FromName(ddlMultiColor.SelectedValue);
Label1.BorderColor = System.Drawing.Color.FromName(ddlMultiColor1.SelectedValue);
Label1.Font.Size = FontUnit.Parse(ddlborder.SelectedItem.Text);
this.font = ddlfont.SelectedValue;
this.fcolor = ddlMultiColor.SelectedValue;
this.text = txttext.Text;
this.border = ddlborder.SelectedValue;
this.bcolor = ddlMultiColor1.SelectedValue;
//Size maxsize = new Size(495, int.MaxValue);
//Label1.Height = TextRenderer.MeasureText(Label1.Text, fobj, maxsize).Height;
Label1.Font.Name = ddlfont.SelectedItem.Text;
Label1.BorderWidth = Convert.ToInt32(ddlborder.SelectedValue);
Label2.Text = Label1.Width.ToString();
lblheight.Text = Label1.Height.ToString();
//ViewState["first"] = txttext.Text;
second = ViewState["first"].ToString();
ViewState["second"] += second;
second = ViewState["second"].ToString();
Label1.Text += second;
但文字样式与插入的最后一个字符相同.......
but style of text is same as of the last character inserted.......
推荐答案
这篇关于改变任何控件中每个角色的风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!