public override void MovingObject_LocationChanged(object sender, EventArgs e) { if (kolben != null) { kolben.setOrgPosition(this.Location.X + this.pictureBox.Image.Width / 2 - kolben.pictureBox.Image.Width / 2, this.Location.Y); } if (Form1.instance != null) { this.performAction(); } base.MovingObject_LocationChanged(sender, e); }
/** * Zeichnen der Zylinder */ public override void pictureBox_Paint(object sender, PaintEventArgs e) { if (pinImage != null) { if (kolben == null) { kolben = new Kolben(); kolben.Location = new Point(this.Location.X + this.pictureBox.Image.Width / 2 - kolben.pictureBox.Image.Width / 2, this.Location.Y); kolben.setOrgPosition(this.Location.X + this.pictureBox.Image.Width / 2 - kolben.pictureBox.Image.Width / 2, this.Location.Y); Form1.form1.insertControl(kolben, this); } if (druckVor) { e.Graphics.DrawImage(pinImage, this.Width - pinImage.Width - 1, 0, pinImage.Width, pinImage.Height); } if (druckZurueck) { e.Graphics.DrawImage(pinImage, this.Width - pinImage.Width - 1, this.Height - pinImage.Height, pinImage.Width, pinImage.Height); } if (kolben.getPosition() == 0) { e.Graphics.DrawImage(endschalter1Image, 0, 0, endschalter0Image.Width, endschalter1Image.Height); } else { e.Graphics.DrawImage(endschalter0Image, 0, 0, endschalter0Image.Width, endschalter1Image.Height); } if (kolben.getPosition() == 100) { e.Graphics.DrawImage(endschalter1Image, 0, this.Height - endschalter0Image.Height, endschalter0Image.Width, endschalter1Image.Height); } else { e.Graphics.DrawImage(endschalter0Image, 0, this.Height - endschalter0Image.Height, endschalter0Image.Width, endschalter1Image.Height); } } }