18 Mart 2015, 14:18
|
#1 |
Çevrimiçi
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
| formda yerini değiştirebileceğiniz isterseninz kapatılan bir panel componenti
Kod: Kodu kopyalamak için üzerine çift tıklayın! unit OzelPanel;
interface
uses
StdCtrls, ExtCtrls,Windows, Messages, Graphics, Controls, Forms, Dialogs, Menus,
SysUtils, Classes;
type
TOzelPanel = class(TPanel)
private
fBilgi:String;
FLabel:TLabel;
fUst,TASI,Kapat,TEkran,Kucult:TPanel;
FKapat,FTasi,Ftekran,fkucult,Kapatmesaj,fAcilisKucuk:Boolean;
FYukseklik,xi,yi,Tetop,Teleft,teheigth,tewidth,kuheigth,kuwidth:Integer;
procedure SBilgi(Value:String);
procedure SYukseklik(value:Integer);
procedure KapatClick(Sender: TObject);
procedure TEkranClick(Sender: TObject);
procedure KucultClick(Sender: TObject);
procedure TASIMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure TASIMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
{ Private declarations }
protected
procedure Loaded; override;
{ Protected declarations }
public
procedure Bilgiyaz(Value:String);
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
{ Public declarations }
published
property Bilgi:String read fBilgi write SBilgi;
property Yukseklik:Integer read FYukseklik write SYukseklik;
property AcilisKucuk:Boolean read fAcilisKucuk write fAcilisKucuk;
property ButonKapat:Boolean read FKapat write FKapat;
property ButonKucuk:Boolean read fkucult write fkucult;
property ButonTekran:Boolean read Ftekran write Ftekran;
property ButonTasi:Boolean read FTasi write FTasi;
property ButonKapatMesaji:Boolean read Kapatmesaj write Kapatmesaj;
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Ramazan', [TOzelPanel]);
end;
{ TOzelPanel }
procedure TOzelPanel.Loaded;
begin
inherited Loaded;
Kapat.Visible:=ButonKapat;
Kucult.Visible:=ButonKucuk;
TEkran.Visible:=ButonTekran;
TASI.Visible:=ButonTasi;
fUst.Height:=Yukseklik;
Kapat.Color:=Color;
Kucult.Color:=Color;
TEkran.Color:=Color;
TASI.Color:=Color;
fUst.Color:=Color;
if AcilisKucuk then
KucultClick(Kucult);
Bilgiyaz(Bilgi);
end;
constructor TOzelPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ButonKapat:=True;
ButonKucuk:=True;
ButonTekran:=True;
ButonTasi:=True;
ButonKapatMesaji:=True;
Yukseklik:=20;
fUst:=TPanel.Create(Self);
fUst.Parent:=Self;
fUst.Align:=alTop;
fUst.Height:=Yukseklik;
TASI:=TPanel.Create(Self);
TASI.Parent:=fUst;
TASI.Align:=alLeft;
TASI.Width:=20;
TASI.Caption:='T';
TASI.Font.Style:=[fsBold];
TASI.Alignment:=taCenter;
TASI.OnMouseMove:=TASIMouseMove;
TASI.OnMouseDown:=TASIMouseDown;
TASI.Cursor:=crHandPoint;
TASI.Hint:='Taşı';
Kucult:=TPanel.Create(Self);
Kucult.Parent:=fUst;
Kucult.Align:=alRight;
Kucult.Width:=20;
Kucult.Caption:='K';
Kucult.Font.Style:=[fsBold];
Kucult.Alignment:=taCenter;
Kucult.OnClick:=KucultClick;
Kucult.Cursor:=crHandPoint;
Kucult.Hint:='Küçük';
TEkran:=TPanel.Create(Self);
TEkran.Parent:=fUst;
TEkran.Align:=alRight;
TEkran.Width:=20;
TEkran.Caption:='TE';
TEkran.Font.Style:=[fsBold];
TEkran.Alignment:=taCenter;
TEkran.OnClick:=TEkranClick;
TEkran.Cursor:=crHandPoint;
TEkran.Hint:='Tam Ekran';
Kapat:=TPanel.Create(Self);
Kapat.Parent:=fUst;
Kapat.Align:=alRight;
Kapat.Width:=20;
Kapat.Caption:='X';
Kapat.Font.Style:=[fsBold];
Kapat.Alignment:=taCenter;
Kapat.OnClick:=KapatClick;
Kapat.Cursor:=crHandPoint;
Kapat.Hint:='Kapat';
FLabel:=TLabel.Create(Self);
FLabel.Parent:=fUst;
FLabel.Align:=alClient;
FLabel.Color:=clRed;
FLabel.Font.Color:=clWhite;
FLabel.Font.Style:=[fsBold];
FLabel.Layout:=tlCenter;
end;
destructor TOzelPanel.Destroy;
begin
inherited Destroy;
end;
procedure TOzelPanel.KapatClick(Sender: TObject);
begin
if Kapatmesaj then
begin
if Application.MessageBox(PChar('Kapatılacak Eminmisiniz ?'),PChar('Kapat mesajı'),MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) = IDYES then
Visible:=False;
end
else
Visible:=False;
end;
procedure TOzelPanel.KucultClick(Sender: TObject);
begin
if Height>(Yukseklik+1) then
begin
if TEkran.Caption='OB' then
TEkranClick(TEkran);
kuheigth:=Height;
kuwidth:=Width;
Height:=(Yukseklik+1);
Kucult.Caption:='B';
Kucult.Hint:='Büyük';
end
else
begin
Height:=kuheigth;
Width:=kuwidth;
Kucult.Caption:='K';
Kucult.Hint:='Küçük';
end;
end;
procedure TOzelPanel.TASIMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
xi:=Mouse.CursorPos.X-Left;
yi:=Mouse.CursorPos.Y-Top;
end;
procedure TOzelPanel.TASIMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if ssLeft in Shift then
begin
if Mouse.CursorPos.x-xi<0 then
Left:=0
else
Left:=(Mouse.CursorPos.x-xi);
if Mouse.CursorPos.y-yi<0 then
Top:=0
else
Top:=(Mouse.CursorPos.y-yi);
if top>Parent.Height-20 then
Top:=Parent.Height-20;
if Left>Parent.Width-20 then
Left:=Parent.Width-20;
end;
end;
procedure TOzelPanel.TEkranClick(Sender: TObject);
begin
if Align=alNone then
begin
if Kucult.Caption='B' then
KucultClick(Kucult);
Teleft:=Left;
Tetop:=Top;
teheigth:=Height;
tewidth:=Width;
Align:=alClient;
TEkran.Hint:='Önceki Boyut';
TEkran.Caption:='OB';
TASI.Visible:=False;
end
else
begin
Align:=alNone;
TEkran.Hint:='Tam Ekran';
TEkran.Caption:='TE';
Left:=Teleft;
Top:=Tetop;
Height:=teheigth;
Width:=tewidth;
TASI.Visible:=FTasi;
end;
end;
procedure TOzelPanel.SYukseklik(value: Integer);
begin
FYukseklik:=value;
end;
procedure TOzelPanel.SBilgi(Value: String);
begin
fBilgi:=Value;
end;
procedure TOzelPanel.Bilgiyaz(Value: String);
begin
FLabel.Caption:=Value;
end;
end.
__________________ SusKun ve Sessiz Mürekkep... Kullanıcı imzalarındaki bağlantı ve resimleri görebilmek için en az 20 mesaja sahip olmanız gerekir ya da üye girişi yapmanız gerekir.
|
| |