乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      分別使用靜態(tài)數(shù)組與動態(tài)數(shù)組建立一個區(qū)域

       獨孤求財 2012-03-28

      問題來源: http://www.cnblogs.com/del/archive/2008/05/26/1207811.html#1475006

      本例效果圖:



      代碼文件:
      unit Unit1;
      
      interface
      
      uses
        Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
        Dialogs, StdCtrls;
      
      type
        TForm1 = class(TForm)
          Button1: TButton;
          Button2: TButton;
          procedure Button1Click(Sender: TObject);
          procedure Button2Click(Sender: TObject);
        end;
      
      var
        Form1: TForm1;
      
      implementation
      
      {$R *.dfm}
      
      {使用靜態(tài)數(shù)組建立區(qū)域}
      procedure TForm1.Button1Click(Sender: TObject);
      var
        arr: array[0..3] of TPoint;
        rgn: HRGN;
        w,h: Integer;
      begin
        w := ClientWidth;
        h := ClientHeight;
        arr[0] := Point(w div 2, 0);
        arr[1] := Point(w, h div 2);
        arr[2] := Point(w div 2, h);
        arr[3] := Point(0, h div 2);
        rgn := CreatePolygonRgn(arr, Length(arr), WINDING);
      
        {下面是描邊和填充這個區(qū)域}
        Canvas.Brush.Color := clSilver;
        FrameRgn(Canvas.Handle, rgn, Canvas.Brush.Handle, 1, 1);
      
        Canvas.Brush.Style := bsCross;
        FillRgn(Canvas.Handle, rgn, Canvas.Brush.Handle);
      end;
      
      {使用動態(tài)數(shù)組建立區(qū)域}
      procedure TForm1.Button2Click(Sender: TObject);
      var
        arr: array of TPoint;
        rgn: HRGN;
        w,h: Integer;
      begin
        SetLength(arr, 4);
        w := ClientWidth;
        h := ClientHeight;
        arr[0] := Point(w div 2, 0);
        arr[1] := Point(w, h div 2);
        arr[2] := Point(w div 2, h);
        arr[3] := Point(0, h div 2);
        rgn := CreatePolygonRgn(arr[0], Length(arr), WINDING); {第一個參數(shù)是數(shù)組的起點}
      
        {下面是描邊和填充這個區(qū)域}
        Canvas.Brush.Color := clRed;
        FrameRgn(Canvas.Handle, rgn, Canvas.Brush.Handle, 1, 1);
        Canvas.Brush.Style := bsCross;
        FillRgn(Canvas.Handle, rgn, Canvas.Brush.Handle);
      end;
      
      end.
      

      窗體文件:
      object Form1: TForm1
        Left = 0
        Top = 0
        Caption = 'Form1'
        ClientHeight = 175
        ClientWidth = 289
        Color = clBtnFace
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clWindowText
        Font.Height = -11
        Font.Name = 'Tahoma'
        Font.Style = []
        OldCreateOrder = False
        PixelsPerInch = 96
        TextHeight = 13
        object Button1: TButton
          Left = 208
          Top = 113
          Width = 75
          Height = 25
          Caption = 'Button1'
          TabOrder = 0
          OnClick = Button1Click
        end
        object Button2: TButton
          Left = 208
          Top = 144
          Width = 75
          Height = 25
          Caption = 'Button2'
          TabOrder = 1
          OnClick = Button2Click
        end
      end
      

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多