public void ToolMouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (varChartPoint != null) { varChartPoint.Select(); //canvas.DeselectAllObject(); if (varConnector != null) { varConnector.Select(); } canvas.DeselectAllObject(); } } }
public void ToolMouseDown(object sender, MouseEventArgs e) { DrawingObject chart = canvas.GetChart(e.Location.X, e.Location.Y); PointArea = chart; this.xInitial = e.X; this.yInitial = e.Y; if (chart != null) { if (e.Button == MouseButtons.Left && canvas != null) { bool isAllowed = false; if (chart.GetPointYAll().Count < 1) { isAllowed = true; } if (isAllowed) { int xChart = chart.GetStartpoint().X; int endyChart = chart.GetStartpoint().Y; int startyChart = chart.GetEndpoint().Y; int temp = e.Y - startyChart; int charty = startyChart + temp; int county = (endyChart - startyChart) / temp; //int yTemp = DrawingObject point; for (int i = 0; i < county; i++) { point = new ChartPoint(new Point(xChart - 6, charty - 3), chart); chart.AddYPoint(point); point.Select(); canvas.AddDrawingObject(point); Text text = new Text(new Point(xChart - 60, charty + temp / 2)); text.Endpoint = new Point(xChart - 6, charty - temp / 2); text.ChangeText((Math.Sqrt(Math.Pow((point.GetStartpoint().Y - this.PointArea.GetEndpoint().Y), 2))).ToString()); chart.AddYLabel(text); canvas.AddDrawingObject(text); this.varChartPoint.Add(point); this.textX.Add(text); charty += temp; } } } } }
public void ToolMouseDown(object sender, MouseEventArgs e) { DrawingObject chart = canvas.GetChart(e.Location.X, e.Location.Y); PointArea = chart; this.xInitial = e.X; this.yInitial = e.Y; if (chart != null) { if (e.Button == MouseButtons.Left && canvas != null) { bool isAllowed = false; if (chart.GetPointXtAll().Count < 1) { isAllowed = true; } if (isAllowed) { int yChart = chart.GetEndpoint().Y; int yPointChart = chart.GetStartpoint().Y; int endxChart = chart.GetEndpoint().X; int startxChart = chart.GetStartpoint().X; int temp = e.X - startxChart; int chartx = startxChart + temp; int countx = (endxChart - startxChart) / temp; DrawingObject point; for (int i = 0; i < countx; i++) { ChartPoint varChartPoint = new ChartPoint(new Point(chartx - 3, yPointChart), chart); chart.AddGraphPoint(varChartPoint); canvas.AddDrawingObject(varChartPoint); varChartPoint.Select(); if (chart.GetPointCount() > 1) { DrawingObject Neighbour = chart.GetNeighbourKiri(varChartPoint); Connector connector = new Connector(new Point(Neighbour.GetStartpoint().X + 3, Neighbour.GetStartpoint().Y + 3)); connector.Endpoint = new System.Drawing.Point(varChartPoint.GetStartpoint().X + 3, varChartPoint.GetStartpoint().Y + 3); connector.SetSource(Neighbour); connector.SetDestination(varChartPoint); //varConnector = connector; chart.AddConnectorPoint(connector); canvas.AddDrawingObject(connector); connector.Select(); canvas.DeselectAllObject(); } point = new ChartPoint(new Point(chartx - 3, yChart), chart); chart.AddXPoint(point); point.Select(); canvas.AddDrawingObject(point); Text text = new Text(new Point(chartx - temp / 2, yChart + 6)); text.Endpoint = new Point(chartx + temp / 2, yChart + 33); text.ChangeText("Text" + (i + 1)); chart.AddXLabel(text); canvas.AddDrawingObject(text); this.varChartPoint.Add(point); this.textX.Add(text); chartx += temp; } } } } }