CListCtrl in report mode and column header

Hi,

I would like to have a CListCtrl in report mode with columnheader but
I would like the column header to be transparent and without displaying 
separators.
How can I do that ?
0
richom.v (84)
2/15/2007 1:15:25 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
834 Views

Similar Articles

[PageSpeed] 7

mosfet a �crit :
> Hi,
> 
> I would like to have a CListCtrl in report mode with columnheader but
> I would like the column header to be transparent and without displaying 
> separators.
> How can I do that ?

Or same question : HOW CAN I CHANGE COLUMN HEADER COLOR ?
0
richom.v (84)
2/15/2007 1:27:36 PM
"mosfet" <richom.v@free.fr> wrote in message 
news:45d45ced$0$26337$426a74cc@news.free.fr...
> Hi,
>
> I would like to have a CListCtrl in report mode with columnheader but
> I would like the column header to be transparent and without displaying 
> separators.
> How can I do that ?

A stab in the dark as I have not tried this, but how about creating your own 
MyHeaderCtrl class derived from CHeaderCtrl class and use an object of this 
type on your list control. In your MyHeaderCtrl class, catch the message 
that sets the background color - I can't remember what it is, but you would 
find it in the MSDN. 


0
2/15/2007 2:37:49 PM
mosfet a �crit :
> mosfet a �crit :
>> Hi,
>>
>> I would like to have a CListCtrl in report mode with columnheader but
>> I would like the column header to be transparent and without 
>> displaying separators.
>> How can I do that ?
> 
> Or same question : HOW CAN I CHANGE COLUMN HEADER COLOR ?
Ok I found it :

//---------------------------------------------------------------------------//
// class CHeaderCtrlEx
//---------------------------------------------------------------------------//
CHeaderCtrlEx::CHeaderCtrlEx()
{

}

CHeaderCtrlEx::~CHeaderCtrlEx()
{

}


BEGIN_MESSAGE_MAP(CHeaderCtrlEx, CHeaderCtrl)
	//{{AFX_MSG_MAP(CColorHeaderCtrl)
	ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
	ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

//---------------------------------------------------------------------------
//
//	CHeaderCtrlEx message handlers
//
//---------------------------------------------------------------------------


// CHeaderCtrlEx::OnCustomDraw
//
//		Handles custom draw
//
void CHeaderCtrlEx::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
	NMCUSTOMDRAW*	pCD = (NMCUSTOMDRAW*)pNMHDR;
	DWORD			dwDrawStage,
					dwItemSpec;

	*pResult = CDRF_DODEFAULT;

	dwDrawStage = pCD->dwDrawStage;
	dwItemSpec	= pCD->dwItemSpec;

	if(dwDrawStage == CDDS_PREPAINT)
	{
		*pResult = CDRF_NOTIFYITEMDRAW;
	}
	else if(dwDrawStage == CDDS_ITEMPREPAINT)
	{
		HDC	hDC = pCD->hdc;

		SetTextColor(hDC, RGB(255, 255, 255));

		if(dwItemSpec)
			SetBkColor(hDC, RGB(  0,   0, 255));	// Blue
		else
			SetBkColor(hDC, RGB(  255,   0, 0));	// Red

		*pResult = CDRF_NEWFONT;
	}
}


// CColorHeaderCtrl::OnEraseBkgnd
//
//		This is where we specify the background color of the header
//
BOOL CHeaderCtrlEx::OnEraseBkgnd(CDC* pDC)
{
	CRect	rc;

	GetClientRect(&rc);

	pDC->FillSolidRect(&rc, RGB(255, 255, 0));		// Yellow
	return TRUE;
}


/////////////////////////////////////////////////////////////////////////////
//BOOL CHeaderCtrlEx::Init(CHeaderCtrl *pHeader)
//{	
//	ASSERT(pHeader && pHeader->GetSafeHwnd());
//	if (!SubclassWindow(pHeader->GetSafeHwnd()))
//	{
//		OutputDebugString(_T("Unable to subclass existing header!\n"));
//		return FALSE;
//	}
//
//	return TRUE;
//}






//---------------------------------------------------------------------------//
// class CHistoryListCtrl
//---------------------------------------------------------------------------//
IMPLEMENT_DYNAMIC(CHistoryListCtrl, CListCtrl)
CHistoryListCtrl::CHistoryListCtrl()
{
}

CHistoryListCtrl::~CHistoryListCtrl()
{
}


BEGIN_MESSAGE_MAP(CHistoryListCtrl, CListCtrl)
	ON_WM_CREATE()
END_MESSAGE_MAP()




int CHistoryListCtrl::SubclassHeader()
{
	CHeaderCtrl*	pHeader;
	int				nRval = 0;

	pHeader = GetHeaderCtrl();
	if(pHeader && pHeader->GetSafeHwnd()){
		if(!m_hdr.SubclassWindow(pHeader->GetSafeHwnd()))
			nRval = -1;
	}

	return nRval;
}

void CHistoryListCtrl::PreSubclassWindow()
{
	// Use REPORT mode
	ModifyStyle(0, LVS_REPORT);
	
	//-- Subclassing header with our custom --//
	SubclassHeader();


	CListCtrl::PreSubclassWindow();
}




//---------------------------------------------------------------------------
//
//	CHistoryListCtrl message handlers
//
//---------------------------------------------------------------------------
int CHistoryListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if(CListCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	//-- Subclassing header with our custom --//
	return SubclassHeader();
}
0
richom.v (84)
2/15/2007 3:18:44 PM
Here is a good article on how to subclass the listctrl's header control.

http://www.codeproject.com/listctrl/headerctrl.asp

AliR.

"mosfet" <richom.v@free.fr> wrote in message 
news:45d45ced$0$26337$426a74cc@news.free.fr...
> Hi,
>
> I would like to have a CListCtrl in report mode with columnheader but
> I would like the column header to be transparent and without displaying 
> separators.
> How can I do that ? 


0
AliR3470 (3236)
2/15/2007 4:31:14 PM
Reply:

Similar Artilces:

Formula In Crystal Reports
Hi All, I'm just starting to learn Crystal right now but it's all very new to me so I was just curious if anyone knows if you can do formulas in it. I'd like to take a custom CRM field called setup cost on a product and add all the values of this field up in a quote. Ie if there are 3 products all with seperate setup costs I want to add those together. Or will this have to be done a different way? Thanks all Tom Hi, Crystal supports both VB and Crystal Reports formulas. the help files are quite good regarding formulas, and the 9.2.2 CR with enhanced edition has an excel...

MATCHING COLUMNS
I HAVE A QUESTION ABOUT MATCHING COLUMNS IN EXCEL. FOR INSTANCE I HAVE TWO COLUMNS ONE IN A AND ONE IN B WITH ALL DIFFERENT VALUES. HOW DO I MATCH COLUMN A WITH COLUMN B? AN EXAMPLE IS BELOW A B 000824108498310 000824108378310 000825252525151 000824108378310 002020204582810 000824108448310 020202222225550 000824108460310 None of your values matches any value from other column! Regards, -- AP PS: ALL CAPS means yelling: please avoid! <HOOSICK@NYCAP.RR.COM> a...

pivot table grand totals not showing for all columns...
i have a pivot table that shows the grand total for some columns, but not for others... there are no differences in the data layout, yet this happens? any clues as to why? and how I can get the grand totals to show for all fields. thanx in the PivotTable floating toolbar, click PviotTable, then Table Options, select 'Grand totals for columns' option. ...

Do I need DSClient to run Exchange 5.5 on an NT4.0 box in Windows 2003 Native Mode ADS?
Good Evening, I am in the process of migrating my WinNT4.0 domain and Exchange 5.5 Org to Windows 2003 ADS/Exchange 2003. I know best practice is to change the domain to Native mode, but how does this affect my NT4.0 server running 5.5? Do I need to simply load the DSClient onto the server? I should also note that we did an inplace upgrade from NT 4.0. This is a single domain environment. As long as you no longer have NT 4.0 BDCs you should be able to move to native mode. Your NT 4.0 server running E55 will not be affected (unless of course it is also a BDC). It is a good idea to...

Turn Off SOP Transfer Log Report
Is there any way to not have the SOP Transfer Log show up? We usually just hit the Cancel button on the Report Destination window but it gets annoying when you transfer 100-150 orders a day. I know you can go into the posting setup to cancel posting reports but I can't find anyway to stop the Transfer Log. -- Scott Scott, No, there isn't a method built in to do this. You'd need a customization using Dexterity or I think you could use VBA to do this as well. patrick mbs developer support -- This posting is provided "AS IS" with no warranties, and confers no ri...

Listbox headers
For my listbox control, I set the value of "ColumnHeads" to True, meaning that my listbox will contain headers for my columns. I can now see the headers in my listbox, I just dont know how to enter text into each header. how do i do that? thank u Robert Those headers come from the row above the range you use for the .rowsource. If your .rowsource is (say) A2:A10, then the column headings will be from row 1. Robert Crandal wrote: > > For my listbox control, I set the value of "ColumnHeads" to True, > meaning that my listbox will contain ...

Report width will not shrink
I have a report that was originally designed as legal size, but by eliminating a few columns is now landscape letter size. However I am unable to shrink the width from 12" to 9" - there seems to be something invisible to me in one of the headers, footers or detail sections. I have tried everything to try to select whatever it is that is 12" wide but am unable to find it. I have tried CTRL A for select all, tried highlighting from the top or the side, etc but nothing shows up. It has to be a line or something, but when I preview the report the second page is blank. I ...

Inserting rows slow on large report
I have a large report I maintain with 3 data tabs and 2 report tabs, 1 for top 10 customers, about 400 rows, and another for all other customers, about 4000 rows. Every month I have to update it for any new customer/product combinations. I have optimized the formulas to the best of my abilities and gotten a full recalc time down from 3 min to 30 sec, which is acceptable. My biggest problem now is that every time I need to add a row (or delete one for that matter) it takes about 15 seconds (on the 4k row report, adding to the top 10 customers report takes 3-5 seconds), per row....

sending to group gets "sending reported error 0x80040610"
Task 'Microsoft Exchange Server - Sending' reported error (0x80040610) : 'Unknown Error 0x80040610' This person sent an email to a distribution group we have set up. It seems that everyone got it but the error came to her like that. Any ideas? Bryce. Does this help? http://support.microsoft.com/kb/885917 -- Ed Crowley MVP - Exchange "Protecting the world from PSTs and brick backups!" "Bryce" <fukuzz@hotmail.com> wrote in message news:46119f2c$0$503$815e3792@news.qwest.net... > Task 'Microsoft Exchange Server - Sending' reported e...

Parmeters in Reports
Hello, I have a report generated from a query. The field names are add1, add2 and add3, productname. The data in the fields: add1-add3 are the same. I would like to be prompted when I open the report for the data in fields add1, add2 and add3. Thanks -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200708/1 Open the query in design view. Add this as criteria for add1 --- [Enter add1 info] If you want the query to return records that have all if the criteria you enter then put criteria for the rest on the same criteria row. Otherwi...

How do I arrange entries in a column alphabetically
I have typed a list of entries in a column in Excel 2003 and now I want to list them alphabetically. Any ideas how I do this? Select the column, go to Data > Sort, and sort ascending. HTH Jason Atlanta, GA >-----Original Message----- >I have typed a list of entries in a column in Excel 2003 and now I want to >list them alphabetically. Any ideas how I do this? >. > ...

grouping cells to sort by only one column
Hi, New to this so please bear with me. I have a spread sheet where I am listing names in column A and othe info relating to that name in columns B and C in the two rows below th name. I then start a different name in the next row down with the info in t two rows below that, and so forth. I want to be able to add more names in the future and be able to sor all of this by column A only. The problem I am having is the info i the other columns moves. I need it to somehow attatch and stay put wit it's corisponding name without moving. In other words how do I make everything from A1 to ...

Excel's column width format box
Does anyone know why I am unable to enter a number into Excel's column width box, yet using the mouse, I am able to adjust the width. When opening the text box, I can delete the number that appears, but am unable to even reenter that one after it is deleted. I must tell you that I'm a new user who's working through numerous tutorials. Thanks, Hi do you get an error message or what happens exactly -- Regards Frank Kabel Frankfurt, Germany rly2rys wrote: > Does anyone know why I am unable to enter a number into Excel's > column width box, yet using the mouse, I am ...

2 existing spreadsheets show 1st line rather than header row to sort ...
(XL2003) This is odd, I haven't seen this ever before. I was working on spreadsheets yesterday for a mail merge. Two had headers rows. I cleaned up both documents, put print area and then tried to sort. In both cases, what came up in the sort was the first row below the header where one always sees the actual titles of the header row when one selects the Header Row radio button under "My List Has" in the "Sort" box. I fiddled and fiddled a bit and managed to get one of the workbooks to display the sort properly by the header row titles - without figuring out what ...

CRM, Reporting Services & Forms Authentication
Our company has an app with forms auth that is integrated with Reporting Services. We have forms auth working successfully with Reporting Services. We'd like to integrate CRM and still use forms auth. Is this possible with CRM? Would anyone be kind enough to point me to any documentation or examples of CRM w/ forms auth & Reporting Services? ...

New Entity visit Report and Integration of Participants (MS CRM 3.
Hello Newsgroup, We have created a new Entity called visit reports. We have to add Participants in this new entity. It would nice, if we could have a field like the Participants in the appointment, where you can select the Participants from Contacts, Accounts, and Users. I'll hope , some of you have a idear. Regards Thomas You have to create a new relationship for your custom entity to the types of participants you want to be available. -- Matt Wittemann http://icu-mscrm.blogspot.com "Thomas Haller" wrote: > Hello Newsgroup, > > We have created a new Entity...

Crystal Report 9.2.2!!!
Hello All, I have install crystal report 9 then I download crystal 9.2.2 and start the setup. first it uninstall crystal report 9 and then it starts installing 9.2.2 and ask the CD KEY I enter Crystal Report 9.0 CD key but it does not accept that KEY. How can I update Crystal 9.0 to Crystal 9.2.2??? Thanks in Advance, Naveed. recheck the key...you only need to install 9.2.2 then enter the 9.0 key -- John O'Donnell Microsoft CRM MVP http://www.microsoft.com/BusinessSolutions/Community/CRMFaqLanding.aspx "Naveed" <nrehman@marsonssoft.com> wrote in message news:e%23...

Report Columns
I am trying to add columns to my report but am having some difficulty. The report is basically a form letter. It is grouped on the employee’s unique ID. In that group header is the letter, Dear so and so etc. It is the details portion that I am trying to get into two columns. Is there something I am missing on how to do this. I would rather no put a sub report in to accomplish this. Thank you Jason, Well, the subform would be an easy way to go about that. However, I would think you could use the ID group header to display the first part of the letter, the detail section to disp...

weird sum on report
Hi everyone I'm building a report based on several crosstab qry and it seem ok with values. That report has group values. I want, at some point, a line with totals as well as a line with the difference between 2 lines, like expenses to sales. Quite simple, i guess. Result : not only it doesn't subtract in some grouping/levels, as well it doesn't sum the other 4 lines i need. Is this weird or not? (lol) Tks in advance for all your help. Pedro Pedro, I don't see anything wrong from where I sit. Of course, I can't see your crosstabs, data, grouping levels, expressions, ...

Recover missing Z-Report
One of my clerks received an error message during running a Z-Report....she did not note the error so I have no idea what it is...the report did not print yet manager says there is a Z-Report but it is blank...all the transactions are in manager and it says there is a Z-Report but it is totally blank....any way to regenerate this Z-report or make it so it's not blank? ...

HTML report in vb.net
How do I create an html report in vb.net instead of Crystal or ReportViewer? Hello, > How do I create an html report in vb.net instead of Crystal or > ReportViewer? Pretty vague. If the problem is to create html markup you could try the HtmlTextWriter class (http://msdn.microsoft.com/en-us/library/system.web.ui.htmltextwriter(VS.80).aspx to see if it's easier for you. Also most Reporting Packages (including RS, note sure about Crystal but very likely) are able to render a report as HTML markup so you could perhaps still use them. Not sure what is your scena...

Creating a report that tracks stock's life cycle (buy, transfer, s
Greetings and Salutations I purchase ABC stock, and it is held by my broker "Those Brothers". I purchase more ABC stock at different times. These transactions are recorded in Money. I move my investments from "Those Brothers" to the "Quiet Company" and I purchase more ABC stock at various times. The Transfer Out and the additional Buys are all recorded in Money. I decide to sell a lot of ABC stock (spanning multple purchases and multiple investment firms) and use the FIFO method. Somehow Money knows which shares it is selling, I would like to get a report...

CListCtrl InsertColumn(0, "L", LVCFMT_RIGHT)?
Hi, The CListCtrl doesn't appear to like the first column to be aligned non-left. Why? By inserting the first column with InsertColumn(1, "L", LVCFMT_RIGHT), it does show it right aligned. But what if there are columns already? Should I delete and reinsert them all? "Olaf van der Spek" <Olaf@XCC.TMFWeb.NL> wrote in message news:%23K2rr8LLFHA.2716@TK2MSFTNGP15.phx.gbl... > Hi, > > The CListCtrl doesn't appear to like the first column to be aligned > non-left. Why? > By inserting the first column with InsertColumn(1, "L", LVCFMT_R...

Report output appears to be in Chinese
I have a query based on multiple tables/queries and when i set one of the relationships to many-to-one, the report output appears to be chinese characters. If I change the relationship, the output appears normal, but I don't get all the records I'm looking for. Any suggestions? Yes. Make a backup of your database right now and put it away in a safe place. While you are at it, look for your most recent backup. You may need it. You may have a corrupt database. Tony Toews has an excellent web page on database corruption. Http://www.granite.ab.ca/access/corruptmdbs.htm ...

Reporting table fields vertically
I've come across a client with a non-normalized table with sales of items for eight different regions. So, the fields in the table are: ItemCode Region1SalesQty Region2SalesQty .... .... Region8SalesQty Typically the client is printing these sales in columns, with a report that has the eight regions spaced horizontally across the page. Something like this: ItemCode Region1SalesQty Region2SalesQty ... Region8SalesQty However, they now need a report with the sales reported vertically, like this: ItemCode Region1SalesQty Region2SalesQty ...