hehe, my e-mail :[email protected]

解决方案 »

  1.   

    哈哈,我也有的是,[email protected]
      

  2.   

    这里有创建椭圆窗体的一段代码
    procedure TFrmMain.FormCreate(Sender: TObject);
    var
      rgn:HRGN;
    begin
      rgn:=CreateEllipticRgn(0,0,150,150);
      SetWindowRgn(self.Handle, rgn, true);
    end;
    更一般的用CreatePolygonRgn代替CreateEllipticRgn就可以做出任意形状的窗体了四四方方的窗体也会变形,利用win32 API函数setwindowrgn就可以将窗口定义为任何形状,以下是将窗口定义为园角矩形的例子:
    procedure TPortForm.FormCreate(Sender: Tobject);
    var hr :thandle;
    begin
    hr:=createroundrectrgn(0,0,width,height,20,20);//定义园角矩形(win API函数)
    setwindowrgn(handle,hr,true); //设置园角窗口
    end;
    为了使该窗口更好,应在onResize事件处理程序放相同的代码。
    /////////////////////////////////////
    用汉字做窗体形状
    procedure TForm1.FormCreate(Sender: TObject);
    var
    rgn:HRGN;
    begin
     BeginPath(Canvas.Handle);
     SetBkMode( Canvas.Handle, TRANSPARENT );
     Canvas.Font.Name:= '宋体';
     Canvas.Font.Size:=100;
     Canvas.TextOut( 20, 20, '漂亮吗?');//用"漂亮吗?"作为form的形状
     EndPath(Canvas.Handle);
     rgn:= PathToRegion(Canvas.Handle);
     SetWindowRgn( Handle, rgn, true );
    end;
    .........................
      

  3.   

    To zhangkan:
    怎么才能生成象mediaplayer 7.0那样的rgn:HRGN
      

  4.   

    也给我一份吧!
    [email protected]
      

  5.   

    一个IMAGE类型的字段,从数据库中把它存入IMAGELIST中最简单的办法是什么??
      

  6.   

    我有可以使form变成象mediaplayer 7.0的原码,有人要吗?
    这里先贴另一片文章:怎样做一个和位图的形状一样的窗体
    Example 
    -------Global Variables 
    ----------------
    (In The Private Section Of Your Form Declaration)
    SourceBitmap : TBitmap;Procedures
    ----------
    (In The Public Section Of Your Form Declaration)
    procedure GetColor(const SLine : PByteArray; const L: Integer;
                       ,var R: Integer,var C: TColor);function GetColorOf(ScanLine: PByteArray; X : Word): TColor;
    Int The OnCreate Event Of The Form You Put
    ------------------------------------------
    var 
      NewRgn, RowRgn, ScanRgn : HRGN;
      Rows, Left, Right       : Integer;
      Line                    : PByteArray;
      SourceColor             : TColor;
    begin
      SourceBitmap := TBitmap.Create;
      SourceBitmap.LoadFromFile('example.bmp');
      NewRgn := CreateRectRgn(0,0,0,0);
      For Rows := 0 To SourceBitmap.Height - 1 Do
      Begin
        RowRgn := CreateRectRgn(0,Rows,0,Rows);
        Line   := SourceBitmap.Scanline[Rows];
        Left := 0; Right := 0;
        repeat
          GetColor(Line,Left,Right,SourceColor); 
          If (SourceColor <> clWhite) Then
          Begin 
            ScanRgn := CreateRectRgn(Left,Rows,Right + 1,Rows + 1);
            CombineRgn(RowRgn,RowRgn,ScanRgn,RGN_OR);
            DeleteObject(ScanRgn);  
          End;
          CombineRgn(NewRgn,NewRgn,RowRgn,RGN_OR);
          DeleteObject(RowRgn);
        while (right >= SourceBitmap.Width); 
      End;
      SetWindowRgn(Handle,NewRgn,True);
    end;In The GetColor Procedure 
    -------------------------
    var
      Column       : integer;
      CompareColor : TColor;
    begin
      Column := L;
      CompareColor := GetColorOf(SLine,L);
      repeat
        Inc(Column);
      until (CompareColor <> GetColorOf(SLine,Column)) 
             or (Column >= SourceBitmap.Width);
      R := column - 1;
      C := CompareColor;
    end;In The Function GetColorOf
    --------------------------
    var 
      Red, Green, Blue : Byte;
    begin
      If SourceBitmap = nil then exit;
      If (X > SourceBitmap.Width) then Exit;
      Result := clBlack;
      Red   := ScanLine[X * 3];
      Green := ScanLine[X * 3 + 1];
      Blue  := ScanLine[X * 3 + 2];
      If ((Red >= 138) and (Green >= 138) and (Blue >= 138)) Then
        Result := clWhite
    end;
      

  7.   

    to  DeityFox(神狐) 
      给我一份,谢
      [email protected]
      

  8.   

    DeityFox(神狐):给我一份源程序吧。Thank you very much.
    ps.用SetWindowRgn,怎么才能生成任意形状的rgn:HRGN
      

  9.   

    也可以给我一份吗?
    [email protected]
      

  10.   

    不规则窗口的讨论,请将以下代码添加到FormCreate事件中
    运行即可完成字体窗体的创建。 
    procedure TForm1.FormCreate(Sender: TObject);
    var rgn:HRGN;
    begin
    Form1.Color:=clRed;
    BeginPath(Canvas.Handle);
    SetBKMode(Canvas.Handle,TRANSPARENT);
    Canvas.Font.Name:='宋体';
    Canvas.Font.Size:=200;
    Canvas.TextOut(150,130,'黄昏狼');
    EndPath(Canvas.Handle);
    rgn:=PathToRegion(Canvas.Handle);
    SetWindowRgn(Handle,rgn,true);
    end;