Originally posted by: help me
I read the article carefully and I think I made all the
Any help will be welcomed
Thanks
Hello
suggested changes, e.g. creating a derived class from
CListCtrl, named CMyList, subclass the control with a
member variable from CMyList, copied all the code to the
derived class, change the default style of the control to
owner-drawn fixed, BUT when I try to insert some items I
get an assertion failure.
Originally posted by: Eugene
Hello, Zafir! Thank you very much for this code!
To be frank, firstly I couldn't select all the item -
just the firs column(and another columns disappeared).
But I've initialized a m_Highlight member variable in my
OnInitDialog() member functions with a value of 2
(means HIGHLIGHT_ROW) and got what I wanted.
Very thankful to You - now it works OK!
Originally posted by: Kelvin Liu
if( bHighlight )
The following code is color text of list control
{
pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
pDC->FillRect(rcHighlight, &CBrush(::GetSysColor(COLOR_HIGHLIGHT)));
}
else
{
pDC->FillRect(rcHighlight, &CBrush(nItem%2 ?::GetSysColor(COLOR_WINDOW)
: RGB(255,255,0)));
pDC->SetTextColor( RGB(255,0,255) );
}
Originally posted by: Stefan Niermann
Hi Zafir!
Great article, I think this is exactly what I need!
Most articles in CodeGuru.com contain a sample application and the source codes. That's very nice, because you can check the behaviour and see very quickly wether you can use that code or not. If you want to use the code, you don't have to reformat it from the HTML pages. Where can I get the sample app from your article (hardcopy at the top)?
Ciao,
Stefan
Originally posted by: Allen
I tried to use this code in a custom list control that is instantiated under a CFormView. But the
DrawItem (among other functions) was never called. Any ideas as to why?
Originally posted by: Colin Grant
If you double click the vertical line between header titles, then the header to the left automatically resizes to suit the column contents. Since the first column has a bitmap, it ends up being wider than just the text.
One simple *hack* is to set the first column text into the control with the extra couple of spaces pre-pended (and remove the offset stuff from DrawItem and cause the text to be drawn before the icon). Really this is a hack as there is no earthly reason to suppose that an icon has the same width as two spaces (especially since font sizes change!).
What I don't know is how best to fix this. Any ideas ?
Originally posted by: Andrew Gove
I want to kill the ellipses, which
I also want to change the white-space
Am I out of luck? :)
Thanks,
I don't suppose there's a way to change
how text is drawn in a list view control
(report style) without making it owner-drawn?
generally do more harm than good (the
ellipses use about 3 char-widths, which
is silly when just 1 or 2 pixels of the
last char are clipped).
margins.
Andrew Gove
Originally posted by: Steve Mueller
Data Members
m_bDocObject Contains a flag indicating whether the document being printed is a DocObject.
Attributes
SetMinPage Sets the number of the first page of the document.
The m_bPrintPreview is in the CPrintInfo structure. Here are the other members:
m_dwFlags Specifies DocObject printing operations.
m_nOffsetPage Specifies offset of a particular DocObject's first page in a combined DocObject print
job.
m_pPD Contains a pointer to the CPrintDialog object used for the Print dialog box.
m_bDirect Contains a flag indicating whether the document is being printed directly (without
displaying the Print dialog box).
m_bPreview Contains a flag indicating whether the document is being previewed.
m_bContinuePrinting Contains a flag indicating whether the framework should continue the print loop.
m_nCurPage Identifies the number of the page currently being printed.
m_nNumPreviewPages Identifies the number of pages displayed in the preview window; either 1 or 2.
m_lpUserData Contains a pointer to a user-created structure.
m_rectDraw Specifies a rectangle defining the current usable page area.
m_strPageDesc Contains a format string for page-number display.
SetMaxPage Sets the number of the last page of the document.
GetMinPage Returns the number of the first page of the document.
GetMaxPage Returns the number of the last page of the document.
GetOffsetPage Returns the number of the pages preceding the first page of a DocObject item being
printed in a combined DocObject print job.
GetFromPage Returns the number of the first page being printed.
GetToPage Returns the number of the last page being printed.
Originally posted by: Peter Sj�str�m
I now upgraded to 6.0 and now this memory error shows in Release, so now I had to solve it. I found the
problem to be that DrawItem() is not thread safe, my application uses several threads, each with it's own
CMyListCtrl object. When thread locking DrawItem(), the problem goes away.
Here's how to make DrawItem() thread safe:
void CMyListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
I implemented this code myself, and also added text string dependant coloring in DrawItem(). From that point
my Visual C++ 5.0 application would get a 60 byte memory block overrun in a totally different destructor, in
DEBUG mode only.
{
-> CMutex mutex(FALSE, "MyListCtrl::DrawItem()");
-> CSingleLock lock(&mutex);
-> lock.Lock(); // Wait until signalled.
// Unlock takes place in destructor when function exit
CRect rcItem(lpDrawItemStruct->rcItem);
...
}
Originally posted by: Ganesh Kumar B V
/* You can put this into a function and call that fuction wherever you want */
DWORD dwStyle = SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE);
if(m_bFullRow) // a flag set to true, if you need full row selection.
dwStyle |= LVS_EX_FULLROWSELECT;
else
dwStyle &= ~LVS_EX_FULLROWSELECT;
SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)dwStyle);