摘要载入中…    请稍等…












内容载入中…    请稍等…

如长时间看不到内容,请关闭浏览器,重新打开此页!

芯友首页 应用软件 编程开发 网络硬件 资源下载 动漫音乐 精美图库 芯友论坛 视频教程 电脑技术QQ群:73422782
 ★★photoshop学友-史上最强播放器★★
 位置:编程开发>Deiphi>Deiphi窗体文章
◎→ 本类最新
DELPHI动态生成控件
Delphi编程中创建一个启动闪现窗
在win95,win98下实现半透明的窗口
拖动无标题栏窗体的方法
用Delphi 控制窗体的大小
使MDI窗口有一个背景图象或使它平
软件启动画面中启动状态的显示
◎→相关资源
C语言入门视频教程
C#编程WinForm入门视频
Asp.net入门视频教程下载
VC++编程视频教程下载
VB窗体文章
HTML入门教程
Deiphi实例教程
Deiphi窗体文章
Deiphi数据库编程
Deiphi网络编程
Deiphi图形图象文章
Deiphi系统文件
◎→ 热门资源
反查漢字拼音
防止多个实例公用程序
防止关闭windows
放置任意的文件到Delphi的EXE文件
改变文件的属性
给MDI主窗口加背景
给控件添加OnMouseLeave事件

根据位图做出漂亮的不规则FORM


日期:2008-10-20 21:48:47    来源:
   
 ·Photoshop“索引颜色”将位图转为矢量图 ·用Delphi7.0实现漂亮的汉字窗口
 ·图层模式去除重复规则排列水印 ·DELPHI中利用API函数实现多态FORM

根据位图做出漂亮的不规则FORM


unit Unit1;  

interface  

uses  
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,  
  ExtCtrls, StdCtrls, Buttons;  

type  
  TForm1 = class(TForm)  
    Image1: TImage;  
    Button1: TButton;  
    procedure FormCreate(Sender: TObject);  
    procedure Button1Click(Sender: TObject);  
    procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;  
      Shift: TShiftState; X, Y: Integer);  
  private  
    function CreateRegion(wMask: TBitmap; wColor: TColor;  
      hControl: THandle): HRGN;  
    { Private declarations }  
  public  
    { Public declarations }  
  end;  

var  
  Form1: TForm1;  

implementation  

{$R *.DFM}  

function Tform1.CreateRegion(wMask:TBitmap;wColor:TColor;hControl:THandle): HRGN;  
var  
  dc, dc_c: HDC;  
  rgn: HRGN;  
  x, y: integer;  
  coord: TPoint;  
  line: boolean;  
  color: TColor;  
begin  
  dc := GetWindowDC(hControl);  
  dc_c := CreateCompatibleDC(dc);  
  SelectObject(dc_c, wMask.Handle);  
  BeginPath(dc);  
  for x:=0 to wMask.Width-1 do  
  begin  
    line := false;  
    for y:=0 to wMask.Height-1 do  
    begin  
      color := GetPixel(dc_c, x, y);  
      if not (color = wColor) then  
      begin  
        if not line then  
        begin  
          line := true;  
          coord.x := x;  
          coord.y := y;  
        end;  
      end;  
      if (color = wColor) or (y=wMask.Height-1) then  
      begin  
        if line then  
        begin  
          line := false;  
          MoveToEx(dc, coord.x, coord.y, nil);  
          LineTo(dc, coord.x, y);  
          LineTo(dc, coord.x + 1, y);  
          LineTo(dc, coord.x + 1, coord.y);  
          CloseFigure(dc);  
        end;  
      end;  
    end;  
  end;  
  EndPath(dc);  
  rgn := PathToRegion(dc);  
  ReleaseDC(hControl, dc);  
  Result := rgn;  
end;  

procedure TForm1.FormCreate(Sender: TObject);  
var  
  w1:TBitmap;  
  w2:TColor;  
  rgn: HRGN;  
begin  
  w1:=TBitmap.Create;  
  w1.Assign(image1.Picture.Bitmap);  
  w2:=w1.Canvas.Pixels[0,0];  
  rgn := CreateRegion(w1,w2,Handle);  
  if rgn<>0 then  
  begin  
     SetWindowRgn(Handle, rgn, true);  
  end;  
  w1.Free;  
end;  

procedure TForm1.Button1Click(Sender: TObject);  
begin  
  Close;  
end;  

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;  
  Shift: TShiftState; X, Y: Integer);  
begin  
  ReleaseCapture;  
  SendMessage(Handle, WM_SYSCOMMAND, $F012, 0);  
end;  

end.

 [1]

用Flash AS消除位图锯齿的实现方法

漂亮美眉滤镜和蒙板抠图法

Action实现小球沿不规则的路径上移动

Forms身份验证提供程序

--->Forms to Go 2.6.10 注册版
--->XPad text editor V2.5┊功能易上手/操作界面漂亮的文本编辑┊汉化绿色免费版
--->OmniFormat V7.6 注册机
--->OmniFormat V7.9
--->Métamorphose 1.0.4┊可以将多种重命名的规则组合在一起┊多国语言绿色特别版
Tags:  位图 漂亮 规则 FORM

芯友网版权所有 1999-2006 | 著作权与商标声明 | 法律声明 | 服务条款 | 隐私声明 | 联系我们