Autor Beitrag
JoKaBo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157



BeitragVerfasst: Mo 06.06.11 12:31 
Hallo,

ich Möchte werend das Programm ausgeführt ist eine pictureBox mit dem Cursor auswelen
So das man wen es ausgewelt ist das man es mit button verschieben kann. das mit dem verschieben habe ich schon:
ausblenden C#-Quelltext
1:
2:
p.Location = new Point(
   p.Locaion.X - 10, p.Location.Y);


p = pictureBox1
Anstelle von „p“ soll die mit dem Cursor ausgewelte pictureBox verändert werden

Bei weiteren Fragen Fragt ;)
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 06.06.11 16:50 
Wie wäre es mit dem entsprechenden Ereignis Click?
msdn.microsoft.com/d...s.control.click.aspx

user profile iconJoKaBo hat folgendes geschrieben Zum zitierten Posting springen:
ich Möchte werend das Programm ausgeführt ist eine pictureBox mit dem Cursor auswelen
Fehlen dir Umlaute auf der Tastatur? :gruebel:
JoKaBo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157



BeitragVerfasst: Mo 06.06.11 17:30 
Ich Meine Das so wie es auf dem Bild ist:
Einloggen, um Attachments anzusehen!
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 06.06.11 17:34 
Ja, meine ich auch. Genau dafür brauchst du ja das Click-Ereignis. Wie willst du sonst feststellen auf welche Box geklickt wurde (und dir das merken)?
JoKaBo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157



BeitragVerfasst: Mo 06.06.11 17:42 
Ich habe es Fast ganz hin bekommen aber jetzt wält er immer automatisch pictureBox1 aus hir noch mahl mein code:

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
Control control = button2.Parent;          
                        
            Form myForm = pt.FindForm();
            Form myForm1 = pictureBox2.FindForm();
            Form myForm2 = pictureBox3.FindForm();
            Form myForm3 = pictureBox5.FindForm();
            pt.Location = new Point(
                pt.Location.X - 10, pt.Location.Y);
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 06.06.11 17:54 
Ich habe keine Ahnung was du mit dem Code machen willst... :nixweiss:

Und vor allem warum du es dir unnötig schwer machen willst. Es reicht doch einfach nur beim Klick dir zu merken wohin geklickt wurde...
Dann hast du die zuletzt angeklickte PictureBox doch schon. Und kannst nebenbei auch gleich deren Aussehen verändern um das deutlich zu machen. Außerdem brauchst du den Code (eine Zeile...) ja nur einmal schreiben und kannst ihn für eine beliebige Anzahl PictureBoxen verwenden.
JoKaBo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157



BeitragVerfasst: Mo 06.06.11 19:33 
ich möchte wen das programm ausgefürt ist das ich zwischen beiden pictureBoxsen welen kann (mit Curser) bei dem coden vom link kann ich aber nur eine Auswälen
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 06.06.11 20:00 
user profile iconJoKaBo hat folgendes geschrieben Zum zitierten Posting springen:
bei dem coden vom link kann ich aber nur eine Auswälen
Blödsinn, du müsstest nur einmal drüber nachdenken was du da tust und tun möchtest... :roll:

Aber an deiner Rechtschreibung merkt man ja deutlich wie viel Mühe du dir gibst... :roll:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
private PictureBox SelectedBox = null

private void buttonLeft_Click(object sender, EventArgs e) 

  if (SelectedBox != null
    SelectedBox.Left += 10


private void anyOfYourPictureBoxes_Click(object sender, EventArgs e) 

  SelectedBox = sender as PictureBox; 
}
Und anyOfYourPictureBoxes_Click kannst du bei Click ja allen deinen Boxen zuweisen.
JoKaBo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157



BeitragVerfasst: Mo 06.06.11 20:30 
Jetzt Geht nicht mehr

Hier Mal mein Ganzer Code:

ausblenden volle Höhe C#-Quelltext
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:
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;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form  

    {        
        public Form1()

        {
            InitializeComponent();
            

        }
        private PictureBox SelectedBox = null

        private void button4_Click(object sender, EventArgs e)
        {
        }

        private void Pause_Click(object sender, EventArgs e)
        {
            Pause pause = new Pause();
            pause.ShowDialog();
        }

        private void buttonUp_Click(object sender, EventArgs e)
        {                  
        }

        private void anyOfYourPictureBoxes_Click(object sender, EventArgs e) 
        { 
          SelectedBox = sender as PictureBox; 
        }

        private void buttonLeft_Click(object sender, EventArgs e)
        {
            if (SelectedBox != null)
                SelectedBox.Left += 10
        }
        
    }
}
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 07.06.11 17:56 
user profile iconJoKaBo hat folgendes geschrieben Zum zitierten Posting springen:
Jetzt Geht nicht mehr
Wenn du noch ein ganz klein wenig präziser werden könntest, hättest du vermutlich schon lange eine Antwort gehabt. :roll:

Was passiert? Welche Ereignisse hast du zugeordnet? ...

Lass dir doch nicht jedes Wort aus der Nase ziehen und schreib einfach gleich ausführlicher dazu was Sache ist. Ja, ich weiß, würde ja Zeit erfordern... :roll:
JoKaBo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157



BeitragVerfasst: Di 07.06.11 18:39 
Habe es Hin Bekommen.
Das Nechste Mahl werd ich MIr Mehr Mühe Geben :D