如何制作像word如视图-工具中表格与边框的窗口,能停留在主窗口中,但不影响主窗口的正常使用?
当主窗口获得焦点时,表格与边框窗口同时可以显示在主窗口上可见。如何制作啊?另:如何让窗口变成像mp3中的不规则的窗口,第三方控件也可以。什么名字,哪有得下啊?

解决方案 »

  1.   

    1、2问题不太明白你的意思....3:
    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, TempRgn: HRGN;
      X, Y, BeginY: Integer;
      line: boolean;
      color: TColor;
      begin{代码风格不统一,因为有些是照抄那个外国人的。
      dc := GetWindowDC(hControl);
      dc_c := CreateCompatibleDC(dc);
      SelectObject(dc_c, wMask.Handle);
      BeginY := 0;{这句可以不要,有了可以避免编译器警告。}
      Rgn := CreateRectRgn(0, 0, 0, 0);{先初始化一个空的区域给Rgn。}
      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;
      BeginY:= Y;
      end;
      end;
      if (color = wColor) or (Y = wMask.Height - 1) then
      begin
      if line then
      begin
      line := False;
      TempRgn := CreateRectRgn(X, BeginY, X + 1, Y);
      CombineRgn(Rgn, Rgn, TempRgn, RGN_OR);
      {把图形以连续得线段为单位生成区域,并且合并到总的区域中}
      end;
      end;
      end;
      end;
      ReleaseDC(hControl, dc);
      DeleteObject(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;