コード例 #1
0
ファイル: Form1.cs プロジェクト: prewulen/PolygonCreator
 private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (actions.Count == 0)
     {
         return;
     }
     if ((listBox1.SelectedIndex != SelectedItem || actions.Count == 0) && CanUndo)
     {
         Selected = null;
         if (listBox1.SelectedIndex > SelectedItem)
         {
             for (int i = SelectedItem + 1; i <= listBox1.SelectedIndex; i++)
             {
                 actions[i].Redo(polygons, circles);
             }
         }
         else
         {
             for (int i = SelectedItem; i > listBox1.SelectedIndex; i--)
             {
                 actions[i].Undo(polygons, circles);
             }
         }
     }
     SelectedItem = listBox1.SelectedIndex;
     DrawingField.Refresh();
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: prewulen/PolygonCreator
 private void CompletePoly_Click(object sender, EventArgs e)
 {
     if (polygons.Count != 0)
     {
         if (polygons[polygons.Count - 1].points.Count >= 3)
         {
             polygons[polygons.Count - 1].Completed = true;
             AddAction(new PolygonCompleteAction("Sfinalizowany wielokat", polygons.Count - 1, CompletePoly));
             CompletePoly.Enabled = false;
         }
     }
     DrawingField.Refresh();
 }