示例#1
0
文件: Form1.cs 项目: fiftin/Pengball
 private void btnAddFixture_Click(object sender, EventArgs e)
 {
     using (CreateFixtureDialog dialog = new CreateFixtureDialog())
     {
         if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             var fixture = new Fixture(dialog.FixtureName);
             body.AddFixture(fixture);
         }
     }
 }
示例#2
0
文件: Body.cs 项目: fiftin/Pengball
 public FixtureEventArgs(Fixture fixture)
 {
     Fixture = fixture;
 }
示例#3
0
文件: Body.cs 项目: fiftin/Pengball
 public void AddFixture(Fixture fixture)
 {
     fixtures.Add(fixture.Name, fixture);
     if (FixtureAdded != null)
         FixtureAdded(this, new FixtureEventArgs(fixture));
 }
示例#4
0
文件: Form1.cs 项目: fiftin/Pengball
 private void lstFixtures_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lstFixtures.SelectedItems.Count > 0)
     {
         selectedFixture = body.Fixtures[lstFixtures.SelectedItems[0].Name];
     }
     else
     {
         selectedFixture = null;
     }
     FillFixtureViewControls();
     canvas.Draw();
 }
示例#5
0
文件: Form1.cs 项目: fiftin/Pengball
        private void DrawFixture(Fixture fixture, Color color, Graphics g)
        {
            var vertices = fixture.GetVertices();
            if (vertices.Length > 2)
            {
                g.DrawClosedCurve(new Pen(color), vertices, 0, System.Drawing.Drawing2D.FillMode.Winding);
            }

            for (var i = 0; i <vertices.Length; i++)
            {
                var vertex = vertices[i];
                g.FillEllipse(new SolidBrush(color), vertex.X - 2, vertex.Y - 2, 4, 4);
                g.DrawString(i.ToString(), pnlCanvas.Font, new SolidBrush(color), vertex.X - 4, vertex.Y - 15);
            }
        }