interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Menus;
type
TForm1 = class(TForm)
img1: TImage; //left
img2: TImage; //Top
img3: TImage; //Caption
img4: TImage; //Right
img5: TImage; //Time Control
imgmin: TImage; //Minbutton
imgrestore: TImage; //RestoreSize
imgMax: TImage; //Maxbutton
imgclose: TImage; //Closebutton
//這些圖片是WINBLANDS 4裡面的CHIRSTMASTIME的窗口樣式圖片,修改一下就更完美了
//修改完後用Photoshop轉為256色(100%)OK,開始把圖片載入各IMAGE控件,准備開始
procedure FormResize(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
iStyle: Longint; //窗口樣式
shuai: boolean; //狀態的判斷標志,用在NCMOUSEMOVE裡
procedure DrawActivate; //活動時這樣畫
procedure DrawDeActivate; //不活動就這樣畫
protected
procedure wndproc(var message: Tmessage); override;//事實上下面的也都是OVERRIDE,這裡我只處理
//了非NC開頭的一個消息,你也可以自己照下面的樣式寫WM_ACTIVATE
procedure wmnchittest(var msg: TWMNCHITTEST); message WM_NCHITTEST;
procedure wmncmousemove(var msg: TWMNcMousemove); message wm_ncmousemove;
procedure wmnclbuttondown(var msg: Twmnclbuttondown); message wm_nclbuttondown;
procedure wmnclbuttondblclk(var msg: TWMNCLButtonDblClk); message wm_nclbuttondblclk;
procedure wmnclbuttonup(var msg: twmnclbuttonup); message wm_nclbuttonup;
procedure wmncpaint(var msg: twmncpaint); message wm_ncpaint;
public
{ Public declarations }
end;
var
Form1 : TForm1;
caprect : TRect;
pt : TPoint;
dci : integer;
implementation
{$R *.dfm}
//------------------------------------------------------------------------------
procedure TForm1.FormResize(Sender: TObject);
var
rgn : HRGN;
begin
//要保證窗口的外觀效果,設置一下
Form1.Constraints.MinHeight := 40;
Form1.Constraints.MaxHeight := getsystemmetrics(SM_CYSCREEN) - getsystemmetrics(SM_CYMIN);
rgn := CreateRoundRectRgn(0, 0, width, height, 5, 5);
//這裡的RGN,主要是應付Windows XP的主題文件的,不要它,嘿,真TMD丑
setwindowrgn(handle, rgn, true);//設置窗口區域並重畫,區域外的繪制不會顯示
deleteobject(rgn); //用完了記得刪除對象。
invalidate; //這句也很重要哦
end;
//------------------------------------------------------------------------------
//活動時這樣畫
//------------------------------------------------------------------------------
procedure TForm1.DrawActivate;
var
myhdc : HDC;
ico : HICON;
i : integer;
cav : TCanvas;
ACV : TCanvas;
caprect : TRect;
rcdw : integer;
j : integer;
K : integer;
begin
// canvas.Lock;
myhdc := getwindowDc(handle);
ACV := TCanvas.Create;
try
ACV.handle := myhdc;
setstretchbltmode(ACV.handle, STRETCH_DELETESCANS);
with ACV do
begin
Bitblt(ACV.handle, 0, 0, 4, 31, img1.canvas.handle, 0, 0, SRCcopy);
//左上角的那麼點,寬4像素,高31像素 SRCxxxxx還有很多的哦
Bitblt(ACV.handle, 4, 0, 30, 31, img2.canvas.handle, 0, 0, SRCcopy);
//Draw Icon//馬上就要畫圖標了,我們來給它准備好位置吧
ico := Icon.handle; //想偷懶就這樣。^-^
Drawiconex(ACV.handle, 18, 6, ico, 16, 16, 0, 0, DI_Normal);
//這上面的畫ICON也可以給很多朋友參考的,這樣畫就是和原來的ICON一樣的,閃爍?沒有
//好了,ICON畫好了,我們要開始畫標題文字了,先准備下,不然怎麼知道畫多少呢
i := Length(Caption) * 8 - 10;
//每個文字大概、怎麼也差不多有8像素寬的吧
Bitblt(ACV.handle, 34, 0, 6, 31, img3.canvas.handle, 0, 0, SRCcopy);
//下面准備為CAPTION鋪上紅地毯,~新郎新娘入洞房啦--“撲通”一塊磚頭飛來,我暈~倒
stretchblt(ACV.handle, 40, 0, i, 31, img3.canvas.handle, 6, 0, 10, 31, SRCcopy);
//開始畫CAPTION了,這裡應該有許多朋友想解決的問題的參考
cav := TCanvas.Create;
cav.Brush.Style := bsclear;
cav.handle := myhdc;
caprect := rect(45, 10, i * 2 - 20, 26);
cav.Font.Name := '宋體';
cav.Font.Size := 9;
cav.Font.Color := clwhite;
cav.Font.Charset := GB2312_CHARSET;
DrawText(cav.handle, pchar(Caption), Length(Caption), caprect, DT_Left); ////
cav.free;
//好了,標題也畫了,現在干啥子,接著畫,還早著呢
//開始對標題欄封口啦
Bitblt(ACV.handle, i + 40, 0, 11, 31, img3.canvas.handle, 18, 0, SRCcopy);
//好了,口也滅了,現在該干啥了???接著畫,郁悶。
//再這裡對接,需要判斷了,郁悶之極啊
rcdw := width - i - 51 - 94;
//如果需要畫的地方沒180就只畫一下
if (rcdw <= 180) then
begin
Bitblt(ACV.handle, i + 51, 0, rcdw, 31, img2.canvas.handle, 40, 0, SRCcopy);
end
//不然才多畫些,避免浪費資源
else if (rcdw > 180) then
begin
j := trunc(rcdw / 180);
for K := 0 to j - 1 do
begin
Bitblt(ACV.handle, i + 51 + (K) * 180, 0, 180, 31, img2.canvas.handle, 40, 0, SRCcopy);
end;
Bitblt(ACV.handle, i + 51 + j * 180, 0, (rcdw - j * 180), 31, img2.canvas.handle, 40, 0, SRCcopy);
end;
//要開個口子了,准備搞對接撒,這裡用STRETCHBLT可就拉的丑了還是用BITBLT
Bitblt(ACV.handle, (width - 94), 0, 10, 31, img2.canvas.handle, 239, 0, SRCcopy);
//還留4個像素給右邊的封口撒
Bitblt(ACV.handle, (width - 93), 0, 90, 31, img2.canvas.handle, 240, 0, SRCcopy);
//好了,上面的東東完成了,該封口了,55555,誰讓偶這麼好色呢,哎...,是不是很麻煩
Bitblt(ACV.handle, (width - 5), 0, 4, 31, img4.canvas.handle, 0, 0, SRCcopy);
//呵呵,上面畫完了。開始畫左邊的 ,注意這裡也要多搞幾便的
Bitblt(ACV.handle, 0, 31, 4, 9, img1.canvas.handle, 0, 31, SRCcopy);
stretchblt(ACV.handle, 0, 40, 4, (height - 59), img1.canvas.handle, 0, 40, 4, 28, SRCcopy);
Bitblt(ACV.handle, 0, (height - 20), 4, 19, img1.canvas.handle, 0, 58, SRCcopy);
//哎,畫到這裡還是不怎麼好看,趕快畫右邊的 ,COPY上面的就OK了
Bitblt(ACV.handle, (width - 5), 31, 4, 9, img4.canvas.handle, 0, 31, SRCcopy);
stretchblt(ACV.handle, (width - 5), 40, 4, (height - 58), img4.canvas.handle, 0, 40, 4, 28, SRCcopy);
Bitblt(ACV.handle, (width - 5), (height - 19), 4, 19, img4.canvas.handle, 0, 58, SRCcopy);
//再畫下面的吧
Bitblt(ACV.handle, 4, (height - 10), 10, 9, img5.canvas.handle, 0, 0, SRCcopy);
stretchblt(ACV.handle, 14, (height - 10), (width - 28), 9, img5.canvas.handle, 10, 0, 21, 9, SRCcopy);
Bitblt(ACV.handle, (width - 15), (height - 10), 10, 9, img5.canvas.handle, 31, 0, SRCcopy);
//最小化BUTTON
Bitblt(ACV.handle, (width - 38), 1, 26, 29, imgclose.canvas.handle, 0, 0, SRCcopy);
//需要檢查下有沒有MAXBUTTON,CLOSEBUTTON偶就不檢查了,既然要畫肯定是要個CLOSEBUTTON的
//怎麼檢查?郁悶,算了,我可沒空去管你最大化按鍵要不要。
//開始畫上去再說,還要看FORM是不是最大化的
if Windowstate = wsMaximized then
begin
//IMGRESTORE
Bitblt(ACV.handle, (width - 64), 1, 26, 29, imgrestore.canvas.handle, 0, 0, SRCcopy);
end
else if Windowstate = wsNormal then
begin
//IMGMAX
Bitblt(ACV.handle, (width - 64), 1, 26, 29, imgMax.canvas.handle, 0, 0, SRCcopy);
end;
//畫最小化BUTTON
Bitblt(ACV.handle, (width - 90), 1, 26, 29, imgmin.canvas.handle, 0, 0, SRCcopy);
//canvas.Unlock; //使用CANVAS.UNLOCK配對也是一樣的效果,我這裡寫的是推薦的做法
end;
finally
releasedc(handle, ACV.handle); //釋放設備場景
ACV.free;
end;
end;
//標題欄繪制的消息,看偶來偷天換日
procedure TForm1.wmncpaint(var msg: twmncpaint);
begin
DrawActivate; //換成偶民滴
end;
//------------------------------------------------------------------------------
//不活動時就該這樣畫了
//------------------------------------------------------------------------------
procedure TForm1.DrawDeActivate;
var
myhdc : HDC;
ico : HICON;
i : integer;
cav : TCanvas;
DCV : TCanvas;
caprect : TRect;
rcdw : integer;
j : integer;
K : integer;
begin
//canvas.Lock;
myhdc := getwindowDc(handle);
DCV := TCanvas.Create;
try
DCV.handle := myhdc;
setstretchbltmode(DCV.handle, STRETCH_DELETESCANS);
with DCV do
begin
Bitblt(DCV.handle, 0, 0, 4, 31, img1.canvas.handle, 4, 0, SRCcopy);
//左上角的那麼點,寬4像素,高31像素 SRCxxxxx還有很多的哦
Bitblt(DCV.handle, 4, 0, 30, 31, img2.canvas.handle, 0, 31, SRCcopy);
//Draw Icon//馬上就要畫圖標了,我們來給它准備好位置吧
ico := Icon.handle;
Drawiconex(DCV.handle, 18, 6, ico, 16, 16, 0, 0, DI_Normal);
//好了,ICON畫好了,我們要開始畫標題文字了,先准備下,不然怎麼知道畫多少呢
i := Length(Caption) * 8 - 10;
//計算下長度,好畫撒
Bitblt(DCV.handle, 34, 0, 6, 31, img3.canvas.handle, 0, 31, SRCcopy);
//下面准備為CAPTION鋪上紅地毯,~新郎新娘入洞房啦--“撲通”一塊磚頭飛來,我暈~倒
stretchblt(DCV.handle, 40, 0, i, 31, img3.canvas.handle, 6, 31, 10, 31, SRCcopy);
//開始畫CAPTION了
cav := TCanvas.Create;
cav.Brush.Style := bsclear; //刷子類型,~嘿嘿,偶也有兩把爛刷子哦
cav.handle := myhdc;
caprect := rect(45, 10, i * 2 - 20, 26);
cav.Font.Name := '宋體';
cav.Font.Size := 9;
cav.Font.Color := clblack;
cav.Font.Charset := GB2312_CHARSET;
DrawText(cav.handle, pchar(Caption), Length(Caption), caprect, DT_Left); ////
cav.free;
//好了,標題也畫了,現在干啥子,接著畫,還早著呢
//開始對標題欄封口啦
Bitblt(DCV.handle, i + 40, 0, 11, 31, img3.canvas.handle, 18, 31, SRCcopy);
//好了,封好了,現在該干嗎???接著畫,郁悶。
//再這裡對接,需要判斷了,郁悶之極啊
rcdw := width - i - 51 - 94;
if (rcdw <= 180) then
begin
Bitblt(DCV.handle, i + 51, 0, rcdw, 31, img2.canvas.handle, 40, 31, SRCcopy);
end
else if (rcdw > 180) then
begin
j := trunc(rcdw / 180);
for K := 0 to j do
begin
Bitblt(DCV.handle, i + 51 + (K) * 180, 0, 180, 31, img2.canvas.handle, 40, 31, SRCcopy);
end;
Bitblt(DCV.handle, i + 51 + j * 180, 0, (rcdw - j * 180), 31, img2.canvas.handle, 40, 31, SRCcopy);
end;
//要開個口子了,准備搞對接撒,這裡用STRETCHBLT可就拉的丑了還是用BITBLT
Bitblt(DCV.handle, (width - 94), 0, 10, 31, img2.canvas.handle, 239, 31, SRCcopy);
//還留4個像素給右邊的封口撒
Bitblt(DCV.handle, (width - 93), 0, 90, 31, img2.canvas.handle, 240, 31, SRCcopy);
//好了,上面的東東完成了,該封口了,55555,誰讓偶這麼好色呢,哎...,是不是很麻煩
Bitblt(DCV.handle, (width - 5), 0, 4, 31, img4.canvas.handle, 4, 0, SRCcopy);
//----------------------------------------------------------------0--2
//呵呵,上面畫完了。開始畫左邊的 ,注意這裡也要多搞幾便的
//--------------------------------------------------------------------
Bitblt(DCV.handle, 0, 31, 4, 9, img1.canvas.handle, 0, 31, SRCcopy);
stretchblt(DCV.handle, 0, 40, 4, (height - 59), img1.canvas.handle, 0, 40, 4, 28, SRCcopy);
Bitblt(DCV.handle, 0, (height - 18), 4, 19, img1.canvas.handle, 0, 58, SRCcopy);
//----------------------------------------------------------
//哎,畫到這裡還是不怎麼好看,趕快畫右邊的 ,COPY上面的就OK了
//--------------------------------------------------------------------
Bitblt(DCV.handle, (width - 5), 31, 4, 9, img4.canvas.handle, 0, 31, SRCcopy);
stretchblt(DCV.handle, (width - 5), 40, 4, (height - 58), img4.canvas.handle, 0, 40, 4, 28, SRCcopy);
Bitblt(DCV.handle, (width - 5), (height - 18), 4, 18, img4.canvas.handle, 0, 58, SRCcopy);
Bitblt(DCV.handle, 4, (height - 10), 10, 9, img5.canvas.handle, 0, 9, SRCcopy);
stretchblt(DCV.handle, 14, (height - 10), (width - 28), 9, img5.canvas.handle, 10, 9, 21, 9, SRCcopy);
Bitblt(DCV.handle, (width - 14), (height - 10), 10, 9, img5.canvas.handle, 31, 9, SRCcopy);
Bitblt(DCV.handle, (width - 38), 1, 26, 30, imgclose.canvas.handle, 130, 0, SRCcopy);
if Windowstate = wsMaximized then
begin
//IMGRESTORE
Bitblt(DCV.handle, (width - 64), 1, 26, 30, imgrestore.canvas.handle, 130, 0, SRCcopy);
end
else if Windowstate = wsNormal then
begin
//IMGMAX
Bitblt(DCV.handle, (width - 64), 1, 26, 30, imgMax.canvas.handle, 130, 0, SRCcopy);
end;
Bitblt(DCV.handle, (width - 90), 1, 26, 30, imgmin.canvas.handle, 130, 0, SRCcopy);
//canvas.Unlock; //使用CANVAS.UNLOCK配對也是一樣的效果,我這裡寫的是推薦的做法
end;
finally
releasedc(handle, DCV.handle);
DCV.free;
end;
end;
//標題欄鼠標左鍵按下的消息
procedure TForm1.wmnclbuttondown(var msg: Twmnclbuttondown);
var
dc : HDC;
cvs : TCanvas;
begin
dc := getwindowDc(handle);
cvs := TCanvas.Create;
try
cvs.handle := dc;
with cvs do
begin
if msg.HitTest = htminbutton then
begin
Bitblt(cvs.handle, (width - 90), 1, 26, 30, imgmin.canvas.handle, 26, 0, SRCcopy);
end
else if msg.HitTest = htmaxbutton then
begin
if Windowstate = wsNormal then
begin
Bitblt(cvs.handle, (width - 64), 1, 26, 30, imgMax.canvas.handle, 26, 0, SRCcopy);
end
else if Windowstate = wsMaximized then
begin
Bitblt(cvs.handle, (width - 64), 1, 26, 30, imgrestore.canvas.handle, 26, 0, SRCcopy);
end;
end
else if msg.HitTest = htclose then
begin
Bitblt(cvs.handle, (width - 38), 1, 26, 30, imgclose.canvas.handle, 26, 0, SRCcopy);
end
else
inherited;
end;
finally
releasedc(handle, cvs.handle);
cvs.free;
end;
end;
//標題欄鼠標左鍵松開
procedure TForm1.wmnclbuttonup(var msg: twmnclbuttonup);
begin
if msg.HitTest = htminbutton then
begin
application.Minimize;
end
else if msg.HitTest = htmaxbutton then
begin
if Windowstate = wsNormal then
begin
Windowstate := wsMaximized;
left := left + 6;
top := top + 3;
end
else if Windowstate = wsMaximized then
begin
Windowstate := wsNormal;
end;
end
else if msg.HitTest = htclose then
begin
application.Terminate;
end
else
inherited;
end;
procedure TForm1.wndproc(var message: Tmessage);
begin
inherited wndproc(message);
if message.msg = wm_activate then
begin
case message.WParamLo of
wa_active, wa_clickactive:
begin
DrawActivate;
shuai := true;
end;
wa_inactive:
begin
DrawDeActivate;
shuai := false;
end;
end;
end;
if message.msg = wm_ncactivate then
begin
message.Result := 1;//返回個固定值吧,免得老閃來閃去多畫N次
end;
end;
//用這個來告訴消息最好不過了,好好利用先
procedure TForm1.wmnchittest(var msg: TWMNCHITTEST);
var
cprect : TRect; //定義標題欄的RECT(也就是一個正方形的區域)
minrect : TRect; //最小化按紐的RECT
maxrect : TRect; //最大化按紐的RECT
closerect : TRect; //關閉 按紐的RECT
pt : TPoint; //鼠標指針
begin
cprect := rect(36, -getsystemmetrics(SM_CYMIN) + 6, width - 98, 31); //設置RECT
minrect := rect((width - 90), -getsystemmetrics(SM_CYMIN) + 1, (width - 65), -getsystemmetrics(SM_CYMIN) + 29);
maxrect := rect((width - 64), -getsystemmetrics(SM_CYMIN) + 1, (width - 39), -getsystemmetrics(SM_CYMIN) + 29);
closerect := rect((width - 38), -getsystemmetrics(SM_CYMIN) + 1, (width - 13), -getsystemmetrics(SM_CYMIN) + 29);
pt.X := ScreentoclIEnt(mouse.CursorPos).X; //鼠標X
pt.Y := ScreentoclIEnt(mouse.CursorPos).Y; // Y值
//准備欺騙系統了 ,因為BSNONE樣式的窗體是沒有這些返回消息的
if PtInRect(minrect, pt)
then
msg.Result := htminbutton //告訴它在最小化按紐這裡
else if PtInRect(maxrect, pt)
then
msg.Result := htmaxbutton //告訴它在最大化按紐這裡
else if PtInRect(closerect, pt)
then
msg.Result := htclose //告訴它在關閉 按紐這裡
else if PtInRect(cprect, pt)
then
msg.Result := htCaption //告訴它在標題欄這裡
else if (pt.X < 5) and (pt.Y < -getsystemmetrics(SM_CYMIN) + 8) then
msg.Result := httopleft //告訴它在左上角
else if (pt.X > width - 13) and (pt.Y < -getsystemmetrics(SM_CYMIN) + 5) then
msg.Result := httopright //告訴它在右上角
else if (pt.X > width - 13) and (pt.Y > height - 5 - getsystemmetrics(SM_CYMIN)) then
msg.Result := htbottomright //告訴它在右下角
else if (pt.X < 5) and (pt.Y > height - 5 - getsystemmetrics(SM_CYMIN)) then
msg.Result := htbottomleft //告訴它在左下角
else if (pt.X < 5) then
msg.Result := htleft //偶是左派
else if (pt.Y < -getsystemmetrics(SM_CYMIN) + 5) then
msg.Result := httop //我在上面,低頭不見抬頭見
else if (pt.X > width - 9) then
msg.Result := htright //偶是右派
else if (pt.Y > height - 5 - getsystemmetrics(SM_CYMIN)) then
msg.Result := htbottom //偶是貧下中農
else
inherited; { http://www.csdn.Net bob008 原創 2005-03-14,嚴禁未經許可的轉載,出版}
end;
//標題欄雙擊消息,偶們來模擬一下
procedure TForm1.wmnclbuttondblclk(var msg: TWMNCLButtonDblClk);
begin
if msg.HitTest = htCaption then
if Windowstate = wsMaximized then
Windowstate := wsNormal
else if Windowstate = wsNormal then
begin
Windowstate := wsMaximized;
left := left + 6;
top := top + 3;
end;
end;
//標題欄上鼠標移動的消息
procedure TForm1.wmncmousemove(var msg: TWMNcMousemove);
var
dc : HDC;
cv : TCanvas;
begin
dc := getwindowDc(handle);
cv := TCanvas.Create;
try
cv.handle := dc;
with cv do
begin
if shuai = true then
begin
if msg.HitTest = htminbutton then
begin
Bitblt(cv.handle, (width - 90), 1, 26, 30, imgmin.canvas.handle, 52, 0, SRCcopy);
end
else
begin
Bitblt(cv.handle, (width - 90), 1, 26, 30, imgmin.canvas.handle, 0, 0, SRCcopy);
end;
if msg.HitTest = htmaxbutton then
begin
if Windowstate = wsNormal then
begin
Bitblt(cv.handle, (width - 64), 1, 26, 30, imgMax.canvas.handle, 52, 0, SRCcopy);
end
else if Windowstate = wsMaximized then
begin
Bitblt(cv.handle, (width - 64), 1, 26, 30, imgrestore.canvas.handle, 52, 0, SRCcopy);
end;
end
else if Windowstate = wsNormal then
begin
Bitblt(cv.handle, (width - 64), 1, 26, 30, imgMax.canvas.handle, 0, 0, SRCcopy);
end
else if Windowstate = wsMaximized then
begin
Bitblt(cv.handle, (width - 64), 1, 26, 30, imgrestore.canvas.handle, 0, 0, SRCcopy);
end;
if msg.HitTest = htclose then
begin
Bitblt(cv.handle, (width - 38), 1, 26, 30, imgclose.canvas.handle, 52, 0, SRCcopy);
end
else
begin
Bitblt(cv.handle, (width - 38), 1, 26, 30, imgclose.canvas.handle, 0, 0, SRCcopy);
end;
end;
end;
finally
releasedc(handle, cv.handle);
cv.free;
end;
end;
//------------------------------------------------------------------------------
//我們要做什麼?
//那幾個BUTTON讓偶們要干掉它們,省得它們壞事
//當然把它們屏蔽後應該干啥,干自己的事情撒
//------------------------------------------------------------------------------
procedure TForm1.FormCreate(Sender: TObject);
var
hsizens : HICON; //好界面配上好光標才帥嗎!用了Windows變臉軟件裡的光標
hsizewe : HICON;
hsizeall : HICON;
hsizeall1 : HICON;
hsizenesw : Hicon;
hsizenwse : Hicon;
hwait : HICON;
haPPStart : HICON;
harrow : HICON;
hhandwriting : Hicon;
hhelp : HICON;
hno : HICON;
hcross : Hicon;
hibeam : Hicon;
hhand : Hicon;
hup : Hicon;
begin
hsizens:=loadcursorfromfile('cursorssizens.ani');
hsizewe:=loadcursorfromfile('cursorssizewe.ani');
hsizeall:=loadcursorfromfile('cursorssizeall.cur');
hsizeall1:=loadcursorfromfile('cursorssizeall1.cur');
hsizenesw:=loadcursorfromfile('cursorssizenesw.ani');
hsizenwse:=loadcursorfromfile('cursorssizenwse.ani');
hwait:=loadcursorfromfile('cursorswait.ani');
happstart:=loadcursorfromfile('cursorsaPPStarting.ani');
harrow:=loadcursorfromfile('cursorsarrow.cur');
hhandwriting:=loadcursorfromfile('cursorshandwriting.ani');
hhelp:=loadcursorfromfile('cursorshelp.ani');
hno:=loadcursorfromfile('cursors o.ani');
hcross:=loadcursorfromfile('cursorscross.ani');
hibeam:=loadcursorfromfile('cursorsibeam.ani');
hhand:=loadcursorfromfile('cursorshand.ani');
hup:=loadcursorfromfile('cursorsuparrow.ani');
setsystemcursor(harrow,ocr_normal);
setsystemcursor(hsizens,ocr_sizens);
setsystemcursor(hsizewe,ocr_sizewe);
setsystemcursor(hsizeall,ocr_sizeall);
setsystemcursor(hsizeall1,ocr_size);
setsystemcursor(hsizenesw,ocr_sizenesw);
setsystemcursor(hsizenwse,ocr_sizenwse);
setsystemcursor(hwait,ocr_wait);
setsystemcursor(happstart,ocr_aPPStarting);
setsystemcursor(hhandwriting,OIC_note);
setsystemcursor(hhelp, OCR_ICOCUR );
setsystemcursor(hno,ocr_no);
setsystemcursor(hcross,ocr_cross);
setsystemcursor(hibeam,ocr_ibeam);
setsystemcursor(hhand,OCR_HAND);
setsystemcursor(hup,ocr_up);
iStyle := setwindowlong(handle, gwl_style, getwindowlong(handle, gwl_style) and not ws_minimizebox and
not ws_maximizebox and not ws_sysmenu);//設置窗口樣式有SYSMENU一樣會有CLOSEBUTTON的,所
//以把SYSMENU也去掉,這樣沒有默認的按鈕繪制會影響我們了
application.Minimize; //MS不知道是怎麼搞的,窗體載入時的狀態切換消息幾乎沒時間差異,哇,多壓入一個
application.Restore; //設備場景的內存用量,大家NEW一個PROJECT看光1個窗體載入時3.2MB左右
//最小化後1.6MB左右,如果用戶根本一直讓你的軟件工作在正常狀態下(沒有最小化)那麼那多余的1.6MB
//左右的內存也就不會被釋放,所以,我們似乎應該做些工作先
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
DrawActivate;//畫偶們的
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
SystemParametersinfo(SPI_SETCURSORS,0,nil,SPIF_SENDCHANGE);//恢復系統光標
//呵呵,偶好自私,不讓你們用偶的程序的鼠標樣式
end;
end.