zoukankan      html  css  js  c++  java
  • 窗体图片背景(两种方法:设置Brush.Bitmap指向图片,别的控件也可以这样)

    var
      Bitmap: TBitmap;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Bitmap := TBitmap.Create;
      Bitmap.LoadFromFile('c:	empg.bmp');
      Self.Brush.Bitmap := Bitmap;
    end;
    
    procedure TForm1.FormDestroy(Sender: TObject);
    begin
      Bitmap.Free;
    end;

    //效果图:
    

    http://www.cnblogs.com/del/archive/2008/02/10/1066596.html

    -------------------------------------------------------------------------------------------------------------------

    WinAPI: CreatePatternBrush - 建立位图画刷
    //声明:
    CreatePatternBrush(   Bitmap: HBITMAP {位图句柄} ): HBRUSH;        {返回画刷句柄}

    //举例:
    procedure TForm1.FormPaint(Sender: TObject);
    var
      Bitmap: TBitmap;
      BrushHandle: HBRUSH;
    begin
      Bitmap := TBitmap.Create;
      Bitmap.LoadFromFile('c:	empg.bmp');
      BrushHandle := CreatePatternBrush(Bitmap.Handle);
      FillRect(Canvas.Handle, ClientRect, BrushHandle);
      DeleteObject(BrushHandle);
    end;

    //效果图:
    
  • 相关阅读:
    指针
    Centos6.5 安装Vim7.4
    C++ Prime:指针和const
    C++ Prime:const的引用
    C++ Prime:函数
    C++ Prime:范围for语句
    python的oop概述
    脚本单独调用django模块
    xtrabackup备份之xbstream压缩
    MySQL8.0安装
  • 原文地址:https://www.cnblogs.com/findumars/p/6027922.html
Copyright © 2011-2022 走看看