char或fontc的ascii值 [英] char or ascii value of fontname

查看:130
本文介绍了char或fontc的ascii值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


i在我们的系统中存储一个font-name上的应用程序。



i带来所有字体 - 在winfroms中从系统到网格的名称。

然后

当我点击网格时,我想要运行时标签中的所有char或ASCII值(256个标签)单击字体名称。

然后我再次单击字体,然后应该销毁或删除以前的运行时标签,并且新的运行时标签和过程继续进行。



plz尽快帮助我





解决方案

但它看起来很好,你好b / u
u有任何想法解决它




它可能看起来很不错,但是你需要多长时间才能设置好?小时?现在,要更改字体,您需要单独重新访问每个单独的标签并设置字体 - 如果您的表单上有任何其他标签(正如您通常那样,或将来可能会添加),这会很痛苦因为他们做了很多,自动化过程要困难得多,而不是通过名字访问每个控件...



如果您使用了基于网格的控件,那么一块蛋糕......



在表单中添加DataGridView。设置以下属性:

 AllowUserToAddRows =  false ; 
AllowUserToDeleteRows = false ;
AllowUserToResizeColumns = false ;
AllowUserToResizeRows = false ;
ColumnHeadersVisible = false ;
ReadOnly = true ;
RowHeadersVisible = false ;
Size = new System.Drawing.Size( 403 355 );





然后,在您的表单加载事件中:

< pre lang =cs> for int c = 0 ; c < 16 ; c ++)
{
DataGridViewColumn col = new DataGridViewTextBoxColumn();
col.Width = 25 ;
col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
col.Visible = true ;
dataGridView1.Columns.Add(col);
}
char ch = ' \0' ;
for int r = 0 ; r < 16 ; r ++)
{
string [] data = new string [ 16 ];
for int i = 0 ; i < 16 ; i ++)
{
data [i ] = ch ++。ToString();
}
dataGridView1.Rows.Add(data);
}



现在,当您想要更改所有字符的字体样式时,您所要做的就是设置DataGridView.DefaultCellStyle.Font属性,系统将完成其余的工作......


hi
i make one application on font-name which are store in our system.

i bring all font-name from system to grid in winfroms.
then
when i click on grid, i want all char or ASCII value in run-time label(256 labels) of fontname which is click.
then i again click the font, then previous run-time labels should be destroy or remove, and comes new run-time labels and process go on.

plz help me as soon as possible


解决方案

"but it looks perty good yr
u have any idea to solve it"


It may "look pretty good", but how long did it take you to set up? Hours? And now, to change the font, you need to revisit each and every single label individually and set the font - which is a pain if you have any other labels on your form (as you normally do, or might well add in the future) because they make it a lot, lot harder to automate the process instead of visiting each control by name...

If instead you had used a grid based control, it's a piece of cake...

Add a DataGridView to your form. Set the following properties:

AllowUserToAddRows = false;
AllowUserToDeleteRows = false;
AllowUserToResizeColumns = false;
AllowUserToResizeRows = false;
ColumnHeadersVisible = false;
ReadOnly = true;
RowHeadersVisible = false;
Size = new System.Drawing.Size(403, 355);



Then, in your form load event:

for (int c = 0; c < 16; c++)
    {
    DataGridViewColumn col = new DataGridViewTextBoxColumn();
    col.Width = 25;
    col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
    col.Visible = true;
    dataGridView1.Columns.Add(col);
    }
char ch = '\0';
for (int r = 0; r < 16; r++)
    {
    string[] data = new string[16];
    for (int i = 0; i < 16; i++)
        {
        data[i] = ch++.ToString();
        }
    dataGridView1.Rows.Add(data);
    }


Now, when you want to change the font style for all the characters, all you have to do is set the DataGridView.DefaultCellStyle.Font property, and the system will do the rest...


这篇关于char或fontc的ascii值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆