每个人我都是新人。我有一个问题我正在构建一个Vb .Net聊天程序,我需要实现一个聊天列表视图,就像Skype chatlistview或Facebook chatlistview我不能使用.net默认列表视图,因为所有行都应该具有相同的高度因此它无法显示我在网络上发现的不同尺寸信息XPTable很酷但它不会显示最后一行无法滚动的所有行如果有人可以帮我找一个显示聊天消息的控件,甚至帮助我使用XPTable,我会感激我被困了3个月。 请原谅我可怜的英语等待回复
答案 0 :(得分:0)
@nitish这是我填写XPTable的代码
Private Sub fillChat(ByVal messageList As List(Of ChatExtraData))
If messageList.Count > 0 Then
table.BeginUpdate()
table.EnableWordWrap = True
table.SelectionStyle = SelectionStyle.Grid
table.GridLines = GridLines.Rows
Dim col1 As TextColumn = New TextColumn("", 200)
table.ColumnModel = New ColumnModel(New Column() {col1})
Dim model As TableModel = New TableModel()
Dim cpt As Integer = 0
For Each msg In messageList
Try
Dim precedentMsg As Row = model.Rows.Item(cpt - 1)
Dim messagePrecedent As ChatExtraData = precedentMsg.Tag
If (msg.senderId <> messagePrecedent.senderId) Then
Dim header As Row = addHead(msg.HeaderText, msg)
model.Rows.Add(header)
End If
Catch ex As Exception
Dim header As Row = addHead(msg.HeaderText, msg)
model.Rows.Add(header)
End Try
Dim ligne As Row = addMsg(msg.MinorText, msg)
model.Rows.Add(ligne)
cpt = cpt + 1
Next
messageList.Clear()
table.TableModel = model
table.EndUpdate()
End If
End Sub
Function addMsg(ByVal txt As String, ByVal extra As ChatExtraData) As Row
Dim row As Row
Dim cell As Cell
row = New Row()
Dim texte As String = HttpUtility.UrlDecode(txt)
cell = New Cell(texte)
cell.WordWrap = True
row.Cells.Add(cell)
'row.Font = New Font("Segoe UI Light", 12, FontStyle.Regular)
'row.ForeColor = Color.Gray
row.Tag = extra
Return row
End Function
'function for adding sender name and datetime
Function addHead(ByVal txt As String, ByVal extra As ChatExtraData) As Row
Dim row As Row
Dim cell As Cell
row = New Row()
cell = New Cell(txt)
cell.WordWrap = False
row.Cells.Add(cell)
row.Font = New Font("Segoe UI Light", 8, FontStyle.Bold)
row.ForeColor = Color.FromArgb(255, 20, 133, 227)
row.Tag = extra
Return row
End Function
这是有效的,但正如我所说,有些项目不可见,我无法滚动到这里,附上截图 some items aren't shown and I can't scroll anymore
很抱歉回答我自己的问题,我还没有找到另一种发布代码和图片的方法。 等待帮助