在C#中对Form类定义的是哪个模块?声明和方法应该放在程序的什么位置?
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Da...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication504
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
linkLabel1.Links.Clear();
linkLabel1.Links.Add(2, 24, "http://www.microsoft.com");
linkLabel1.Links.Add(29, 5, "http://www.yahoo.com");
GetFontFamilies();
cbxFont.SelectedIndex = 1;
lbxSize.SelectedIndex = 1;
}
private void Form1_Load(object sender, EventArgs e)
{
}
请问下面这个程序块应该放在什么位置才对啊?
private string[] fontFamilyNames; //声明
private void GetFontFamilies()//方法
{
Graphics g = this.CreateGraphics();
FontFamily[] ffs = FontFamily.GetFamilies(g);
fontFamilyNames = new string[ffs.Length];
for (int i = 0; i < ffs.Length; i++)
{
fontFamilyNames[i] = ffs[i].Name;
cbxFont.Items.Add(ffs[i].Name);
}
} 展开
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication504
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
linkLabel1.Links.Clear();
linkLabel1.Links.Add(2, 24, "http://www.microsoft.com");
linkLabel1.Links.Add(29, 5, "http://www.yahoo.com");
GetFontFamilies();
cbxFont.SelectedIndex = 1;
lbxSize.SelectedIndex = 1;
}
private void Form1_Load(object sender, EventArgs e)
{
}
请问下面这个程序块应该放在什么位置才对啊?
private string[] fontFamilyNames; //声明
private void GetFontFamilies()//方法
{
Graphics g = this.CreateGraphics();
FontFamily[] ffs = FontFamily.GetFamilies(g);
fontFamilyNames = new string[ffs.Length];
for (int i = 0; i < ffs.Length; i++)
{
fontFamilyNames[i] = ffs[i].Name;
cbxFont.Items.Add(ffs[i].Name);
}
} 展开
展开全部
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication504
{
public partial class Form1 : Form
{ //此处加入上面的程序块
public Form1()
{
InitializeComponent();
linkLabel1.Links.Clear();
linkLabel1.Links.Add(2, 24, "http://www.microsoft.com");
linkLabel1.Links.Add(29, 5, "http://www.yahoo.com");
GetFontFamilies();
cbxFont.SelectedIndex = 1;
lbxSize.SelectedIndex = 1;
}
private void Form1_Load(object sender, EventArgs e)
{
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication504
{
public partial class Form1 : Form
{ //此处加入上面的程序块
public Form1()
{
InitializeComponent();
linkLabel1.Links.Clear();
linkLabel1.Links.Add(2, 24, "http://www.microsoft.com");
linkLabel1.Links.Add(29, 5, "http://www.yahoo.com");
GetFontFamilies();
cbxFont.SelectedIndex = 1;
lbxSize.SelectedIndex = 1;
}
private void Form1_Load(object sender, EventArgs e)
{
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询