Autor Beitrag
chip777
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 127

Win 7 Prof
C# VS 2008
BeitragVerfasst: Mo 10.05.10 13:11 
Hi ihr :-)

Ich bin jetzt eine ganze Weile gut ohne Hilfe voran gekommen, allerdings klemmt es jetzt mal wieder.
Ich habe ein Panel in dem sich Balken unterschiedlicher Länge befinden. Außerdem habe ich ein zweites Panel mit einem Zahlenstrahl, damit man die Größe der Balken erkennen kann. Jetzt suche ich nach einer Möglichkeit im ersten Panel sowas wie ein Raster anzuzeigen, bzw. vertikale Linien zu zeichen alle 28 Pixel würde schon reichen. Dann könnte man besser erkennen welche Zahl im Zahlenstrahl wohin gehört.

Wäre schön wenn jmd eine Idee hätte.

Gruß,

Martin
chip777 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 127

Win 7 Prof
C# VS 2008
BeitragVerfasst: Mo 10.05.10 14:02 
So, ich hab jetzt etwas Code um die Linien zu erzeugen:

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
for (int i = 0; i * 28 <= splitContainer1.Panel2.Width; i++)
            {
                Label linie = new Label();
                linie.BackColor = Color.Black;
                linie.BorderStyle = new BorderStyle();
                int hoehe = splitContainer1.Panel2.VerticalScroll.Maximum;
                if (hoehe < splitContainer1.Panel2.Width)
                {
                    hoehe = splitContainer1.Panel2.Width;
                }
                linie.Size = new Size(1, hoehe);
                linie.Location = new Point((i * 28 + 12), 0);
                splitContainer1.Panel2.Controls.Add(linie);
            }


Allerdings hab ich noch ein kleines Problem, in dem Balkendiagramm hab ich grüne und weiße Balken, ist es irgendwie möglich das meine Schleife die weißen Balken überzeichnet, die grünen aber nicht?
Christoph1972
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 690
Erhaltene Danke: 16


VS2015 Pro / C# & VB.Net
BeitragVerfasst: Mo 10.05.10 17:57 
Hi,

warum zeichnest du keine Linien??

_________________
Gruß
Christoph
chip777 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 127

Win 7 Prof
C# VS 2008
BeitragVerfasst: Di 11.05.10 06:21 
user profile iconChristoph1972 hat folgendes geschrieben Zum zitierten Posting springen:
warum zeichnest du keine Linien??


Hast du meinen Code angeschaut? Ich zeichne doch Linien. Hat sich aber denke ich geklärt, da ich die ganze Sache wohl vorerst weglassen werde, allerdings wäre es für später interessant ob es nun möglich ist, einige Label zu überzeichnen und andere nicht, und dieses Vorgehen von der Label Farbe abhängig zu machen.

Gruß,

Martin
Christoph1972
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 690
Erhaltene Danke: 16


VS2015 Pro / C# & VB.Net
BeitragVerfasst: Di 11.05.10 15:34 
Hi,

du zeichnest keine Linien. Du verwendest, Label als Linie, in dem du sie der Control Collection zufügst. Gezeichnet wird mit DGI+.

_________________
Gruß
Christoph