AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Fragen rund ums Stringgrid

Ein Thema von Noobinator · begonnen am 30. Sep 2006 · letzter Beitrag vom 1. Okt 2006
 
Noobinator

Registriert seit: 9. Mai 2006
147 Beiträge
 
Delphi 7 Personal
 
#3

Re: Im Stringgrid bestimmte Zellen Markieren (Rahmen)

  Alt 30. Sep 2006, 17:37
Ich habe das mit dem Rahmen jetzt mal gelassen und ein Problem mit der farbe:

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, Menus;

type
  TForm1 = class(TForm)
    ...
     private
   { Private-Deklarationen }
  public
    { Public-Deklarationen }
    farbe:tcolor;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



procedure TForm1.FormCreate(Sender: TObject);
begin
farbe:=clyellow;
stringgrid1.Ondrawcell:= StringGrid1DrawCell;
stringgrid2.Ondrawcell:= StringGrid2DrawCell;
end;

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol,
 ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
 if not Odd(Arow) and not (gdFixed in State) then
   with StringGrid1 do
   begin
     Canvas.Brush.Color := farbe;
     Canvas.FillRect(Rect);
     Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[Acol, ARow]);
   end;
end;

procedure TForm1.StringGrid2DrawCell(Sender: TObject; ACol,
 ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
 if not Odd(Arow) and not (gdFixed in State) then
   with StringGrid2 do
   begin
     Canvas.Brush.Color := farbe;
     Canvas.FillRect(Rect);
     Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[Acol, ARow]);
   end;
end;



procedure TForm1.Farbe1Click(Sender: TObject);
begin
if colordialog1.execute then
farbe:=colordialog1.Color;
stringgrid1.OnDrawCell:=StringGrid1DrawCell;
stringgrid2.OnDrawCell:=StringGrid2DrawCell;
end;

end.
wenn ich dies jetzt so habe färbt er immer nur ein teil des Stringrids mit der gewünschten farbe, und der rest färbt sich erst, wenn ich mit der maus über die Zelle fahre.
woran liegt das?

bild
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:16 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz