菜尿请教:如何给GroupBox加上滚动条? 调节它的自动适应属性TCheckListBox更好用 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //pasunit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, ValEdit, StdCtrls, ExtCtrls;type TForm1 = class(TForm) GroupBox1: TGroupBox; Panel1: TPanel; ScrollBar1: TScrollBar; Panel2: TPanel; ScrollBar2: TScrollBar; Edit1: TEdit; Edit2: TEdit; Memo1: TMemo; procedure ScrollBar1Change(Sender: TObject); procedure FormShow(Sender: TObject); procedure ScrollBar2Change(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}uses Math;procedure TForm1.ScrollBar1Change(Sender: TObject);begin Panel2.Top := - TScrollBar(Sender).Position;end;procedure TForm1.FormShow(Sender: TObject);begin ScrollBar1.Min := 0; ScrollBar1.Max := Max(Panel2.Height - Panel2.Parent.ClientHeight, 0); ScrollBar2.Min := 0; ScrollBar2.Max := Max(Panel2.Width - Panel2.Parent.ClientWidth, 0); Panel2.Top := 0; Panel2.Left := 0;end;procedure TForm1.ScrollBar2Change(Sender: TObject);begin Panel2.Left := - TScrollBar(Sender).Position;end;end.//dfmobject Form1: TForm1 Left = 192 Top = 107 Width = 544 Height = 375 Caption = 'Form1' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 object GroupBox1: TGroupBox Left = 152 Top = 144 Width = 185 Height = 105 Caption = 'GroupBox1' TabOrder = 0 object Panel1: TPanel Left = 2 Top = 15 Width = 165 Height = 72 Align = alClient BevelOuter = bvNone TabOrder = 0 object Panel2: TPanel Left = 0 Top = 0 Width = 290 Height = 233 BevelOuter = bvNone TabOrder = 0 object Edit1: TEdit Left = 24 Top = 64 Width = 121 Height = 21 TabOrder = 0 Text = 'Edit1' end object Edit2: TEdit Left = 24 Top = 24 Width = 121 Height = 21 TabOrder = 1 Text = 'Edit2' end object Memo1: TMemo Left = 160 Top = 24 Width = 185 Height = 89 Lines.Strings = ( 'Memo1') TabOrder = 2 end end end object ScrollBar1: TScrollBar Left = 167 Top = 15 Width = 16 Height = 72 Align = alRight Kind = sbVertical PageSize = 0 TabOrder = 1 OnChange = ScrollBar1Change end object ScrollBar2: TScrollBar Left = 2 Top = 87 Width = 181 Height = 16 Align = alBottom PageSize = 0 TabOrder = 2 OnChange = ScrollBar2Change end endend delphi中不能使用静态数据成员? 有谁既会VC又会DELPHI吗?帮我翻译一段VC程序为DELPHI,谢谢! 为什么拉DBGrid右边的滚动条不能触发TADOTable的AfterScroo事件?如何拉滚动条时如何觖发。 关于ICON的显示问题? DBChart如何显示数据的动态分组? 两个问题! delphi怎样去读auto cad 中的dwg文件的宽、高等信息 请问,如何删除AdoQuery中的记录,在线等… 請各位幫我修改一下,先謝了! 如何读取一个目录下的所有文件 急:为什么都用uses包含了,还是报告说没定义变量? 注册表中如何建新的主键?30分
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, ValEdit, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Panel1: TPanel;
ScrollBar1: TScrollBar;
Panel2: TPanel;
ScrollBar2: TScrollBar;
Edit1: TEdit;
Edit2: TEdit;
Memo1: TMemo;
procedure ScrollBar1Change(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ScrollBar2Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}uses
Math;procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
Panel2.Top := - TScrollBar(Sender).Position;
end;procedure TForm1.FormShow(Sender: TObject);
begin
ScrollBar1.Min := 0;
ScrollBar1.Max := Max(Panel2.Height - Panel2.Parent.ClientHeight, 0);
ScrollBar2.Min := 0;
ScrollBar2.Max := Max(Panel2.Width - Panel2.Parent.ClientWidth, 0);
Panel2.Top := 0;
Panel2.Left := 0;
end;procedure TForm1.ScrollBar2Change(Sender: TObject);
begin
Panel2.Left := - TScrollBar(Sender).Position;
end;end.//dfm
object Form1: TForm1
Left = 192
Top = 107
Width = 544
Height = 375
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object GroupBox1: TGroupBox
Left = 152
Top = 144
Width = 185
Height = 105
Caption = 'GroupBox1'
TabOrder = 0
object Panel1: TPanel
Left = 2
Top = 15
Width = 165
Height = 72
Align = alClient
BevelOuter = bvNone
TabOrder = 0
object Panel2: TPanel
Left = 0
Top = 0
Width = 290
Height = 233
BevelOuter = bvNone
TabOrder = 0
object Edit1: TEdit
Left = 24
Top = 64
Width = 121
Height = 21
TabOrder = 0
Text = 'Edit1'
end
object Edit2: TEdit
Left = 24
Top = 24
Width = 121
Height = 21
TabOrder = 1
Text = 'Edit2'
end
object Memo1: TMemo
Left = 160
Top = 24
Width = 185
Height = 89
Lines.Strings = (
'Memo1')
TabOrder = 2
end
end
end
object ScrollBar1: TScrollBar
Left = 167
Top = 15
Width = 16
Height = 72
Align = alRight
Kind = sbVertical
PageSize = 0
TabOrder = 1
OnChange = ScrollBar1Change
end
object ScrollBar2: TScrollBar
Left = 2
Top = 87
Width = 181
Height = 16
Align = alBottom
PageSize = 0
TabOrder = 2
OnChange = ScrollBar2Change
end
end
end