RSS Forums RSS
Please support our C advertiser: Programming Forums
Views: 2221 | Replies: 1
Reply
Join Date: May 2005
Posts: 21
Reputation: hemanth.balaji is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
hemanth.balaji hemanth.balaji is offline Offline
Newbie Poster

ListView Doubt ?

  #1  
May 22nd, 2005
How do you CENTER & BOLD the labels of the columns (i.e headings) using ListView. I did not understand the below found in MSDN..

/*
If a column is added to a list-view control with index 0 (the leftmost column) and with
LVCFMT_RIGHT or LVCFMT_CENTER specified, the text is not right-aligned or centered. The text in the index 0 column is left-aligned. Therefore if you keep inserting columns with index 0, the text in all columns are left-aligned. If you want the first column to be
right-aligned or centered you can make a dummy column, then insert one or more columns with index 1 or higher and specify the alignment you require. Finally delete the dummy column.
*/

Also I want the last column to occupy the remaining width of the window even if resizing of the Main Window takes place.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2005
Location: Tokyo, Japan
Posts: 1,481
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Rep Power: 8
Solved Threads: 102
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: ListView Doubt ?

  #2  
Jun 14th, 2005
This reply is a bit late. But I hope maybe somebody else will learn something from it.

The list view control has a default font and this is the same for the column and the items. So to change this I think that you should change the font of the list view to the required font with the attributes set as you want, and then enter the columns. After entering the column you can deselect the font and the default font is back in action. I have not tried it. But as it works for other controls like buttons and such it should work here too.

The meaning of the MSDN quote is that you cant change the allignment of the column with index 0 using LVCFMT_RIGHT or LVCFMT_CENTER. To change its allignment you make the list view control think that its index is not zero. To do this what you first insert a first dummy column. Then you insert your actual first column with index 1. You can change the allignment of the column with index 1. After doing that, you delete your dummy column with index 0. Then the column that you wanted as the first column ( but which you inserted after the dummy column ) will become the first one automatically. Hope you get the idea.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:19 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC