本文整理汇总了C#中Composite.AddToList方法的典型用法代码示例。如果您正苦于以下问题:C# Composite.AddToList方法的具体用法?C# Composite.AddToList怎么用?C# Composite.AddToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composite
的用法示例。
在下文中一共展示了Composite.AddToList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button4_Click
//Open button clicked
private void button4_Click(object sender, EventArgs e)
{
DialogResult result1 = MessageBox.Show(@"Are you sure you want to open a file? Your current document will be gone",
@"Important Question",
MessageBoxButtons.OKCancel);
switch (result1)
{
case DialogResult.Cancel:
break;
case DialogResult.OK:
ClearAll();
OpenFileDialog openFileDialog1 = new OpenFileDialog();
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
StreamReader file =
new StreamReader(openFileDialog1.FileName);
string line;
while ((line = file.ReadLine()) != null)
{
//try
//{
string[] data = line.Split(' ');
if (((data[0])[0]).ToString() == "E")
{
Draw shape = new DrawEllipse((Int16.Parse(data[1])), (Int16.Parse(data[2])), (Int16.Parse(data[3])), (Int16.Parse(data[4])));
_compositeList.Add(shape);
//shapeList.Add(composite);
}
else if (((data[0])[0]).ToString() == "R")
{
Draw shape = new DrawRectangle((Int16.Parse(data[1])), (Int16.Parse(data[2])), (Int16.Parse(data[3])), (Int16.Parse(data[4])));
_shapeList.Add(shape);
}
UpdateControls();
_selected = null;
//}
//catch
//{
// MessageBox.Show(@"shit went terribly wrong");
// ClearAll();
// UpdateControls();
// Invalidate();
// break;
//}
}
Composite composite = new Composite(_compositeList, _shapeList);
composite.AddToList();
}
break;
}
}