Autor Beitrag
Joker_07
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Sa 19.07.08 09:56 
Es geht um den Objekt stringgrid und möchte jetzt bestimmte Zellen rot marikieren, aber diese Zellen sollen nicht ganz rot werden, sondern nur umramt werden, wegen der Schrift! Und meine Frage ist geht das überhaupt mit stringgrid oder brauch ich hierfür ein drawgrid? Wenn es geht wie soll ich dass machen? Danke schon im Vorraus
mfg joker_07
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Sa 19.07.08 11:15 
kannst sowohl stringgrid als auch drawgrid nehmen, einfach im OnDrawCell einen roten Rahmen malen :) beim stringgrid kannst du halt text hinterlegen (cells-property)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  if gdSelected in state then
    (sender as TStringgrid).canvas.pen.color:=clRed
  else
    (sender as TStringgrid).canvas.pen.color:=(sender as TStringgrid).color;
  (sender as TStringgrid).canvas.Rectangle(rect.left,rect.top,rect.Right,rect.bottom);


ggf halt noch text hinmalen und vorher mit der hintergrundfarbe füllen.

HTH Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
Joker_07 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Sa 19.07.08 12:21 
Ja das klappt auch teilweise wie ich das haben will, nur das mit dem text ist noch ein problem, weil der text der eingelesen werden soll aus einer ini datei funktioniert nicht, zumindest sieht man den text jetzt nicht mehr.
mfg joker_07
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Sa 19.07.08 12:33 
wenn du text nehmen willst, nehm ein STringgrid und lade den text aus der ini im formcreate (habs hier mal ohne ini gemacht :) ). dann halt nur noch malen...

ausblenden Delphi-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:
procedure TForm1.FormCreate(Sender: TObject);
var i,j:integer;
begin
  for i:=0 to stringgrid1.Height-1 do
  begin
    for j:=0 to stringgrid1.Width-1 do
    begin
      Stringgrid1.Cells[j,i]:=IntToStr(j)+'-'+IntToStr(i);
    end;
  end;
end;

procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  (sender as TStringgrid).canvas.Brush.color:=(sender as TStringgrid).color;
  //(sender as TStringgrid).canvas.FillRect(rect);
  if gdSelected in state then
    (sender as TStringgrid).canvas.pen.color:=clRed
  else
    (sender as TStringgrid).canvas.pen.color:=(sender as TStringgrid).color;
  (sender as TStringgrid).canvas.Rectangle(rect.left,rect.top,rect.Right,rect.bottom);
  (sender as TStringgrid).canvas.TextOut(rect.left+2,rect.top+2,(sender as TStringgrid).Cells[col,row]);
end;


HTH Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3