gpt4 book ai didi

windows - 当后续列有图像时,列表控件将图像的空间添加到列 0

转载 作者:可可西里 更新时间:2023-11-01 10:50:58 25 4
gpt4 key购买 nike

我遇到了 Windows 列表控件的问题(我专门使用 MFC,但它似乎适用于 Windows 公共(public)控件库中的所有列表控件)。

在我的特定情况下,我想创建一个包含两列或更多列的列表控件。第一列 (0) 是纯文本的,用于允许用户通过在该行中键入文本来跳转到条目。第二列(或第三列、第四列或其他列)有一个图像(或图像和文本;无论哪种方式)。

这一切都很好,可以很容易地完成,没有问题,但是最后的列表控件最终在第 0 列的文本左侧有一个空格(它可能在 RTL 系统的右侧) .这个垫片似乎是为图像保留的,我想不出一种方法来防止它。 (排列列的特定顺序并没有改变任何东西。)

环顾四周,我发现其他一些人也在提示同样的事情,特别是 this thread这导致 this thread .建议的解决方案不起作用,因为如前所述,简单地缩小零列的宽度只会切断文本而不是图像间隔(另外,您必须防止和/或处理用户尝试对列宽进行的任何更改制作)。

除了从头开始编写列表控件或在 CodeProject/CodeGuru 等上使用一种过于花哨的网格控件之外,是否有人对如何修复此错误有任何想法?

非常感谢。

最佳答案

您是否尝试更改 LVITEM 结构的 iIndent 成员? MSDN 是这样说的:

iIndent
Version 4.70. Number of image widths to indent the item. A single indentation equals the width of an item image. Therefore, the value 1 indents the item by the width of one image, the value 2 indents by two images, and so on. Note that this field is supported only for items. Attempting to set subitem indentation will cause the calling function to fail.

关于windows - 当后续列有图像时,列表控件将图像的空间添加到列 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3560350/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com