使用布局网格在GridView中显示消息

时间:2017-03-24 22:31:08

标签: .net vb.net

我正在尝试在Gridview中显示短信。消息显示正确,但不是一行显示,而是以不同的行显示

预期输出
我的短信

当前输出

文字
消息

代码段:

Dim msgRow As New LayoutGrid.Row
msgRow = New LayoutGrid.Row(1)
msgRow.Cells(0).Text = LINE_BREAK_TOKEN
gridOut.Rows.Add(msgRow)

msgRow = New LayoutGrid.Row(1)
msgRow.Cells(0).Text = "My Text Message"
gridOut.Rows.Add(msgRow) 

1 个答案:

答案 0 :(得分:0)

您可以尝试使用Cell的ColumnSpan属性,执行类似 -

的操作
Dim msgRow As New LayoutGrid.Row
msgRow = New LayoutGrid.Row(1)
msgRow.Cells(0).Text = LINE_BREAK_TOKEN
gridOut.Rows.Add(msgRow)

msgRow = New LayoutGrid.Row(1)
msgRow.Cells(0).ColumnSpan = 6
msgRow.Cells(0).Text = "My Text Message"
gridOut.Rows.Add(msgRow) 

假设表/网格中有6列