Autor Beitrag
Jenny
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 29.03.03 15:29 
hallo :)

ich möchte in meinem programm im imagefeld eine balkenstatistik machen. mein problem ist, das das imagefeld von anfang an unsichtbar ist und man irgendwie keine farbe einstellen kann. ich möchte aber das es, auch ohne das die balken schon gezeichnet wurden und irgendetwas angeklickt wurde, weiss ist.

danke für eure hilfe =)

Jenny
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 29.03.03 17:17 
Hi,

ich nehme an du meinst mit ImageFeld ein TImage, ja? :)

Dann zeichne einfach im Form.OnCreate einmal was darauf.

z.B. so:
ausblenden Quelltext
1:
2:
3:
4:
5:
procedure TForm1.OnCreate(...);
begin
  Image1.Canvas.Brush.Color:=clWhite;
  Image1.Canvas.FillRect(Rect(0,0,Image1.Width,Image1.Height));
end;


sollte so gehen ;)

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 29.03.03 17:26 
entweder ich bin blind oder bei mir gibts kein oncreate :roll:
bei ereignisse oder nich? da is das nich... nur OnClick und so...

oder kann ich die procedure auch einfach so schreiben?
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 29.03.03 17:29 
hi,

doch gibt es 100%ig.. ;)
mußt aber bei den ereignissen vom Form gucken.

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Sa 29.03.03 17:30 
Klar gibt es ein OnCreate bei dem Formular. Nicht bei der Image Komponente. :)
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 29.03.03 17:40 
oh ja danke es funktioniert =)
hatte das mit dem form übersehen *g*

ich hab nur noch ein problem... das image ist hinter einem panel versteckt und selbst wenn ich es mit rechtsklick "nach vorne setzen" nach vorne holen will ist es immer noch hinten und nich zu sehen :cry:
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Sa 29.03.03 17:42 
Soll es auf dem Panel sein?
Dann einfach mit Str+X ausschneiden, das Panel via Mausklick selektieren und Str+V.

Sonst, klappt es nicht, den umgekehrten Weg zu gehen, also das Panel nach hinten zu setzen anstatt das Image nach vorne?
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 29.03.03 17:44 
Ja, das liegt daran das sich ein TWinControl IMMER vor ein TGraphicControl setzt.. ;)

einziger ausweg ist das du das Image auf ein eigenes Panel packst.. :)

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 29.03.03 17:47 
habs einfach neu auf das panel gemacht nu gehts :)

supi, danke :)
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 29.03.03 18:02 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.FormCreate(Sender: TObject);

begin
  Image1.Canvas.Brush.Color:=clWhite;
  Image1.Canvas.FillRect(Rect(0,0,Image1.Width,Image1.Height));
//image1 wird direkt weiss ausgefüllt
  Image1.Canvas.pen.Color:=clBlack;
  Image1.Canvas.FillRect(Rect(0,0,Image1.Width,Image1.Height));
  //schwarzer rahmen
end;


ich wollte da noch nen schwarzen rahmen drum haben aber irgendwie geht das so nich...

Moderiert von user profile iconUGrohne: Quote-Tags durch Code-Tags ersetzt :wink:
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Sa 29.03.03 18:14 
Mach aus "Pen.Color" einfach "Brush.Color". :)
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 29.03.03 18:23 
brush.color füllt aber flächen und dann is alles schwarz... ich möcht aber n weisses feld mit schwarzem rahmen
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: Sa 29.03.03 18:41 
Einmal das große mit schwarz füllen und ein kleines mit weiß:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FormCreate(Sender: TObject);
begin
  Image1.Canvas.Brush.Color:=clWhite;
  Image1.Canvas.FillRect(Rect(0,0,Image1.Width,Image1.Height));
  Image1.Canvas.brush.Color:=clBlack;
  Image1.Canvas.FillRect(Rect(0,0,Image1.Width,Image1.Height));
  image1.Canvas.Brush.Color := clWhite;
  Image1.Canvas.FillRect(Rect(2,2,Image1.Width-2,Image1.Height-2));
end;
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 29.03.03 19:51 
funktioniert das denn auch noch wenn ich da hinterher mit meinen balken rummale?

naja aber danke :)
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 29.03.03 19:53 
öhm... das erste weiss kann ich doch weglassen oder? :mrgreen:
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Sa 29.03.03 20:12 
so habs eingebaut... dankeschön sieht gut aus :)
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Sa 29.03.03 21:05 
Nur mal als Tipp. Es gibt die Methode FrameRect mit dem du ein Rechteck mit Rahmen malen kannst! Oder wenn du nur einen Rechteckrahmen zeichnen will, dann nimm Rectangle!
Aus der Online-Hilfe:
Zitat:
Die Methode FrameRect zeichnet ein Rechteck und verwendet für den Rahmen die Eigenschaft Brush der Zeichenfläche.

procedure FrameRect(const Rect: TRect);

Beschreibung

Mit FrameRect können Sie einen Rahmen von einem Pixel Breite um einen rechteckigen Bereich ziehen. FrameRect füllt das Rechteck nicht mit dem in der Eigenschaft Brush festgelegten Muster.

Um eine Begrenzung mit dem Stift zu zeichnen, verwenden Sie die Methode Polygon.
Gruß wulfskin!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
Jenny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: So 30.03.03 11:03 
das ich da nich selber drauf gekommen bin :roll: danke wulfskin :)