Canvas.Brush.Style:=bsClear;//设置画刷风格 Canvas.pen.color:=rgb(R,G,B);// 设置画笔颜色 Canvas.pen.style:=psSolid;// 设置画笔风格 Canvas.pen.width:=1;//设置画笔宽度 procedure MoveTo(X, Y: Integer); //将画笔移到坐标(X, Y) 处作为画画的起点 procedure LineTo(X, Y: Integer); //从当前位置画一条直线到坐标(X, Y) 处 procedure RoundRect(X1, Y1, X2, Y2, X3, Y3: Integer); //根据给定的参数画一个圆角矩形,X3、Y3用于确定圆角大小 |
procedure draw_bk(Sender:TForm;R,G,B:integer); var i,j,k:integer; begin with Sender do begin canvas.pen.style:=psSolid; canvas.pen.width:=1; k:=(B div 3)*2; for i:=0 to 480 do begin if i<k then j:=0 else j:=j+1; if j>B then j:=B; Canvas.pen.color:=rgb(R,G,B-j); canvas.moveTo(0,i); canvas.lineTo(640,i); end; end; end; |
procedure draw_roll(Sender:TForm;X0,Y0,W,H,R,G,B,lw:integer); var i,J,j1,J2,J3,m,X,Y:integer; begin J1:=R div lw-2; J2:=G div lw; J3:=B div lw+2; m:=lw div 3; with Sender do begin for i:=0 to lw do begin if i<m then j:=m-i else j:=i-m; Canvas.pen.color:=rgb(R-J1*J,G-J2*J,B-J3*J); canvas.moveTo(i+X0,i+Y0); canvas.lineTo(i+X0,H-i+Y0); Canvas.pen.color:=rgb(R-J1*J,G-J2*J,B-J3*J); canvas.moveTo(W-i-1+X0,i+Y0); canvas.lineTo(W-i-1+X0,H-i+Y0); Canvas.pen.color:=rgb(R-J1*J,G-J2*J,B-J3*J); canvas.moveTo(i+X0,i+Y0); canvas.lineTo(W-i+X0,i+Y0); Canvas.pen.color:=rgb(R-J1*J,G-J2*J,B-J3*J); canvas.moveTo(i+X0,H-i+Y0); canvas.lineTo(W-i+X0,H-i+Y0); end; end; end; |
procedure draw_sroll(Sender:TForm;X0,Y0,W,H,R,G,B,lw:integer); var i,J,j1,J2,J3,m,X,Y,i1,i2:integer; begin J1:=R div lw-2; J2:=G div lw; J3:=B div lw+2; m:=lw div 3; with Sender do begin for i:=0 to lw do begin i1:=i; i2:=i; if h=0 then i1:=0; if w=0 then i2:=0; if i<m then j:=m-i else j:=i-m; Canvas.pen.color:=rgb(R-J1*J,G-J2*J,BJ3*J); canvas.moveTo(i1+X0,i2+Y0); canvas.lineTo(i1+W+X0,i2+H+Y0); end; end; end; |
procedure draw_rect(Sender:TForm;X0,Y0,W,H,R,G,B,lw,ww,fg:integer); var ii,i,J,j1,J2,J3,m:integer; begin J1:=R div lw-2; J2:=G div lw; J3:=B div lw+2; m:=lw div 3; if fg=1 then{fg=0 ê.°.} begin j1:=j1 div 2+(j1+2) div 3; j2:=j2 div 2+(j2+2) div 3; j3:=j3 div 2+(j3+2) div 3; end; with Sender do begin Canvas.Brush.Style:=bsClear; for ii:=0 to lw do begin if fg=0 then begin i:=ii; if i<m then j:=m-i else j:=i-m; end else i:=lw-ii; j:=ii; Canvas.pen.color:=rgb(R-J1*J,G-J2*J,B-J3*J); canvas.RoundRect(i+X0-lw,i+Y0-lw,X0+W-i+lw, H+Y0-i+lw,ww,ww); end; end; end; |
procedure TForm2.FormPaint(Sender: TObject); begin draw_bk(Form2,60,60,255);//画蓝色渐变背景 draw_roll(Form2,0,0,640,480,250,200,100,10); //画边框周围铜柱 with Image1 do draw_rect(Form2,left,top,width,height, 250,200,100,10,1,1); //画图片框 with Panel1 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel2 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel3 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel4 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel5 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel6 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel7 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel8 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel9 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel10 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel11 do draw_rect(Form2,left,top,width, height*2+2,250,238,238,10,1,1); with Panel13 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel14 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel16 do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); //以上画键盘 with sele_fun do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with Panel15 do draw_rect(Form2,left,top,222,height, 250,238,238,10,1,1); with Panel15 do draw_rect(Form2,left-11,top-11,242, 350,250,258,238,10,1,1); draw_sroll(Form2,291,5,0,470,250,200,100,12); with gd do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); with gk do draw_rect(Form2,left,top,width,height, 250,238,238,10,1,1); end; |