private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { Tube currentTube = tubes.Find(tube => tube.isClicked(e.Location)); if (currentTube is Tube) { TubeCoords coords = currentTube.getCoords(); tbPX.Text = coords.row.ToString(); tbPY.Text = coords.col.ToString(); } }
private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { Tube currentTube = tubes.Find(tube => tube.isClicked(e.Location)); if (currentTube is Tube) { TubeCoords coords = currentTube.getCoords(); string toolTipText = "Row: " + coords.row.ToString() + " Col: " + coords.col.ToString(); if (this.toolTipText != toolTipText) { this.tubeTip.Show(toolTipText, this, currentTube.rectanglePosition.x, currentTube.rectanglePosition.y + 35); this.toolTipText = toolTipText; } } else { this.tubeTip.Hide(this); } }
private void pictureBox1_Paint(object sender, PaintEventArgs e) { Graphics graphics = e.Graphics; SQLiteDataReader data = this.db.query("select * from planClear"); if (data.HasRows) { while (data.Read()) { TubeCoords currentTubeCoords = new TubeCoords { row = data.GetInt32(1), col = data.GetInt32(2) }; int type = data.GetInt32(3); Tube tube = new Tube(currentTubeCoords); tubes.Add(tube); graphics.DrawImage(icons.getIcon(type), tube.getRectangle()); } } }