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画好了,我们要开始画标题文字了,先准备下,不然怎么知道画多少呢
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!



