1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75:
| using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading;
namespace Movie3 { public partial class Form1 : Form { Bild Bild1; const string Pfad = "C://Dokumente und Einstellungen//Administrator//Eigene Dateien//Visual Studio 2010//Neuer Ordner//Bilder//"; public Form1() { InitializeComponent(); } class Bild { public class Bild { private PictureBox Rahmen; private string Name; private int x, y, Breite, Hoehe;
public Bild(PictureBox pp, string nn, int xx, int yy, int bb, int hh) { Rahmen = pp; Name = nn; x = xx; y = yy; Breite = bb; Hoehe = hh; Rahmen.SetBounds(x, y, Breite, Hoehe);
} public void Erscheinen() { try { Rahmen.Image = Image.FromFile(Name); } catch { Rahmen.Parent.Text = "Kein Bild gefunden!"; } } public void Bewegen() { for (int i = Rahmen.Location.X; i < Rahmen.Parent.Width - Rahmen.Width - 30; i++) { Rahmen.SetBounds(i, y, Breite, Hoehe); Thread.Sleep(10); } } public void Verschwinden() { Rahmen.Image = null; } }
}
private void Form1_Load(object sender, EventArgs e) { Bild1 = new Bild(pictureBox1, Pfad + "Kreis1.jpg", 10, 10, 200, 200); BackColor = Color.White; pictureBox1.BackColor = Color.White; } } } |