unit Unit1;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type
TForm1 = class(TForm)
ScrollBox1: TScrollBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
numPerCol,col: Integer;
_left: Integer;
_top: Integer;
row: Integer;
recnum, vspace: Integer;
chk: TCheckBox;
begin
col := ;
row := ;
recnum := ;
vspace := ; //行间距
_left := ;
_top := ;
numPerCol:=; //每列显示10个checkbox for i := to do
begin
inc(recnum);
chk := TCheckBox.Create(self.ScrollBox1);
chk.Parent := self.ScrollBox1;
chk.Caption := IntToStr(i);
chk.Tag := i;
if (recnum mod numPerCol = ) then
begin
chk.Left := _left * col + chk.Width * (col - ); if col > then
chk.Top := _top + chk.Height * (row - ) +
vspace * (row - )
else
chk.Top := _top * (col) + chk.Height *
(row - ) + vspace * (row - ); inc(col);
row := ;
end
else
begin
chk.Left := _left * col + chk.Width * (col - ); if col > then
chk.Top := _top + chk.Height *
(row - ) + vspace * (row - )
else
chk.Top := _top * (col) + chk.Height *
(row - ) + vspace * (row - ); inc(row);
end;
end;
end; end.

代码的效果图如下:

[原创]delphi一次性批量在TScrollBox中显示N个复选框TCheckBox的源码的更多相关文章

  1. 关于netbeans中的JComboBox(复选框)

    以最近写的选课系统中添加课程项为例 1.往复选框中放入选项(根据数据库添加) (1)首先将  属性—>model中默认Item1234清空 (2)获得数据库中的数据并放入. SelectCour ...

  2. QTreeView/QTableView中利用QStandardItem实现复选框三种形态变化

    https://www.techieliang.com/2017/12/729/ 原文地址 using_checkbox_item.h /** * @file using_checkbox_item. ...

  3. extjs 中动态给gridpanel 复选框赋值

    最近在搞extjs时需要动态根据数据给gridpanel的复选框赋值 网上看了很多 ,多不行,最后找到一个好使的方法 如下: RBACformPanel.getSelectionModel().sel ...

  4. 关于Unity中NGUI的Checkbox复选框、Slider滑动条和Button的6种触发回调事件的方式

    Checkbox复选框 1.创建一个NGUI背景Sprite1节点 2.打开NGUI---->Open---->Prefab Toolbar---->选择一个复选框节点,拖拽到背景节 ...

  5. Extjs3.4 grid中添加一列复选框

    var sm = new Ext.grid.CheckboxSelectionModel(); var cm = new Ext.grid.ColumnModel( [ sm, new Ext.gri ...

  6. mui开发中获取单选按钮、复选框的值

    js获取单选按钮的值 function getVals(){ var res = getRadioRes('rds'); if(res == null){mui.toast('请选择'); retur ...

  7. Web 开发中很实用的10个效果【附源码下载】

    在工作中,我们可能会用到各种交互效果.而这些效果在平常翻看文章的时候碰到很多,但是一时半会又想不起来在哪,所以养成知识整理的习惯是很有必要的.这篇文章给大家推荐10个在 Web 开发中很有用的效果,记 ...

  8. 转:Web 开发中很实用的10个效果【附源码下载】

    原文地址:http://www.cnblogs.com/lhb25/p/10-useful-web-effect.html 在工作中,我们可能会用到各种交互效果.而这些效果在平常翻看文章的时候碰到很多 ...

  9. 表格中的checkbox复选框 全选非全选 公共方法 及提交选中结果

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

随机推荐

  1. Windows Server 2012 R2 无法启用Microsoft .NET Framework 3.5 功能

    1 在新windows 2012 R2 上安装SQL 2014 ,提示需要安装 .NET Framework 3.5 2 在添加角色和功能--功能--.NET Framework 3.5,然后失败 3 ...

  2. C#存储过程 传入参数 传出参数 结果集

    作者:卞功鑫 转载请保留:http://www.cnblogs.com/BinBinGo/p/6400928.html //1 连接字符串 string connectionString = &quo ...

  3. linux xml

    1:xml的基础语法,识别,创建xml文件 xml文件头:<?xml version="1.0" encoding="utf-8"?> 必须要有且 ...

  4. CF865D Buy Low Sell High

    /* 贪心来选择, 如果能找到比当前小的, 就用最小的来更新当前的 优先队列即可 */ #include<cstdio> #include<algorithm> #includ ...

  5. 类似openDialog的弹窗

    html <modal title="这里是标题" hidden="{{modalHidden}}" bindconfirm="modalCon ...

  6. angularjs,Jsonp跨域访问页面

    angularjs1.6.8版本跨域 <!DOCTYPE html> <html ng-app="test"> <head> <meta ...

  7. bootstrap-datepicker实现日期input readonly 标签中选择时间功能

    引用datepicker css,js,zh-CH文件 ps: 都是基于bootstrap,所以得先引入bootstrap文件才可以使用 <link href="https://cdn ...

  8. ORACLE 归档日志打开关闭方法

    一 设置为归档方式 1 sql> archive log list;   #查看是不是归档方式 2 sql> alter system set log_archive_start=true ...

  9. uva-310-L--system-暴力枚举

    题意:输入四个字符串a,b,w,z,经过一定的替换规则,问w或者w的子串中是否包含z. 替换规则如下.w中的字符a全部替换成a字符串,b字符全部替换成b字符串. 枚举过程, 根据替换规则对w进行替换, ...

  10. Heap Dump (heap=dump)

    Heap Dump (heap=dump) 转储堆内容使用heap=dump选项.可以是ASCII或者是二进制格式,根据设定的格式,jhat解析二进制格式.format=b. 如果指定格式是二进制,转 ...