>以下源码是快速创建不规则窗体的,还可以移动。
>#ifndef Unit1H
>
>#include <vcl.h>" H. I0 m$ u1 X# U
>#include "Unit1.h"
>void __fastcall TForm1::FormCreate(TObject *Sender)
>BmpToRgn();) ?: x/ q* g7 b0 e2 s+ N, E$ t/ N; {
>void __fastcall TForm1::Image1MouseDown(TObject *Sender,
ixels[0][0];) w, `* R9 ^ z
>if((a=(POINT *)malloc(Width*2*(sizeof(POINT))))==NULL)# g; I- V1 l; Z% b( U; N
>l=0;r=Image1->Height*2-1;; Z; U3 d/ X* h% b
>for(y=0;y<Image1->Height;y++)
ixels[x][y]!=ColorKey)
> if(lb) a[l]=a[l-1];
> for(x=Image1->Width;x>=0;x--): V% V# T& Q9 x& { q- |! w) f8 ^
ixels[x][y]!=ColorKey)$ |3 [0 W# n3 C- E8 F+ ?6 N
>r=Image1->Height*2-1;7 n$ a: C5 c* m8 ^
ixels[x][y]==ColorKey)
><a>Height*2,ALTERNATE">file://TempRgn=CreatePolygonRgn(a,Image1->Height*2,ALTERNATE</A>);
>void __fastcall TForm1::Open1Click(TObject *Sender)
icture->LoadFromFile(OpenPictureDialog1->FileName);
>对啦,图片的背景色要相同。; g5 q7 f- L' X) _ c" l. D8 W4 L
>file://--------------------(一)为窗体背景增加渐变色(蓝)---------------
>file://---------------透明窗体--------------------------
> ::ScreenToClient(Form1->Handle,lpTL);
> hClient=CreateRectRgn(rctClient->Left,rctClient->Top,# R H9 B1 T0 X" ]$ A# Y$ @
>
>} </P>
| 欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) | Powered by Discuz! X2.5 |