? Images in Subitems but Not Column 0 of CListCtrl

Hi,

I've put an image in column 1 of a list control, but using SetImageList to
activate images also puts one in column 0.

I've tried setting the item's image to I_IMAGENONE aka -2, (which is only
available with _WIN32_IE >= 0x0501), but while that prevents the icon from
showing, it leaves a blank space the width of the icon next to the label-which
is particularly annoying since I've used SetColumnOrderArray to put column 1
with the image to the left of column 0.

Is there a way to disable images for column 0?


Thanks.

-- 
Alec S.
news/alec->synetech/cjb/net


0
Alec
9/23/2008 6:56:09 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
315 Views

Similar Articles

[PageSpeed] 18

On Tue, 23 Sep 2008 02:56:09 -0400, "Alec S." <@> wrote:

>Hi,
>
>I've put an image in column 1 of a list control, but using SetImageList to
>activate images also puts one in column 0.
>
>I've tried setting the item's image to I_IMAGENONE aka -2, (which is only
>available with _WIN32_IE >= 0x0501), but while that prevents the icon from
>showing, it leaves a blank space the width of the icon next to the label-which
>is particularly annoying since I've used SetColumnOrderArray to put column 1
>with the image to the left of column 0.
>
>Is there a way to disable images for column 0?

I don't know, but it is possible to use Custom Draw to fix various glitches
in the default rendering when you reorder columns. As I recall, I did this
by using SaveDC at the start of Custom Draw, modifying the clipping region
to prevent certain things from being drawn, and then at the end of Custom
Draw, I used RestoreDC and drew what I wanted in the areas I had excluded
from clipping. This approach worked in Win95 and continues to work in
Vista, but if I were dealing with this for the first time now, I'd consider
dumping listview and use a real grid control.

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
9/23/2008 2:24:43 PM
To add to Doug's post, you may want to try a very good listview control:

http://www.codeproject.com/KB/wtl/WTL_ListCtrl.aspx

It is written using WTL, but I believe you can integrate it well in MFC.

I've not tested that, but I think that you can show or hide images in each 
of its columns.

Giovanni


"Alec S." <@> ha scritto nel messaggio 
news:%23EOUGnUHJHA.3932@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I've put an image in column 1 of a list control, but using SetImageList to
> activate images also puts one in column 0.
>
> I've tried setting the item's image to I_IMAGENONE aka -2, (which is only
> available with _WIN32_IE >= 0x0501), but while that prevents the icon from
> showing, it leaves a blank space the width of the icon next to the 
> label-which
> is particularly annoying since I've used SetColumnOrderArray to put column 
> 1
> with the image to the left of column 0.
>
> Is there a way to disable images for column 0?
>
>
> Thanks.
>
> -- 
> Alec S.
> news/alec->synetech/cjb/net
>
> 

0
9/23/2008 3:04:10 PM
Thanks guys. I was afraid that I would have to resort to CustomDraw and/or an
enhanced control because there�s no direct way.

I�ve already got a folder full of list control enhancements from CodeProject
that I have been taking ideas and stuff from over the past several years. One
thing that has been bugging me is: what exactly is the difference between a list
control and a �grid control�? I�ve seen grid controls mentioned a lot on
CodeProject and as far as I can tell, they�re just list controls that people
enhanced.

-- 
Alec S.
news/alec->synetech/cjb/net



"Giovanni Dicanio" <giovanniDOTdicanio@REMOVEMEgmail.com> wrote in message
news:%23jNts2YHJHA.3548@TK2MSFTNGP05.phx.gbl...
> To add to Doug's post, you may want to try a very good listview control:
>
> http://www.codeproject.com/KB/wtl/WTL_ListCtrl.aspx
>
> It is written using WTL, but I believe you can integrate it well in MFC.
>
> I've not tested that, but I think that you can show or hide images in each
> of its columns.


"Doug Harrison [MVP]" <dsh@mvps.org> wrote in message
> I don't know, but it is possible to use Custom Draw to fix various glitches
> in the default rendering when you reorder columns. As I recall, I did this
> by using SaveDC at the start of Custom Draw, modifying the clipping region
> to prevent certain things from being drawn, and then at the end of Custom
> Draw, I used RestoreDC and drew what I wanted in the areas I had excluded
> from clipping. This approach worked in Win95 and continues to work in
> Vista, but if I were dealing with this for the first time now, I'd consider
> dumping listview and use a real grid control.


> "Alec S." <@> ha scritto nel messaggio
> > I've put an image in column 1 of a list control, but using SetImageList to
> > activate images also puts one in column 0.
> > �
> > Is there a way to disable images for column 0?


0
Alec
9/23/2008 3:14:37 PM
"Alec S." <@> ha scritto nel messaggio 
news:uLhUU$YHJHA.4600@TK2MSFTNGP06.phx.gbl...

> One
> thing that has been bugging me is: what exactly is the difference between 
> a list
> control and a "grid control"? I've seen grid controls mentioned a lot on
> CodeProject and as far as I can tell, they're just list controls that 
> people
> enhanced.

Frankly speaking, it seems to me that the boundary is not very well defined, 
as you also stated.

But, my idea is that a grid control reminds me of an Excel sheet:

http://www.codeproject.com/KB/miscctrl/gridctrl.aspx

Instead, a list control (like the one I suggested above) seems different 
from Excel sheets:

http://www.codeproject.com/KB/wtl/WTL_ListCtrl.aspx

BTW: I agree with you that choosing to implement custom draw may require 
some non-trivial programming energy, and this is one reason why reusing 
controls made by others is a good way to optimize your time, instead of 
"reinventing the wheel".

Giovanni

0
9/23/2008 4:08:00 PM
"Giovanni Dicanio" <giovanniDOTdicanio@REMOVEMEgmail.com> wrote in message
news:OvQzXaZHJHA.3504@TK2MSFTNGP02.phx.gbl...
>
> "Alec S." <@> ha scritto nel messaggio
> > One thing that has been bugging me is: what exactly is the difference
> > between a list control and a "grid control"?
>
> But, my idea is that a grid control reminds me of an Excel sheet.

Yes, that makes sense. I guess a grid is more like a spreadsheet and a list is
more like, well, a list; something between a grid and a tree. It�s a wonder that
there is no grid in the common controls.


> BTW: I agree with you that choosing to implement custom draw may require
> some non-trivial programming energy, and this is one reason why reusing
> controls made by others is a good way to optimize your time, instead of
> "reinventing the wheel".

Actually, I have been developing my own enhanced list control that implements
all kinds of fun ideas of my own and others� for a while now. I do however try
to use a nice, simple one when possible. I was just hoping that this would be
possible by default since the regular one already allows sub-item images, and
such.


Thanks.

-- 
Alec S.
alec->synetech/cjb/net


0
Alec
9/23/2008 4:51:41 PM
"Alec S." <@> ha scritto nel messaggio 
news:ux5UX6ZHJHA.4296@TK2MSFTNGP02.phx.gbl...

> It's a wonder that
> there is no grid in the common controls.

Yes, I do think that common controls are stuck in the 1998 UI style 
interface.

I would like some improvements in Win32 common controls, including some 
Office 2007 UI style ribbon.

Current status of things forces us to use MFC components (both commercial 
and open source), built on the poor common controls.

Giovanni
 

0
9/23/2008 5:13:22 PM
Reply:

Similar Artilces:

document imager
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel <i>have microsoft office for mac 2008, student edition, i am trying to scan a document so that i can edit it, older versions of word had something called OCR that would enable you to do this, i cannot find it on my version, how do i do it?</i> What you're referring to is Twain support which requires VBA. Since there's no VBA in Office 2008 there's no Twain support. The only real difference is that you cannot scan directly into your document. You'll need to use the software that c...

how to summerise values from specific columns
Hi, I have tried to find the right formulah, but failed. I have three column Amount A Amount B Amount C 30 10 20 34 and a fourth column where I have to fill in % that applies to all values A-C in the row. 12% 45% How to make a formula in a cell that summerise all amount A's * the respective % For example: 30 * 12% + 10 * 45% = Also for two other cells for B and C Bart Vista/excel 2007 try sumproduct() =SUMPRODUCT(A2:A3*D2:D3) HTH Regards Sebation "AA Arens" <bartvandongen@gmail.com> ??????:1189666230....

How to finish editing item of CListCtrl?
Using CListCtrl::EditLabel function, edit window is created. It disappears when "Enter" or "ESC" key is pressed. How can I finish it by code? Are there any method or function to finish it? "Joon-ho Ryu" <junoryu@hotmail.com> wrote in message news:%23qBXb1IbDHA.1384@TK2MSFTNGP10.phx.gbl... > Using CListCtrl::EditLabel function, edit window is created. > It disappears when "Enter" or "ESC" key is pressed. > How can I finish it by code? > Are there any method or function to finish it? FWIW, the documentation says "To can...

Document Imaging
I have two issues related to this. First, Document Imaging is not showing in 2010 beta. I have done a complete install, and told the install to run all from my computer. I have Windows 7 64 and I cannot find Document Imaging. A related problem is on my machine also running 7 64 and I have Office 2007, Document Imaging appears but the Document Imaging Printer doesn't appear. Is this a 64 bit issue? If so, why are they making a big fuss that 2010 will be available in 64 bit. Why have the 64 bit if you have reduced functionality? ...

Stacked and Column Chart
Hello, Using the data below I would like to create a single chart with a Column Stacked Chart for Revenues and a Column for Expenditures. Can u help me? Revenues FY03 FY04 FY05 Private/Local Govt. $1,500,928.00 $2,598,394.00 $7,030,199.00 State $821,388.00 $3,467,473.00 $20,413,581.00 Ship Funding $15,806,578.00 $19,233,564.00 $23,902,364.00 Flowthru (Federal) $10,036,098.00 $10,595,406.00 $13,369,788.00 Federal Government $68,276,270.00 $1,604,082.00 $63,199,215.00 Expenditures $132,1452,481.00 $128...

IMAGE
Hello I have set up some stationery but my nice crisp clean company logo looks poor qualiy when I do a test and receive it back in the email. It looks very good in outlook when sending but not so on receiving - does Outlook compress images to a certain quality - can I do something to ensure good quality image? thanks Jeff ...

Get hWnd for scroll bars (CListCtrl)
Hi, I seem to have come across a minor difficulty with finding the window handle of scroll bars for the CListCtrl, when it creates them automatically, as the docs say, GetScrollBarCtrl is rendered useless in this situation. Can anyone think of a clever way of getting these scroll bars hWnds' so I can use the FlatSB API's on them? -- - Mark Randall http://zetech.swehli.com "Those people that think they know everything are a great annoyance to those of us who do" Isaac Asimov Mark, What makes you think that the scroll bar is a child of the listctrl. If you use...

Combining data from 2 Columns into 1
I have a spread sheet that needs to be imported into a pre-set form. In the spread sheet the Area Code and Phone Number are separate columns, but in the form they are a single column. How do I get both the area code and phone number in just one column? This spread sheet has multiple phone numbers for each record and hundreds of records, so it is impractical to do it all by hand. Thanks, J. How about this: Assume area code in column a, phone number in colum b and you wan parens around area code (i.e. (403) 723-8833). 1. Insert a column to the right of column B (new column C). 2. Enter/p...

Add image over other images
Hey guys, Basically I have two pictures: A map (quite a large picture) A symbol (quite small and to be placed over the map at specified points) Anyone have any idea how I could go about this? Thanks in advance for any help! Am 05.05.2010 05:51, schrieb bourkeyo: > Basically I have two pictures: > > A map (quite a large picture) > A symbol (quite small and to be placed over the map at specified points) > > Anyone have any idea how I could go about this? Take a look at the following classes/methods: 'Bitmap': Constructor and 'Save' m...

One column into three
We have a table with about 40 columns and 120 Rows and we need to split each column into 3 columns only for certain rows - I'm guessing that we can't spilt a column only for certain rows as this would mess-up the entire column/row naming convention - so is there a way to automate the spliting of a column into 3 rows (i.e column A becomes A,B & C) and then merging each trio of cells (i.e. A1, B1, & C1) into one cell in the row and retaining the data that was in A1 and moving the data that was in B1 into D1 - for all 120 rows and then repeating the process for each colum...

Capturing a screen image
I frequently write material to use in my classrooms and labs where my students use Excel XP. I would like to be able to do an old-fashioned PrintScreen, but this doesn't work any more. How can I print the entire screen image in my document? Thanks, Evelyn Depending on what you want, hit printscreen button or the printscreen button in combination with Ctrl or Shift. then go to your application, such as word or excel and do edit => Paste. This should give a bitmap picture of the part of the screen you captured. Regards, Tom Ogilvy Evelyn <elplummer@prodigy.net> wrote i...

TreeCtrl and Images
I want to display normal and state images in my tree control from image list. Generally, treectrl displays checkbox first in a row and it then displays the normal image. Is it possible to reverse this order i.e. to show normal image before the state image ? On Jan 6, 10:44=A0am, shubhishubhi <shubhishu...@discussions.microsoft.com> wrote: > I want to display normal and state images in my tree control from image l= ist. > Generally, treectrl displays checkbox first in a row and it then displays= the > normal image. Is it possible to reverse this order i.e. to show ...

Quick way to expand all columns to show all data?
I often open newly-created spreadsheets where the data in columns is wider and taller than it displays initially. I then drag select all the column headers and double-click between the first and second column header. That expands the width of all column displays to show all the data, widthwise. I then drag select all the row headers and double-click between the first and second row header. That expands the height to show all data. Phew. Is there an easier way to do this? David, Click the box above and to the left of cell A1, and that will select all the columns and rows - ...

How to set include files in wince subproject 6.0
Hi I am creating application in wince 6.0, while build the source code I received build error. C:\WINCE600\public\common\sdk\inc\fsdmgr.h(35) : fatal error C1083: Cannot open include file: 'diskio.h': No such file or directory Since i include the following path C:\WINCE600\PUBLIC\COMMON\OAK\INC to Tools->option->ProjectSolution->VC++Directory, Still i got the same error. Pls any one advise me how to add the include file in the root. Regards Venkat Set your include path in the following dialog Project-->Properties-->Configuration Properties-->...

Leads entity in v3.0
Hey: Would anyone happen to know if the v3.0 leads entity would support many to many relationships? ie, would a user be able to associate a lead to several Contacts? Or better yet, will the Leads entity finally have a Contacts tab? It's silly having to import business card data such that you have 15 Leads because you have 15 Contacts. Further, you have to convert all Leads into 15 contacts, one at a time, and then you need to associate them to the master Account record... --Dodd think its the same in V3. -- John O'Donnell Microsoft CRM MVP http://www.mscrmfaq.us "Dodd...

mirror image
I put together a floor plan for a home. I need to mirror or flip the floor plan 180 degrees but I can't seem to be able to do this. I selected the whole floor plan, clicked on shapes, rotate or flip, flip vertical but that only flips each shape. It keeps each shape stationary but flips it 180 degrees. That is not what I need to do. I want to be able to flip the whole image. For example. The garage, bedrooms and bathroom is on the south side. I want it to be on the north side instead. Can you help me? I just tried this. Select everything, group, then flip it. Appeared to work (at l...

CRM 4.0 -Unable to detect duplicates using Same first/Last charact
Hi, I am trying to create duplicate detection rule for Accounts. I have created a rule,Published to check the account name for exact match, same first 4 characters and same last 4 characters. It works fine for exact matches, If I give same first 4 or last 4 characters it does not detect duplicates. Am I doing something Wrong, why does the same first 4 /last 4characters doesnt work? (If I check for accounts whose total number of character is 4 or less than 4 it works (Exact match Criteria)...) Please let me know what should I do to resolve this. -- Thanks & Regards, Jaishree ...

How do I match words in Column A and C in Excel 2003
I want to do a comparison on my excel sheet. I have 4 columns and I need to compare the single words in column A to match the single words in column C and the single word in Column D on the respective row. Is there a formula to do this? eg it starts like 1 Dog Tail Bird Tweetypie 2 Cat Tail Dog Rover 3 Bird Feather Cat Tom but ends up looking like 1 Dog Tail Dog Rover 2 Cat Tail Cat Tom 3 Bird Feather Bird Tweetypie I have looked at vlookups to be honest dont fully understand wh...

Integration Manager RM Cash Receipts after 9.0 upgrade
Our cash receipts integration is running at 15% of the speed when we were on version 7.5 (we upgraded to 9.0). Due to our volume, we can no longer import all cash receipts in a 20 day time frame, so we really need help! No changes to our header or distribution file formats. I have re-created the integration from scratch, but that did not help. All ideas are greatly appreciated! Thank you, -- Greg DeBacker Do you have a SQL DBA? You should have your DBA (or else your VAR) run the standard optimizations and integrity checks against your company database, and also Update Statisti...

If query/subform is empty set calculation value to 0
Using a subform, I am summing a field across multiple records, then adding multiple subform totals to provide a single total on the main form. However, in some cases, some subforms may not return any records (Due to no records existing for the item), and in this case, i get a #Error response, and the rest of the calculations on the main form fails. How do I check to see of the table is empty, and if so return a zero value, otherwise, return the sum value being sought? Tony Consider using queries to fill the forms/subforms. Then use the Nz() function in your query to conver...

image of folder as embedded object
how do i show an image of a folder and corresponding title using image control? for example, would have picture of folder followed by the words full fee schedule. what to copy that image and embed in form. building online documentation for a non technical user tried inserting picture thru image control thanks for your help ...

Converting Leads to Opportunities in CRM 3.0 (changes since CRM 1.2?)
We are in the process of upgrading from CRM 1.2 to CRM 3.0. In 1.2 we were able to convert Leads to only Opportunities. However, in 3.0 it appears that you must also convert the Lead to an Account or Contact as well (i.e. after clicking on the Convert Lead button, if you select only the Opportunity checkbox, the OK button is disabled, however, if you also select either Account or Contact, the OK button becomes enabled). Is this a change in functionality from CRM 1.2 or is there a setting that impacts this behavior? Thanks in advance. ...

Changing a static image
I have put these lines in the OnInitDlg of a dialog CBitmap bitmap1; bitmap1.LoadBitmap(ID_BMP); ((CStatic *)GetDlgItem(ImageSecurity))->SetBitmap(bitmap1); with ID_BMP : a varaible memeber of the dlg ImageSecurity the label of the image The pb is that the image doesn't appear when the dlg is called, but the border of the image fit whell the id of the bitmap. thx a lot for any answer mathieu Your ImageSecurity static control should have SS_BITMAP style. Open the resource ( .rc ) file in a text editor and add the SS_BITMAP style. -- Cheers Check Abdoul [ VC++ MVP ] -------...

Highlighting selected cells/rows/columns
Try adjusting the contrast on your computer monitor. Mine are little buttons on the lower right just below the screen. My contrast was turned up on high, when it was lowered, I could see the gray shading on selected rows/columns/cells. ...

Images in Excel 2000
I'd like to import an 8 1/2" x 11" jpg image into an exel 2000 spreadsheet and be able to enter data into the cells and still see the image underneath. Is this possible and how do I do it. This would be impossible or nearly so using Microsoft Excel. You could do it with Word. http://www.officearticles.com/word/typing_on_top_of_a_scanned_form_in_microsoft_word.htm However, I think it's crazy to try it under any circumstances. ******************* ~Anne Troy www.OfficeArticles.com www.MyExpertsOnline.com "cjones" <cjones@discussions.microsoft.com> wrote in ...