Dalphi

0

Jak w delfim w sposub programowy zmienić napis i ikone na przycisku menu start

0

Możesz to zrobić odwołując się do rejestru jeli się nie myle to jest to w FAQ na tej stronie-- Waldi Koronowo
[email protected]

0

Wyślę taki program do p Adama Boducha aby zamieścił na stronie. A Tobie podpowiem że napis start nie jest
textem, tylko obrazkiem.
Masz tu kod formy mniej więcej.

Unit Main;

Interface

Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls;

Type
TStartClock = class(TForm)
Image: TImage;
Timer: TTimer;
BM1: TImage;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TimerTimer(Sender: TObject);
Private
{ Private declarations }
Public
{ Public declarations }
End;

Var
StartClock: TStartClock;
hStart : THandle;
hBM,TMP: THandle;
BM2 : TBitmap;
R : TRect;
SzIkony,WysIkony:Byte;
Implementation
Uses General;
{$R *.DFM}

Procedure Szukaj;
Begin
TMP:=FindWindowEx(FindWindow('Shell_TrayWnd',nil),0,'Button',nil);
If hStart&lt&gtTMP Then
Begin
hStart:=TMP;
hBM:=SendMessage(hStart,BM_GETIMAGE,IMAGE_BITMAP,0);
End;
End;

Procedure Sprawdz; Begin If Not IsWindowEnabled(hStart) Then Szukaj; End;

Procedure Ustaw;
Begin
SzIkony:=GetSystemMetrics(SM_CXSMICON);
WysIkony:=GetSystemMetrics(SM_CYSMICON);
GetClientRect(hStart,R);
StartClock.Image.Width:=R.Right-2GetSystemMetrics(SM_CXEDGE);
StartClock.Image.Height:=R.Bottom-2
GetSystemMetrics(SM_CYEDGE);
R.Left:=SzIkony;
R.Top:=0;
R.Right:=StartClock.Image.Width;
R.Bottom:=StartClock.Image.Height;
End;

Procedure Pisz;
Var Godzina:String[5];
Begin
Godzina:=SLeft(TimeToStr(Time),5);
If Odd(SVal(TimeToStr(Time)[8])) Then Godzina[3]:=':' Else Godzina[3]:='.';
Ustaw;
StartClock.Image.Canvas.FillRect(R);
StartClock.Image.Canvas.TextOut(SzIkony 1,2,Godzina);
SendMessage(hStart,BM_SETIMAGE,IMAGE_BITMAP,StartClock.Image.Picture.Bitmap.Handle);
End;

Procedure TStartClock.FormClose(Sender: TObject; var Action: TCloseAction);
Begin
SendMessage(hStart,BM_SETIMAGE,IMAGE_BITMAP,hBM);
End;

Procedure TStartClock.FormCreate(Sender: TObject);
Begin
Image.Canvas.Brush.Color:=cl3DLight;
Image.Canvas.TextFlags:=ETO_OPAQUE;
Image.Canvas.Font.Style:=[];
Szukaj;
Image.Canvas.FillRect(Rect(0,0,StartClock.Image.Width,StartClock.Image.Height));
BM2:=TBitmap.Create;
BM2.Assign(StartClock.BM1.Picture.Bitmap);
BM2.Dormant;
BM2.FreeImage;
SetBkMode(StartClock.Image.Canvas.Handle,TRANSPARENT);
Image.Canvas.Draw(0,1,BM2);
BM2.ReleaseHandle;
BM2.Free;
End;

Procedure TStartClock.TimerTimer(Sender: TObject);
Begin
Szukaj;
Pisz;
End;

End.
--Szymek

Prawo Bolingsa - jeżeli czujesz się świetnie, nie martw się, to minie.

0

Ten program robiłem pod koniec lipca,a w Delphi robie od Maja 2002, więc może być trochę badziewnie
skonstruowany.
--Szymek

Prawo Bolingsa - jeżeli czujesz się świetnie, nie martw się, to minie.

1 użytkowników online, w tym zalogowanych: 0, gości: 1