zoukankan      html  css  js  c++  java
  • WinAPI: SetRectEmpty、IsRectEmpty

    SetRectEmpty: 使矩形为空;

    IsRectEmpty: 判断矩形是否为空;

    所谓矩形为空就是矩形是无区域的, 或者说是 Right <= Left 或 Bottom <= Top 情形下的矩形.
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;
    
    type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.FormCreate(Sender: TObject);
    var
      R: TRect;
      buf: array[Byte] of Char;
    begin
      R := Rect(10,20,-30,-40);
      ShowMessage(BoolToStr(IsRectEmpty(R), True)); {True; 是空矩形}
    
      R := Rect(10,20,30,40);
      ShowMessage(BoolToStr(IsRectEmpty(R), True)); {False}
    
      wvsprintf(buf, 'L:%d, T:%d, R:%d, B:%d', @R);
      ShowMessage(buf); {L:10, T:20, R:30, B:40}
    
      SetRectEmpty(R);
    
      ShowMessage(BoolToStr(IsRectEmpty(R), True)); {True}
    
      wvsprintf(buf, 'L:%d, T:%d, R:%d, B:%d', @R);
      ShowMessage(buf); {L:0, T:0, R:0, B:0}
    end;
    
    end.
    
    关于 wvsprintf 函数请参见: http://www.cnblogs.com/del/archive/2008/04/18/1159045.html

  • 相关阅读:
    python flask学习笔记
    语音识别2 -- Listen,Attend,and Spell (LAS)
    语音识别 1--概述
    keras中seq2seq实现
    ResNet模型
    Bytes类型
    Python操作文件
    Pyhon基本数据类型
    ping
    find
  • 原文地址:https://www.cnblogs.com/del/p/1205693.html
Copyright © 2011-2022 走看看