- This topic has 5 replies, 3 voices, and was last updated 13 years, 3 months ago by Support.
-
AuthorPosts
-
August 3, 2011 at 5:24 am #34707JCSFParticipant
7.3.4.
I put a TStringList in Frame.
I put my Frame1 in Form1.
My TStringGrid OnDrawCell don´t work.
Code:procedure TFrame1.listaDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
texto : string;
largurat, largurac : integer;
begin
if aCol = 7 then
with (Sender as TStringGrid) do
begin
TStringGrid(Sender).Canvas.FillRect(Rect);
Form1.sAlphaImageList1.Draw(Canvas, Rect.Left, Rect.Top, 3);
end;{ If (lista.Cells[7, aRow] = '-') Then
Begin
with (Sender as TStringGrid) do
begin
Canvas.FillRect(Rect);
Form1.sAlphaImageList1.Draw(Canvas, Rect.Left, Rect.Top, 3);
end
end; }If Not (gdFixed in State) Then
Begin
If (ARow Mod 2) = 0 Then
TStringGrid(Sender).Canvas.Brush.Color:= cl3DLight
Else
TStringGrid(Sender).Canvas.Brush.Color:= clscrollbar;//$00EEEEEE;
TStringGrid(Sender).Canvas.FillRect(Rect);
if (gdselected in state) then
begin
TStringGrid(Sender).Canvas.Brush.Color:= clMaroon;
end
else
TStringGrid(Sender).Canvas.Font.Color:= clBlack;TStringGrid(Sender).Canvas.TextOut(Rect.Left + 2, Rect.Top + 2,
TStringGrid(Sender).Cells[ACol, ARow]);
texto := lista.Cells[ACol, ARow];
largurat := TStringGrid(Sender).Canvas.TextWidth(texto) div 2;
largurac := TStringGrid(Sender).ColWidths[ACol] div 2;
TStringGrid(Sender).Canvas.FillRect(Rect);
TStringGrid(Sender).Canvas.TextOut(Rect.Left+largurac-largurat,Rect.Top, texto);if (Acol = 7) and (ARow > 0) then
if Lista.Cells[7,ARow] = '.' then
Form1.sAlphaImageList1.Draw(TStringGrid(Sender).Canvas, Rect.Left+4, Rect.Top+4, 3);
end;
end;The last column have to receive a image.
Why? It´s a bug?
I really need help.
Thanks xD
August 3, 2011 at 6:11 pm #46398JCSFParticipantIf i try to retrieve info from Cell this don´t work too!!!
ShowMessage(Lista.Cells[5, Lista.Row]); in OnDblClick don´t word too.
Plsss i need help!!! :a1:
August 4, 2011 at 3:28 pm #46402molParticipantHave you tried to put the sImagelist onto Frame1 instead of the main form?
August 4, 2011 at 5:51 pm #46403JCSFParticipantThanks.
But now i´m using sTListView and now i have a new problem. :a8:
How to put a image in collumns?
CustomDrawSubItem
Code:var
I, K : Integer;
X : String;
begin
for I := 0 to Lista.Items.Count -1 do
begin
for K := 0 to Lista.Items.SubItems.Count -1 do
begin
If Lista.Items.SubItems[6] = 'X' Then
Item.ImageIndex := 0;
end;
end;
end;Error: List index out of bounds(6). 🙁
I want to put a image when find X.
Thanks for all!
August 8, 2011 at 11:14 pm #45966JCSFParticipantSolution:
Code:procedure TFrame1.ListaCustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
var DefaultDraw: Boolean);
Var
I : Integer;
Begin
For I := 0 to Item.SubItems.Count -1 Do
Begin
If Item.SubItems = 'S' Then
Begin
Item.SubItems[5] := '';
Item.SubItemImages[5] := 0;
End;
End;
End;August 19, 2011 at 5:58 am #46436SupportKeymasterHello
Your problem is solved already?
-
AuthorPosts
- You must be logged in to reply to this topic.