473,500 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListView TextAlign broken for 1st column?

Hello,

I'm using the VS 2005 Express Edition for C#. In the GUI designer, when I
try to set the text alignment to anything except Left for the first column of
a ListView, it jumps back to the left anyway, even thought choices of Center
and Right are shown in the drop-down. I've even tried modifying the code
itself after the fact but it merely ignores it. I remember this was a
problem in the original version of the product but I thought it would have
been fixed by now. Are there any workarounds, or am I simply doing something
wrong? Previously I just created a dummy 1st column with 0 width, but that's
a real kluge.

Thanks,
Ray
Apr 24 '07 #1
2 5896
Hi,

It is by design.

<msdn
url="http://msdn2.microsoft.com/en-us/library/system.windows.forms.columnheader.textalign.aspx">
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 Microsoft .NET Framework version 2.0,
you can handle the ListView.DrawColumnHeader event and paint the column
header yourself.
</msdn>

"Ray Mitchell" wrote:
Hello,

I'm using the VS 2005 Express Edition for C#. In the GUI designer, when I
try to set the text alignment to anything except Left for the first column of
a ListView, it jumps back to the left anyway, even thought choices of Center
and Right are shown in the drop-down. I've even tried modifying the code
itself after the fact but it merely ignores it. I remember this was a
problem in the original version of the product but I thought it would have
been fixed by now. Are there any workarounds, or am I simply doing something
wrong? Previously I just created a dummy 1st column with 0 width, but that's
a real kluge.

Thanks,
Ray
Apr 25 '07 #2
Siva,

Thanks for the response. I figured as much - call a "bug" a "feature" and
charge more (although the Express edition is free!). Hopefully this
"feature" will be deprecated in a later version. It seems that they should
remove the "Center" and "Right" choices from the TextAlign menu for that
colum if they're not going to support them, however. I'm just learning this
stuff so I can't really complain, though, since so many things work so nicely.

Ray

"Siva M" wrote:
Hi,

It is by design.

<msdn
url="http://msdn2.microsoft.com/en-us/library/system.windows.forms.columnheader.textalign.aspx">
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 Microsoft .NET Framework version 2.0,
you can handle the ListView.DrawColumnHeader event and paint the column
header yourself.
</msdn>

"Ray Mitchell" wrote:
Hello,

I'm using the VS 2005 Express Edition for C#. In the GUI designer, when I
try to set the text alignment to anything except Left for the first column of
a ListView, it jumps back to the left anyway, even thought choices of Center
and Right are shown in the drop-down. I've even tried modifying the code
itself after the fact but it merely ignores it. I remember this was a
problem in the original version of the product but I thought it would have
been fixed by now. Are there any workarounds, or am I simply doing something
wrong? Previously I just created a dummy 1st column with 0 width, but that's
a real kluge.

Thanks,
Ray
Apr 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1728
by: rmorvay | last post by:
I have successfully integrated sorting in the listview control with the following code: Private Sub ListView_ColumnClick(ByVal sender As Object, ByVal e As...
6
4613
by: VM | last post by:
How can I fill up a listview with text file contents? My listview has two columns and the first column fills up with a while loop: while (myString != null) { myString = sr.Readline();...
0
1135
by: Ray Mitchell | last post by:
I'm using VS 2002 w/available component updates. I am creating a listview with multiple columns. When I use the "ColumnHeader Collection Editor" to specify that the header titles are to be...
0
2181
by: John T | last post by:
I have the code I need to show a sort icon in the column header of a ListView control. The issue I have is that the image is always on the right side of the column header text. This isn't...
0
2310
by: willow1480 | last post by:
I am developing a small little Service Control Application. I am using a listview control with checkboxes and getting the list of services I want to control from a text file. When you check a...
2
4939
by: Li Pang | last post by:
Hi, I used some code to add an arrow icon onto a listview header column for the sorting purpose. However, after the icon added, the TextAlign of the column becomes "left", if I enforced...
12
3083
by: Dennis | last post by:
I have a form which has a ListView control named ListView1 added at design time. When I add items using the following code, they don't appear in the list view. However, if I create a ListView...
2
4444
by: Terry Olsen | last post by:
Does anyone have an example of how I could print a ListView control? It'd sure be easier to do this than to try to format the output in DrawStrings... Thanks.
1
1163
by: Johnny Jörgensen | last post by:
The listview control's column items contain a property called TextAlign which apparently can be either Left, Right or Center. But if you choose anything but Left (default) the property value is...
0
7136
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7018
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7397
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4923
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3110
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.