我正在尝试做一个逻辑门程序。我正在尝试PictureBox
使用 NOT 类创建一个,问题是当我在 form1 中调用 create 方法时它不会出现,而PictureBox
当我单击列表项时它不会出现。问题是(我认为)即使我使用该FindForm()
方法,它也不知道它在 form1 中。并从表格中调用它
---Source Code for NoT class---
class NOT: Shape
{
PictureBox px = new PictureBox();
Image img = Image.FromFile(@"C:\NOT.png");
public NOT(int x, int y) : base(x,y)
{
px.FindForm();
px.Visible = true;
px.Enabled = true;
}
public override void CreatePicture()
{
Point p1 = new Point(xx, yy);
px.Image = img;
px.Location = p1;
px.Show();
}
}
---Source code for the SHape Class---
abstract class Shape
{
protected int xx, yy; //private Point location;
public Shape(int X, int Y)
{
xx = X;
yy = Y;
}
public abstract void CreatePicture();
}
private void nOTToolStripMenuItem_Click(object sender, EventArgs e)
{
nt.CreatePicture();
}
NOT nt = new NOT(12,23);