ListView控件自动调整大小以显示所有项目 [英] ListView auto size to show all items

查看:115
本文介绍了ListView控件自动调整大小以显示所有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建的是,将调整自身以显示所有项目的列表视图。通常我会用自动调整大小,但是这不会在这里工作。任何其他选项我怎样才能使ListView的扩大和缩小以适合所有?

What I want to create is a list view that will resize itself in order to show all items. Normally I would use AutoSize, but this won't work here. Any other options how can I make ListView expand and shrink to fit all?

推荐答案

您必须手动计算你想要的高度,将其设置为项目添加/删除。

You will have to manually calculate your desired height and set it as items are added/removed.

检测项目增加或移除不直接支持 - 所以你要么需要从WndProc中创建自己的添加/删除项目要求的客户打电话,或者办理LVN_INSERTIEM类型的消息

Detecting item addition or removal isn't directly supported - so you'll either need to create your own Add/Remove Item calls for clients to call, or handle LVN_INSERTIEM type messages from WndProc.

自动调整大小的控制通常是棘手的使用 - 因为你必须追踪最小/最大尺寸,允许在业主的房间,通常添加到一个尴尬的可用性点供用户使用。只有这样做,如果典型的解决方案(即滚动条)真的不能为你的工作需要。

Auto-sizing controls are usually trickier to use - as you have to track Min/Max sizes, allow room on the owner, and usually add to an awkward usability point for users. Only do something like this if typical solutions (i.e. scroll bars) truly can't work for your need.

这篇关于ListView控件自动调整大小以显示所有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆