private void Create_Click(object sender, EventArgs e) { CreateRockFormation createRockFormation = new CreateRockFormation(); createRockFormation.DataChange += new EFS.CreateRockFormation.EventHandler(CreateRockFormationDelegate); createRockFormation.ShowDialog(); }
/// <summary> /// 修改岩层事件委托 /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void ModifyRockFormationDelegate(object sender, CreateRockFormation.DrawEventArgs args) { RockFormation rockFormation = new RockFormation(args.Name, args.Speed, args.Density, args.Color); rockFormations[args.Index] = rockFormation; GraphPane myPane = zedGraphControl.GraphPane; LineItem myCurve = (LineItem)myPane.CurveList[args.Index]; myCurve.Line.Fill = new Fill(args.Color); CreateRockFormation createRockFormation = (CreateRockFormation)sender; createRockFormation.Close(); zedGraphControl.Refresh(); }
/// <summary> /// 新建岩层窗口确定事件委托 /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void CreateRockFormationDelegate(object sender, CreateRockFormation.DrawEventArgs args) { PointPairList list = new PointPairList(); // get a reference to the GraphPane GraphPane myPane = zedGraphControl.GraphPane; LineItem myCurve = myPane.AddCurve("", list, LineColor, SymbolType.None); // add data to rockFormations rockFormations.Add(new RockFormation(args.Name, args.Speed, args.Density, args.Color)); CreateRockFormation createRockFormation = (CreateRockFormation)sender; createRockFormation.Close(); startDraw.Enabled = true; Modify.Enabled = false; Create.Enabled = false; Goback.Enabled = false; Clear.Enabled = false; }
private void zedGraphControl_MouseDoubleClick(object sender, MouseEventArgs e) { // 获取颜色信息 initBMP(); Color color = GetColor(e.X, e.Y); int length = rockFormations.Count; for (int i = 0; i < length; i++) { if (rockFormations[i].Color.ToArgb() == color.ToArgb()) { CreateRockFormation createRockFormation = new CreateRockFormation(); createRockFormation.name.Text = rockFormations[i].Name; createRockFormation.speed.Text = rockFormations[i].Speed; createRockFormation.density.Text = rockFormations[i].Density; createRockFormation.selectColor.BackColor = rockFormations[i].Color; createRockFormation.Text = "修改岩层属性"; createRockFormation.index = i; createRockFormation.DataChange += new EFS.CreateRockFormation.EventHandler(ModifyRockFormationDelegate); createRockFormation.ShowDialog(); break; } } }