Warna Teks Pada MessageDialog


Tips & Trik Delphi, Tips Belajar Delphi, Belajar Delphi Online
unit Unit1;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
MsgForm : TForm;
i : integer;
begin
MsgForm := CreateMessageDialog(‘Tulisan ini berwarna merah !!’, mtInformation, [mbOK]);
with MsgForm do
begin
for i:=0 to ComponentCount-1 do
if Components[i] is TLabel then
(Components[i] as TLabel).Font.Color := clRed;
ShowModal;
end;
MsgForm.Free;
end;

end.

TransCODE Software

Mengetahui Jumlah Hari Dalam Bulan


Tips & Trik Delphi, Tips Belajar Delphi, Belajar Delphi Online
unit Unit1;

interface

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

type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
Button1: TButton;
Label3: TLabel;
Edit3: TEdit;
procedure Button1Click(Sender: TObject);
private
function
DaysPerMonth(AYear, AMonth: Integer): Integer;
function IsLeapYear(AYear: Integer): Boolean;
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

function TForm1.IsLeapYear(AYear: Integer): Boolean;
begin
Result := (AYear mod 4 = 0) and ((AYear mod 100 <> 0) or (AYear mod 400 = 0));
end;

function TForm1.DaysPerMonth(AYear, AMonth: Integer): Integer;
const
DaysInMonth: array[1..12] of Integer =
(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
begin
Result := DaysInMonth[AMonth];
if (AMonth = 2) and IsLeapYear(AYear) then Inc(Result); { leap-year Feb is special }
end;

procedure
TForm1.Button1Click(Sender: TObject);
begin
Edit3.Text := IntToStr(DaysPerMonth(StrToInt(Edit2.Text), StrToInt(Edit1.Text)));
end;

end.

TransCODE Software



Aplikasi Memanggil Ms Office dengan Delphi


Tips & Trik Delphi, Tips Belajar Delphi, Belajar Delphi Onlie
unit Unit1;


interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Shellapi,StdCtrls;

type
TForm1 = class(TForm)
Btn1: TButton;
Btn2: TButton;
Btn3: TButton;
Btn4: TButton;
procedure Btn1Click(Secnder: TObject);
procedure Btn2Click(Sender: TObject);
procedure Btn3Click(Sender: TObject);
procedure Btn4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Btn1Click(Sender: TObject);
begin
ShellExecute(handle, ‘Open’, ‘C:\Program Files\Microsoft Office/Office11/Winword.exe’, NiL,NiL, SW_SHOWNORMAL);
end;

procedure TForm1.Btn2Click(Sender: TObject);
begin
ShellExecute(handle, ‘Open’, ‘C:\Program Files\Microsoft Office/Office11/excel.exe’, NiL,NiL, SW_SHOWNORMAL);
end;

procedure TForm1.Btn3Click(Sender: TObject);
begin
ShellExecute(handle, ‘Open’, ‘C:\Program Files\Microsoft Office/Office11/Powerpnt.exe’, NiL,NiL, SW_SHOWNORMAL);
end;

procedure TForm1.Btn4Click(Sender: TObject);
begin
ShellExecute(handle, ‘Open’, ‘C:\Program Files\Microsoft Office/Office11/Msaccess.exe’, NiL,NiL, SW_SHOWNORMAL);
end;

end.

TransCODE Software