English 中文(简体)
在列表视图中列出含有空白文字的列表项目
原标题:ListItems in ListView with empty text

我有一个老的VB6程序, 它在一段时间内没有改变,但现在有一种新的行为。 我认为一个共同的组件是从下面升级的。 下面是细节 。

我有一个标准 ListView 控制在 SmallIcon 模式下。 代码片断 :

 setup the listview
With lvwMap
   .Appearance = ccFlat
   .BackColor = vbBlack
   .BorderStyle = ccNone
   .Font.Name = "Arial" 
   .Font.Bold = True
   .Font.Size = 9
   .ForeColor = vbYellow
   .LabelEdit = lvwManual
   .LabelWrap = True
   .OLEDropMode = ccOLEDropManual
   .PictureAlignment = lvwTopLeft
   .TextBackground = lvwOpaque
   .View = lvwSmallIcon
End With

添加的大多数列表项目都同时有一个小项和标题( 文本) 。 文本背景设置为不透明, 意思是文本以附加的彩色矩形显示 。

虽然有些项目可能没有提供字幕, 或者用户可以更改标题, 以至于没有字幕。 这曾经是好的, 只有 SmallIcon 显示 。 但是现在任何 ListItem 中含有空文本属性的列表项目都提供了相当宽的附加矩形, 里面没有文字( 比如一个用户也许在一堆空格中键入了密钥 ) 。

添加列表项目的代码是直向前进的 :

 Set oLI = lvwMap.ListItems.Add(lvwMap.ListItems.Count + 1, Key:=sKey)
 oLI.SmallIcon = sIcon
 oLI.Text = sCaption

我在这里拦住了调试器,在紧靠的窗口里抽打以下内容:

oLI.Text= "AAAAAAA"
?oLI.Width
 100.0063 

oLI.Text= "AAAAAA"
?oLI.Width
 91.99371 

oLI.Text= "AAAAA"
?oLI.Width
 84.0189 

oLI.Text= "AAAA"
?oLI.Width
 76.0063 

oLI.Text= "AA"
?oLI.Width
 60.0189 

oLI.Text= "A"
?oLI.Width
 52.0063 

oLI.Text= ""
?oLI.Width
 96.00001 

您可以看到 ListTroject 。 错误正确重新计算, 直到文本变成空, 然后跳到96 像素 。

有谁知道该行为有什么补偿方法吗? 一些窗口信息, 我可以用它来配置默认的空 wdith 。 任何关于更改 ListView 行为的信息也会有所帮助 。

最佳回答
问题回答

暂无回答




相关问题
Prevent windows from queuing shellexecute requests

Win.ShellExecute 0, "open", "C:dirprogram.exe", "arguments", vbNullString, SW_SHOWNORMAL Win.ShellExecute 0, "open", "http://www.google.com", vbNullString, vbNullString, SW_SHOWNORMAL I want google....

Why is My Loop Only Deleting One File?

Using VB6 In a folder, i have n number of files, i want to delete a 0 kb files code Dim filename5 As String filename5 = Dir$(txtsourcedatabasefile & "*_*", vbDirectory) MsgBox filename5 Do ...

How to check the filesize?

Using VB6 I have the text file with different sizes, so i want to delete the file where filesize = 0 kb. How to make a vb6 code for deleting the 0 kb files. Need vb6 code Help

File Rename problem?

I m using VB6 and I have a folder where I have n number of files. I want to change the file extension to .txt. I used the code below to change the extension of all .fin files to .txt. Dim filename1 ...

Error 20728-F while in using Crystal Reports in VB6

I m using Crystal Reports in my VB6 project, but I m facing error while loading the report in crystalreport1.action=1; Please give me some solution for this problem. It is showing the error as Error ...

DllRegisterServer entry point was not found

When running my vb6 application I am getting error like, runtime error 53 : file not found: rscomclNoMsg.dll then i tried to register that dll from cmd line using regsvr32. Then I am getting ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签