Previous topicNext topic
Help > 开发指南 > SanMuGrid平台编程 > 主要对象 > BaseGrid > 属性 >
主要对象
属性名称 分类 是否常用 说明
Footers 主要对象 获取页脚。页脚是网格下方包含摘要信息的行。
Form 主要对象 返回当前控件所在的窗体。
GlobalHandler 主要对象 控制表的全局事件的开关。
GridMenu 主要对象 与表绑定的菜单。
Tree 主要对象 获取对GridTree对象的引用,该对象控制大纲树在网格中的外观。

Vb.Net
Dim tbl As SmGrid=Proj.CurrentSmGrid
'设置最后的脚注是否固定在表格最下方。
tbl.Footers.Fixed = True
'清空当前所有脚注
tbl.Footers.Descriptions.Clear()
Dim foot As New FooterDescription()
foot.Caption="合计:"
tbl.Footers.Descriptions.Add(foot)
'添加合计行中数量的合计
Dim def As New AggregateDefinition()
def.PropertyName="数量"
def.Aggregate=AggregateEnum.Sum
foot.Aggregates.Add(def)
'添加合计行中金额的合计
def=New AggregateDefinition()
def.PropertyName="金额"
def.Aggregate=AggregateEnum.Sum
foot.Aggregates.Add(def)

'我们可以通过Form属性访问到当前表格所属的窗体对象,再进而获得其他表的访问
For Each tb As BaseGrid In tbl.Form.Grids
    Proj.MsgDebug.Add(tb.Name)
Next
    
'我们可以用代码打开或关闭当前窗体的全局表事件。如果打开,当前表就会监听、执行全局表事件中的代码
tbl.GlobalHandler.CellButtonClick=True
tbl.GlobalHandler.AfterLoaded=True

'可以通过GridMenu获得表所关联的菜单
Dim cmd As C1Command= tbl.GridMenu.CommandHolder.Commands("cmdShow")
cmd.PerformClick()

C#
SmGrid tbl = Proj.CurrentSmGrid;
// 设置最后的脚注是否固定在表格最下方。
tbl.Footers.Fixed = true;
// 清空当前所有脚注
tbl.Footers.Descriptions.Clear();
FooterDescription foot = new FooterDescription();
foot.Caption = "合计:";
tbl.Footers.Descriptions.Add(foot);
// 添加合计行中数量的合计
AggregateDefinition def = new AggregateDefinition();
def.PropertyName = "数量";
def.Aggregate = AggregateEnum.Sum;
foot.Aggregates.Add(def);
// 添加合计行中金额的合计
def = new AggregateDefinition();
def.PropertyName = "金额";
def.Aggregate = AggregateEnum.Sum;
foot.Aggregates.Add(def);

// 我们可以通过Form属性访问到当前表格所属的窗体对象,再进而获得其他表的访问
foreach (BaseGrid tb in tbl.Form.Grids)
{
    Proj.MsgDebug.Add(tb.Name);
}   

// 我们可以用代码打开或关闭当前窗体的全局表事件。如果打开,当前表就会监听、执行全局表事件中的代码
tbl.GlobalHandler.CellButtonClick = true;
tbl.GlobalHandler.AfterLoaded = true;

// 可以通过GridMenu获得表所关联的菜单
C1Command cmd = tbl.GridMenu.CommandHolder.Commands["cmdShow"];
cmd.PerformClick();