hallo alle zusammen
ich weiß es werden sich jetzt viele sagen.....nicht schon wieder, der soll erstmal die hilfe benutzen.....yep ihr habt recht - hab ich auch, aber was mir aufgefallen ist, wenn ihr 'ne zelle einfärben wollt ruft ihr immer die procedure ondrawgrid auf.
aber ich stell mich wohl zu blöd an - denn ich hab zwei buttons, mit denen ich daten in's stringrid schreibe und mittendrin-stringgrid1.cells[4.lastrow]-will ich bei druck auf den ok-button die zelle grün, und bei druck auf nicht ok, die zelle rot färben.
jetzt weiß ich leider nicht wie ich das in den source reinbasteln soll - das mit dem ondrawcell
vielleicht kann mir jemand 'nen guten tip geben, oder gar ein source vorschlag, wie ich das realisieren kann......auf jedenfall schon mal danke an alle dir mir helfen wollen/können
marco
p.s. hier mal der source vom buttonklick ereignis
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47:
| procedure TForm1.BitBtn1Click(Sender: TObject); var F: TStringList; i: Integer; Lastrow: Integer; AlterItemIndex : Integer; datei : string; begin edit1.Text:=DateToStr(now); with edit1 do label10.Caption:=copy(edit1.Text,4,Pos('.',edit1.Text)-1); label11.Caption:=copy(edit1.Text,7,Pos('.',edit1.Text)+1); if label10.caption='01' then edit2.Text:='Januar'; if label10.caption='02' then edit2.Text:='Februar'; if label10.caption='03' then edit2.Text:='März'; if label10.caption='04' then edit2.Text:='April'; if label10.caption='05' then edit2.Text:='Mai'; if label10.caption='06' then edit2.Text:='Juni'; if label10.caption='07' then edit2.Text:='Juli'; if label10.caption='08' then edit2.Text:='August'; if label10.caption='09' then edit2.Text:='September'; if label10.caption='10' then edit2.Text:='Oktober'; if label10.caption='11' then edit2.Text:='November'; if label10.caption='12' then edit2.Text:='Dezember'; datei:='c:\eupec\Freigabe\'+edit2.Text+label11.Caption+'.csv'; StringGrid1.Rowcount := StringGrid1.Rowcount+1; Lastrow :=StringGrid1.Rowcount-1; StringGrid1.cells [0,Lastrow] :=label3.Caption; StringGrid1.cells [1,Lastrow] :=label4.Caption; StringGrid1.cells [2,Lastrow] :=label5.Caption; StringGrid1.cells [3,Lastrow] :=label6.Caption; StringGrid1.cells [5,Lastrow] :=label9.Caption; StringGrid1.cells [7,Lastrow] :=label7.Caption; StringGrid1.cells [8,Lastrow] :=label8.Caption; if edit8.Text='' then ShowMessage('Name fehlt') else StringGrid1.cells [6,Lastrow] :=edit8.Text; F := TStringList.Create; try F.Add(IntToStr(StringGrid1.RowCount)); F.Add(IntToStr(StringGrid1.ColCount)); for i := 0 to (StringGrid1.RowCount - 1) do F.Add(StringGrid1.Rows[i].CommaText); F.SaveToFile(datei); finally F.Free; end; |