Kod Bankası

  • Konbuyu başlatan Konbuyu başlatan Z1rT
  • Başlangıç tarihi Başlangıç tarihi
[h=2]Grid Alt Toplam Almak[/h]

procedure AltToplam; var i: Integer; FormulaResult: Double; procedure ColumnSum(Index: Integer; var Sum: Double); var i: Integer; begin for i := 1 to Pred(RowCount) do if not VisibleOnly or RowVisible then Sum := Sum + Cell[Index, i].AsFloat; end; function CalculateColumn(Index: Integer; FormulaKind: TFormulaKind): Double; var i: Integer; FormulaSum: Double; s: WideString; sl: TStringList; begin FormulaSum := 0; if (not VisibleOnly or RowVisible[0]) and (FormulaKind <> fkCount) then FormulaSum := Cell[Index, 0].AsFloat; case FormulaKind of fkAverage: begin ColumnSum(Index, FormulaSum); FormulaSum := FormulaSum / RowCount; end; fkCount: FormulaSum := RowCount; fkCustom: DoColumnFooterValue(Index, FormulaSum); fkDistinct: begin sl := TStringList.Create; for i := 0 to RowCount - 1 do if not VisibleOnly or RowVisible then { visible only } begin s := Cells[Index, i]; if sl.IndexOf(s)= - 1 then sl.Add(s); end; FormulaSum := sl.Count; FreeAndNil(sl); end; fkMaximum: for i := 1 to Pred(RowCount) do if (not VisibleOnly or RowVisible) and (Cell[Index, i].AsFloat > FormulaSum) then FormulaSum := Cell[Index, i].AsFloat; fkMinimum: for i := 1 to Pred(RowCount) do if (not VisibleOnly or RowVisible) and (Cell[Index, i].AsFloat < FormulaSum) then FormulaSum := Cell[Index, i].AsFloat; fkSum: ColumnSum(Index, FormulaSum); end; DoFooterCalculate(Index, FormulaSum); { event } Result := FormulaSum; end; begin for i := 0 to Pred(Columns.Count) do begin if Columns.Footer.FormulaKind <> fkNone then if RowCount = 0 then Columns.Footer.Caption := '0' else begin FormulaResult := CalculateColumn(i, Columns.Footer.FormulaKind); Columns.Footer.Caption := FloatToStr(FormulaResult); end; end; end;
 
[h=2]Formatlama Hakkında[/h]
Formatlama Hakkında Güzel Bir Örnek

delphibasics sitesinden alıntıdır.



[size=small]// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.

unit Unit1;

interface

uses
SysUtils, // Unit containing the FormatCurr command
Forms, Dialogs;

type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;

var
Form1: TForm1;

implementation
{$R *.dfm} // Include form definitions

procedure TForm1.FormCreate(Sender: TObject);

var
curr : Currency;

begin
// Set up our floating point number
curr := 1234.567;

// Display a sample value using all of the format options

// Round out the decimal value
ShowMessage('##### : '+FormatCurr('#####', curr));
ShowMessage('00000 : '+FormatCurr('00000', curr));
ShowMessage('0 : '+FormatCurr('0' , curr));
ShowMessage('#,##0 : '+FormatCurr('#,##0', curr));
ShowMessage(',0 : '+FormatCurr(',0' , curr));
ShowMessage('');

// Include the decimal value
ShowMessage('0.#### : '+FormatCurr('0.####', curr));
ShowMessage('0.0000 : '+FormatCurr('0.0000', curr));
ShowMessage('');

// Scientific format
ShowMessage('0.0000000E+00 : '+FormatCurr('0.0000000E+00', curr));
ShowMessage('0.0000000E-00 : '+FormatCurr('0.0000000E-00', curr));
ShowMessage('#.#######E-## : '+FormatCurr('#.#######E-##', curr));
ShowMessage('');

// Include freeform text
ShowMessage('"Value = "0.0 : '+FormatCurr('"Value = "0.0', curr));
ShowMessage('');

// Different formatting for negative numbers
curr := 1234.567;
ShowMessage('0.0 : '+FormatCurr('0.0' , -curr));
ShowMessage('0.0 "CR";0.0 "DB" : '+
FormatCurr('0.0 "CR";0.0 "DB"', -curr));
ShowMessage('0.0 "CR";0.0 "DB" : '+
FormatCurr('0.0 "CR";0.0 "DB"', curr));
ShowMessage('');

// Different format for zero value
curr := 0.0;
ShowMessage('0.0 : '+FormatCurr('0.0' , curr));
ShowMessage('0.0;-0.0;"Nothing" : '+
FormatCurr('0.0;-0.0;"Nothing"', curr));
end;

end.



[/SIZE]​
 
[h=2]Webden İçerik almanın Alternatif Yöntemleri[/h]Projemden bir kesit daha. Webdeki bilgiyi işleyip İstediğiniz methodla alma.

Faydalı olması dileğiyle



Kod:

const SourceFile = 'http://www.tcmb.gov.tr/kurlar/toccday.html'; DestFile = 'c:\Kurlar.xml'; begin if DownloadFile(SourceFile, DestFile) then begin ShowMessage('İndirme işlemi başarılı !'); end else begin ShowMessage('Hata : ' + SourceFile) end;


Kod:

procedure TForm113.Button3Click(Sender: TObject); var s: String; Yol:String; Tarih:String; begin // Şirket Adı Gizlenmiştir Yol:='http://transfer.xxxxx.com/Post/Form...ame=abc&userPassword=password&tanzimTarihi='; Tarih:=(y.Text)+'-'+(a.Text)+'-'+(g.Text); // 2008-09-28 Edit1.text:=Yol+Tarih; WebBrowser1.Navigate(Edit1.text); s:=IdHTTP1.Get(Edit1.text); Memo1.Text:=s; Memo1.Lines.SaveToFile('W:\Xmller\'+datetostr(dtpSimdiki.date)+'.xml'); // ShowMessage('Kayıt Yapılmıştır'); JvHTButton1Click(Sender); end;
 
Geri
Üst