zoukankan      html  css  js  c++  java
  • 动态创建Ⅱ

    //动态创建数组控件;和动态绑定它的事件、 (这里为了在Panel画颜色,引用了Raize里面的RzPanel)

    interface

    uses

      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

      Dialogs, StdCtrls, ExtCtrls, Buttons, PanelGroup, RzPanel, RzButton,RzComMon;

    type

      TForm1 = class(TForm)

        Button1: TButton;

        BitBtn1: TBitBtn;

        Image1: TImage;

        Bevel1: TBevel;

        RzPanel1: TRzPanel;

        procedure FormCreate(Sender: TObject);

      private

        { Private declarations }

      public

        procedure PanelOnEnter(Sender: TObject);

        procedure PanelOnClick(Sender: TObject);

      end; 

    var

      Form1: TForm1;

      RzPanel : array[0..31,0..6] of  TRzPanel;

    implementation

     

    {$R *.dfm}

     

     

     

      

    //创建色板

    procedure TForm1.FormCreate(Sender: TObject);

    var

             I,j : integer;

        str,R,G,B: string;

    begin

        for i:=0 to 31 do

        begin

            for j:=0 to 6  do

            begin

                RzPanel[i][j]:= TRzPanel.Create(nil);

                RzPanel[i][j].Parent :=Form1;

                RzPanel[i][j].Top := j*(RzPanel[i][j].Top +30)+15;

                RzPanel[i][j].Height := 23;

                RzPanel[i][j].Width :=23;

                RzPanel[i][j].Left := i* (RzPanel[i][j].Width+5) + 60;

                RzPanel[i][j].ShowHint := true;

                RzPanel[i][j].BorderOuter := fsNone;

                RzPanel[i][j].BorderColor := clActiveBorder;

                RzPanel[i][j].BorderWidth := 1;

                RzPanel[i][j].OnMouseEnter := PanelOnEnter;

                RzPanel[i][j].OnClick := PanelOnClick;

            end;

            RzPanel[i][0].Color := RGB(255,255,255-i*2);

            str := '$';

            R := format('%0x',[ord(255)]);

            G := format('%0x',[ord(255)]);

            B := format('%0x',[ord(255-i*2)]);

            RzPanel[i][0].Hint := Str + R +G +B;

            RzPanel[i][1].Color := RGB(255,255-i*2,255);

            R := format('%0x',[ord(255)]);

            G := format('%0x',[ord(255-i*2)]);

            B := format('%0x',[ord(255)]);

            RzPanel[i][1].Hint := Str + R +G +B;

            RzPanel[i][2].Color := RGB(255,255-i*2,255-i*2);

            R := format('%0x',[ord(255)]);

            G := format('%0x',[ord(255-i*2)]);

            B := format('%0x',[ord(255-i*2)]);

            RzPanel[i][2].Hint := Str + R +G +B;

            RzPanel[i][3].Color := RGB(255-i*2,255,255);

            R := format('%0x',[ord(255-i*2)]);

            G := format('%0x',[ord(255)]);

            B := format('%0x',[ord(255)]);

            RzPanel[i][3].Hint := Str + R +G +B;

            RzPanel[i][4].Color := RGB(255-i*2,255,255-i*2);

            R := format('%0x',[ord(255-i*2)]);

            G := format('%0x',[ord(255)]);

            B := format('%0x',[ord(255-i*2)]);

            RzPanel[i][4].Hint := Str + R +G +B;

            RzPanel[i][5].Color := RGB(255-i*2,255-i*2,255);

            R := format('%0x',[ord(255-i*2)]);

            G := format('%0x',[ord(255-i*2)]);

            B := format('%0x',[ord(255)]);

            RzPanel[i][5].Hint := Str + R +G +B;

            RzPanel[i][6].Color := RGB(255-i*2,255-i*2,255-i*2);

            R := format('%0x',[ord(255-i*2)]);

            G := format('%0x',[ord(255-i*2)]);

            B := format('%0x',[ord(255-i*2)]);

            RzPanel[i][6].Hint := Str + R +G +B;

            end;

    end;

     

  • 相关阅读:
    C#神奇的扩展方法
    OCIEnvCreate 失败,返回代码为 -1,但错误消息文本不可用
    xslt格式化日期的方法
    c# 对象存cookie
    Oracle Client安装报错:引用数据不可用于验证此操作系统分发的先决条件
    Web.config中设置启用webservice远程调试访问 参数看不到
    ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
    IIS无法加载字体文件(*.woff,*.svg)的解决办法
    word 里面没输入法
    photoshop cc 2018破解补丁(pscc2018注册机) 附使用方法
  • 原文地址:https://www.cnblogs.com/lingzhiwen/p/3705001.html
Copyright © 2011-2022 走看看