本文整理自网络,侵删。
新建一个Delphi工程,在窗体上添加一个TStringGrid控件,在窗体上点击鼠标右键,在弹出的右键菜单中选择“View as Text”,找到StringGrid1的定义部分,添加各列的列宽值即可,注意:添加的列宽值个数要与StringGrid1的列数相同,否则会出错,窗体完整代码如下,其中红色字体部分是我们添加的内容:
object Form1: TForm1
Left = 247
Top = 151
Width = 979
Height = 563
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object StringGrid1: TStringGrid
Left = 16
Top = 16
Width = 617
Height = 345
TabOrder = 0
ColWidths = (
40
100
40
60
80)
end
end
在窗体上点击鼠标右键,在右键菜单中选择“View as Form”即可切换到窗体设计界面。
相关阅读 >>
Delphi报警声音 beep、messagebeep 和 windows.beep
Delphi firedac 下的 sqlite [2] - 第一个例子
Delphi try abort、exit except 、finally end 执行情况
更多相关阅读请进入《Delphi》频道 >>