在列表视图文本对齐列:第一列不能居中 [英] Text Align column in Listview: first column cannot be centered

查看:219
本文介绍了在列表视图文本对齐列:第一列不能居中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在详细模式3列的列表视图。我想设置文本对齐的标题为中心。这适用于最后两列,但不为先。如果我想将其更改为中心,然后单击中心,该领域一直被设置为左。我可以使用属性改变这个还是需要设定此?

I have a Listview in detail mode with 3 columns. I want to set the text align for the headers to "center". This works for the last two columns but not for the first. If I want to change it to "center" and click on "center", the field keeps being set to "left". Can I change this using the properties or do I need to program this?

感谢。

推荐答案

据<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.columnheader.textalign%28v=vs.100%29.aspx\">the文档:

由于在底层控制的限制,这个属性在ListView控件,它总是左对齐的第一列没有影响。要解决此限制在.NET Framework 2.0版,您可以处理<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.drawcolumnheader%28v=vs.100%29.aspx\">ListView.DrawColumnHeader事件和油漆列标题自己。

Due to a limitation in the underlying control, this property has no effect on the first column in the ListView control, which is always aligned to the left. To work around this limitation in .NET Framework version 2.0, you can handle the ListView.DrawColumnHeader event and paint the column header yourself.

另一种解决方法是在所有不使用的第一列,并设置其<一个隐藏href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.columnheader.width%28v=vs.100%29\">width到零。

Another alternative workaround is to not use the first column at all and hide it by setting its width to zero.

这篇关于在列表视图文本对齐列:第一列不能居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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