Delphi XE5:如何在TButtonGroup中停止滚动
我在TCategoryPanel中有一个TbuttonGroup设置为alClient,我无法停止用鼠标滚轮滚动。当焦点设置为按钮组时,即使所有项目都已可见,并且大小设置为容纳所有内容+2像素,它将向上移动按钮组的内容并隐藏第一个项目,并在底部创建空白区域。我在自己的研究中没有发现任何与这种行为相关的东西,所以如果有人有这种行为,我可以提出建议 图像: 滚动前Delphi XE5:如何在TButtonGroup中停止滚动,delphi,Delphi,我在TCategoryPanel中有一个TbuttonGroup设置为alClient,我无法停止用鼠标滚轮滚动。当焦点设置为按钮组时,即使所有项目都已可见,并且大小设置为容纳所有内容+2像素,它将向上移动按钮组的内容并隐藏第一个项目,并在底部创建空白区域。我在自己的研究中没有发现任何与这种行为相关的东西,所以如果有人有这种行为,我可以提出建议 图像: 滚动前 滚动1后 滚动2后 到目前为止,我发现阻止它的唯一方法是将其设置为1个全按钮高度(24px)。但是,对于GUI来说,这并不是一个真
滚动1后
滚动2后 到目前为止,我发现阻止它的唯一方法是将其设置为1个全按钮高度(24px)。但是,对于GUI来说,这并不是一个真正可以接受的解决方案 DFM的副本:
object MainF: TMainF
Left = 0
Top = 0
Caption = 'MainF'
ClientHeight = 550
ClientWidth = 785
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
OnClose = FormClose
OnCreate = FormCreate
OnPaint = FormPaint
OnResize = FormResize
DesignSize = (
785
550)
PixelsPerInch = 96
TextHeight = 13
object ScrollBox1: TScrollBox
Left = 200
Top = 45
Width = 585
Height = 505
Align = alClient
BevelInner = bvNone
BevelOuter = bvNone
BorderStyle = bsNone
Color = clWindow
ParentColor = False
TabOrder = 0
OnClick = FlowPanel1Click
object FlowPanel1: TFlowPanel
Left = 0
Top = 0
Width = 585
Height = 105
Align = alTop
AutoSize = True
BevelOuter = bvNone
Color = clWindow
TabOrder = 0
OnClick = FlowPanel1Click
end
end
object CategoryPanelGroup1: TCategoryPanelGroup
Left = 0
Top = 45
Height = 505
VertScrollBar.Tracking = True
HeaderFont.Charset = DEFAULT_CHARSET
HeaderFont.Color = clWindowText
HeaderFont.Height = -11
HeaderFont.Name = 'Tahoma'
HeaderFont.Style = []
TabOrder = 1
object CategoryPanel2: TCategoryPanel
Top = 220
Height = 100
Caption = 'Hail'
TabOrder = 0
object ButtonGroup2: TButtonGroup
Left = 0
Top = 0
Width = 196
Height = 74
Align = alClient
BorderStyle = bsNone
ButtonOptions = [gboFullSize, gboShowCaptions]
Items = <
item
Caption = 'Extended Crop Report'
end
item
Caption = 'Total Crop Summary Report'
end
item
Caption = 'Crop Summary Report'
end>
TabOrder = 0
end
end
object CategoryPanel1: TCategoryPanel
Top = 0
Height = 220
Caption = 'Assessment'
TabOrder = 1
object ButtonGroup1: TButtonGroup
Left = 0
Top = 0
Width = 196
Height = 194
Align = alClient
BorderStyle = bsNone
ButtonOptions = [gboFullSize, gboShowCaptions]
Items = <
item
Caption = 'Assessment By Property(Detailed)'
end
item
Caption = 'Assessment By Property'
end
item
Caption = 'Assessment Summary 1 Page'
end
item
Caption = 'Assessment By PPC'
end
item
Caption = 'Assessment By LPC'
end
item
Caption = 'Assessment By Authority For LPC'
end
item
Caption = 'Property By Assessment Number'
end
item
Caption = 'Assessment By Authority For PPC'
end>
TabOrder = 0
end
end
end
object Panel1: TPanel
Left = 0
Top = 0
Width = 785
Height = 45
Align = alTop
BevelOuter = bvNone
ParentColor = True
TabOrder = 2
object Label1: TLabel
Left = 10
Top = 0
Width = 349
Height = 43
AutoSize = False
Caption = 'Reports for redacted'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
Layout = tlCenter
end
end
object WaitPanel: TPanel
Left = 228
Top = 167
Width = 505
Height = 100
Anchors = [akLeft, akTop, akRight, akBottom]
Caption = 'A report is open. Please wait...'
TabOrder = 3
end
object MainMenu1: TMainMenu
Left = 368
Top = 152
object mnuFile1: TMenuItem
Caption = 'File'
object mnuExit1: TMenuItem
Caption = 'Exit'
end
end
object Settings1: TMenuItem
Caption = 'Settings'
object mnuReports1: TMenuItem
Caption = 'Reports'
OnClick = mnuReports1Click
end
object mnuChangeCommon1: TMenuItem
Caption = 'Change Common Reports'
OnClick = mnuChangeCommon1Click
end
end
object mnuHelp1: TMenuItem
Caption = 'Help'
object mnuAbout1: TMenuItem
Caption = 'About'
OnClick = mnuAbout1Click
end
end
end
object ReportListDB: TABSDatabase
Connected = True
CurrentVersion = '7.30 '
DatabaseFileName = ''
DatabaseName = 'RptName'
Exclusive = False
MaxConnections = 500
MultiUser = False
SessionName = 'Default'
Left = 336
Top = 261
end
object ReportList: TABSTable
CurrentVersion = '7.30 '
DatabaseName = 'RptName'
InMemory = False
ReadOnly = False
StoreDefs = True
IndexDefs = <
item
Name = 'IDKey'
Fields = 'ID'
Options = [ixPrimary]
end>
IndexName = 'IDKey'
FieldDefs = <
item
Name = 'ID'
DataType = ftAutoInc
end
item
Name = 'ReportFileName'
DataType = ftString
Size = 100
end
item
Name = 'ReportTitle'
DataType = ftString
Size = 100
end
item
Name = 'ReportClass'
DataType = ftString
Size = 20
end
item
Name = 'CommonReports'
DataType = ftInteger
end>
TableName = 'ReportList'
Exclusive = False
Left = 408
Top = 261
object ReportListCommonReports: TIntegerField
DisplayWidth = 10
FieldName = 'CommonReports'
end
object ReportListReportTitle: TStringField
DisplayWidth = 30
FieldName = 'ReportTitle'
Size = 100
end
object ReportListReportClass: TStringField
DisplayWidth = 10
FieldName = 'ReportClass'
end
object ReportListReportFileName: TStringField
DisplayWidth = 45
FieldName = 'ReportFileName'
Visible = False
Size = 100
end
object ReportListID: TAutoIncField
DisplayWidth = 2
FieldName = 'ID'
Visible = False
end
end
object ReportOrderQRY: TABSQuery
CurrentVersion = '7.30 '
DatabaseName = 'RptName'
InMemory = False
ReadOnly = True
SQL.Strings = (
'SELECT ID, CommonReports, ReportTitle'
'FROM ReportList'
'WHERE CommonReports > 0'
'ORDER BY CommonReports')
Left = 480
Top = 261
object ReportOrderQRYID: TIntegerField
FieldName = 'ID'
end
object ReportOrderQRYCommonReports: TIntegerField
FieldName = 'CommonReports'
end
object ReportOrderQRYReportTitle: TStringField
FieldName = 'ReportTitle'
Size = 100
end
end
end
对象维护:TMainF
左=0
Top=0
标题='MainF'
ClientHeight=550
ClientWidth=785
颜色=clBtnFace
Font.Charset=默认字符集
Font.Color=clWindowText
字体高度=-11
Font.Name='Tahoma'
Font.Style=[]
菜单=主菜单1
OldCreateOrder=False
OnClose=FormClose
OnCreate=FormCreate
OnPaint=FormPaint
OnResize=FormResize
设计尺寸=(
785
550)
PixelsPerInch=96
text高度=13
对象滚动框1:TScrollBox
左=200
顶部=45
宽度=585
高度=505
Align=alClient
贝弗林纳=bvNone
斜面=无
BorderStyle=bsNone
颜色=clWindow
ParentColor=False
TabOrder=0
OnClick=FlowPanel1Click
对象FlowPanel 1:TFlowPanel
左=0
Top=0
宽度=585
高度=105
Align=alTop
自动调整大小=真
斜面=无
颜色=clWindow
TabOrder=0
OnClick=FlowPanel1Click
结束
结束
对象类别PanelGroup 1:TCategoryPanelGroup
左=0
顶部=45
高度=505
VertScrollBar.Tracking=True
HeaderFont.Charset=默认字符集
HeaderFont.Color=clWindowText
头部高度=-11
HeaderFont.Name='Tahoma'
HeaderFont.Style=[]
TabOrder=1
对象类别Panel2:TCategoryPanel
Top=220
高度=100
标题=‘万岁’
TabOrder=0
对象按钮组2:TButtonGroup
左=0
Top=0
宽度=196
高度=74
Align=alClient
BorderStyle=bsNone
按钮选项=[gboFullSize,gboShowCaptions]
项目=<
项目
标题='扩展作物报告'
结束
项目
标题='总作物汇总报告'
结束
项目
标题='作物摘要报告'
结束>
TabOrder=0
结束
结束
对象类别Panel1:TCategoryPanel
Top=0
高度=220
标题=‘评估’
TabOrder=1
对象按钮组1:TButtonGroup
左=0
Top=0
宽度=196
高度=194
Align=alClient
BorderStyle=bsNone
按钮选项=[gboFullSize,gboShowCaptions]
项目=<
项目
标题=‘按物业评估(详细)’
结束
项目
标题=‘按财产评估’
结束
项目
标题='评估摘要1页'
结束
项目
标题=‘PPC评估’
结束
项目
标题=‘LPC评估’
结束
项目
标题=“LPC的权威评估”
结束
项目
标题='按评估编号列出的财产'
结束
项目
标题=“PPC的权威评估”
结束>
TabOrder=0
结束
结束
结束
对象面板1:TPanel
左=0
Top=0
宽度=785
高度=45
Align=alTop
斜面=无
ParentColor=True
TabOrder=2
对象标签1:TLabel
左=10
Top=0
宽度=349
高度=43
自动调整大小=错误
标题=‘已编辑的报告’
Font.Charset=默认字符集
Font.Color=clWindowText
字体高度=-24
Font.Name='Tahoma'
Font.Style=[]
ParentFont=False
布局=TLC中心
结束
结束
对象面板:TPanel
左=228
Top=167
宽度=505
高度=100
锚定=[akLeft、akTop、akRight、akBottom]
Caption='报告已打开。请等一下……”
TabOrder=3
结束
对象MainMenu1:TMainMenu
左=368
Top=152
对象mnuFile1:TMenuItem
标题='文件'
对象mnuExit1:TMenuItem
标题=‘退出’
结束
结束
对象设置1:TMenuItem
标题=‘设置’
对象mnuReports1:TMenuItem
标题=‘报告’
OnClick=mnureports1单击
结束
对象mnuChangeCommon1:TMenuItem
标题='更改常用报告'
OnClick=mnuChangeCommon1Click
结束
结束
对象mnuHelp1:TMenuItem
标题=‘帮助’
对象mnuAbout1:TMenuItem
标题='About'
OnClick=mnuabout1单击
结束
结束
结束
对象ReportListDB:TABSDatabase
已连接=真
当前版本='7.30'
数据库文件名=“”
数据库名称='RptName'
独占=假
最大连接数=500
多用户=假
SessionName='Default'
左=336
Top=261
结束
对象报告列表:TABSTable
当前版本='7.30'
数据库名称='RptName'
InMemory=False
只读=假
StoreDefs=True
IndexDefs=<
项目
Name='IDKey'
字段='ID'
选项=[ixPrimary]
结束>
IndexName='IDKey'
FieldDefs=<
项目
名称='ID'
数据类型=ftAutoInc
结束
项目
名称='ReportFileName'
数据类型=ftString
尺寸=100
E
ButtonGroup1.Height := ButtonGroup1.Height + 1;
procedure TForm1.ButtonGroup1MouseWheelDown(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
begin
if ButtonGroup1.ClientHeight >= ButtonGroup1.Items.Count * ButtonGroup1.ButtonHeight then
Handled := True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if ButtonGroup1.Align = alClient then
ButtonGroup1.Height := ButtonGroup1.Height + 1;
end;