zoukankan      html  css  js  c++  java
  • WinAPI: CreateBrushIndirect 根据画刷结构建立画刷

    //声明:
    CreateBrushIndirect(
      const p1: TLogBrush {画刷结构}
    ): HBRUSH;            {返回画刷句柄}
    
    //TLogBrush 是 tagLOGBRUSH 结构的重定义:
    tagLOGBRUSH = packed record
      lbStyle: UINT;     {画刷风格}
      lbColor: COLORREF; {颜色}
      lbHatch: Longint;  {阴影样式}
    end;
    
    //lbStyle 可选值:
    BS_SOLID         = 0;
    BS_NULL          = 1;
    BS_HOLLOW        = BS_NULL;
    BS_HATCHED       = 2;
    BS_PATTERN       = 3;
    BS_INDEXED       = 4;
    BS_DIBPATTERN    = 5;
    BS_DIBPATTERNPT  = 6;
    BS_PATTERN8X8    = 7;
    BS_DIBPATTERN8X8 = 8;
    BS_MONOPATTERN   = 9;
    
    //lbHatch 可选值:
    HS_HORIZONTAL = 0;
    HS_VERTICAL   = 1; 
    HS_FDIAGONAL  = 2; 
    HS_BDIAGONAL  = 3; 
    HS_CROSS      = 4; 
    HS_DIAGCROSS  = 5;
    
    //举例: procedure TForm1.FormPaint(Sender: TObject); var b: TLogBrush; BrushHandle: HBRUSH; begin b.lbStyle := BS_HATCHED; b.lbColor := clRed; b.lbHatch := HS_CROSS; BrushHandle := CreateBrushIndirect(b); Canvas.Brush.Handle := BrushHandle; FillRect(Canvas.Handle, ClientRect, BrushHandle); DeleteObject(BrushHandle); end;
    //效果图:

  • 相关阅读:
    典型并发任务
    第九章使用共享变量实现并发
    第八章goroutine和通道
    第七章接口
    第六章方法
    第一章
    第四章复合数据类型
    第三章基础数据类型
    Django其他
    VUE学习日记(五) ---- 组件定义 component
  • 原文地址:https://www.cnblogs.com/del/p/1066600.html
Copyright © 2011-2022 走看看