Bild ziehen
-
Hallo,
ich möchte ein Bild ziehen. So das es am unteren Ende keine Veränderung stattfindet und es erst nach oben hin ungenauer wird.So wie hier:
https://upload.wikimedia.org/wikipedia/commons/6/61/Mode_7_Test-0000.pngWie kann ich das erreichen? Ohne "großen" Aufwand.
LG
-
Zu faul zum Googlen?
Na ja, du benötigst für die pictureBox die beiden events MouseDown und MouseMove sowie die MouseLocation.namespace Image { public partial class Form1 : Form { private Point MouseDownLocation; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // Hier Bild in pictureBox1 einsetzen } private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { MouseDownLocation = e.Location; } } private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { pictureBox1.Left = e.X + pictureBox1.Left - MouseDownLocation.X; pictureBox1.Top = e.Y + pictureBox1.Top - MouseDownLocation.Y; } } } }