Welcome to Usergroups.at Sign in | Join | Faq

Presentation (Windows Forms, Windows Presentation Foundation)

Started by blaugrau at 06-17-2007 18:27. Topic has 1 replies.

Print Search
Sort Posts:    
   06-17-2007, 18:27
blaugrau is not online. Last active: 17.06.2007 14:30:51 blaugrau

Top 50 Posts
Joined on 06-17-2007
Posts 2
Problem mit der Reihenfolge von PictureBox Forms
hi leute,

ich erzeuge in einer Schleife 22 PictureBox Objekte und füge diese einem Panel hinzu (also mit panel1.Controls.Add..).

die PictureBox Elemente sind teilweise übereinander gestapelt (ein Kartenspiel wo die Karten eben teilweise mit den Ecken übereinander liegen). Dummerweise liegen die ersten PictureBox Objekte oben und die nachfolgenden darunter, anstatt umgekehrt.

pb.BringToFront() bringts nicht. :(

der abschnitt sieht folgendermaßen aus:


Card current = (Card)cardDeck.Deck[index];
PictureBox pb = new PictureBox();
pb.Location = new Point(coords[index, 0], coords[index, 1]);
pb.MouseClick += new System.Windows.Forms.MouseEventHandler(this.card_MouseClick);
pb.BackColor = Color.Transparent;
pb.BackgroundImage = current.Image;
pb.Tag = current;
pb.BackgroundImageLayout = ImageLayout.Stretch;
pb.Size = new Size(100, 150);
panel1.Controls.Add(pb);
panel1.Update();


hat jemand eine idee?


gracias, blaugrau.

   Report 
   06-25-2007, 19:26
haha is not online. Last active: 25.06.2007 16:22:53 haha

Top 75 Posts
Joined on 06-25-2007
Posts 1
Re: Problem mit der Reihenfolge von PictureBox Forms
hi,

du musst BringToFront nur an der richtigen stelle aufrufen.

wenn du es nach Controls.Add() aufrufts muss es tadellos funktionieren. Davor hat es keine Auswirkung da BringToFront nur die Reihenfolge der Collection Controls beienflusst,



mfg
Hansjörg
   Report 
Usergroups.at » Core Technologi... » Presentation (W... » Re: Problem mit der Reihenfolge von PictureBox Forms

Powered by Community Server, by Telligent Systems