手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>程序设计>delphi>列表

来点实用的,自己画带标题栏窗体,可当模态窗体样继承 bob008原创在CSDN 发表于2005-0

来源:互联网 作者:西部数码 时间:2008-04-10
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

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);

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!