当我点击button1时,我想在表单上创建10个按钮.下面的代码没有错误,但它也不起作用.
private void button1_Click(object sender, EventArgs e)
{
List<Button> buttons = new List<Button>();
for (int i = 0; i < buttons.Capacity; i++)
{
this.Controls.Add(buttons[i]);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在研究链表,并找到了一个样本.在那个样本中它说
while (currNode && index > currIndex)
所以在这里,什么是currNode的布尔值?
我正在进行数值分析项目,我想在表格上绘制图形和抛物线.我只想绘制抛物线x² - 2x - 1.那么,我该怎么做呢?
示例代码:
g = this.CreateGraphics();
p = new Pen(Brushes.WhiteSmoke,1);
s = new SolidBrush(Color.Blue);
g.DrawString("x", this.Font, s, x1, y0 + 10);
g.DrawString("y", this.Font, s, x0 - 5, y2 - 20);
g.DrawRectangle(p, 400, 100, 300, 300);
for (int i = 0; i < 300; i += 30)
{
line(400, 100 + i, 700, 100 + i);
}
public void line(int x, int y, int x1, int y1)
{
g = this.CreateGraphics();
p = new Pen(Brushes.Gray, 1); …Run Code Online (Sandbox Code Playgroud)