Click here to Skip to main content
15,899,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: [Internet] Connect directly between 2 computer Pin
arr.cpp3-Apr-07 5:36
arr.cpp3-Apr-07 5:36 
QuestionA linker error! Pin
Malini Nair31-Mar-07 20:50
Malini Nair31-Mar-07 20:50 
AnswerRe: A linker error! Pin
hoanglinh946631-Mar-07 21:02
hoanglinh946631-Mar-07 21:02 
AnswerRe: A linker error! Pin
CPallini1-Apr-07 1:03
mveCPallini1-Apr-07 1:03 
AnswerRe: A linker error! Pin
C Mahesh1-Apr-07 20:38
C Mahesh1-Apr-07 20:38 
AnswerRe: A linker error! Pin
Sachin R Sangoi2-Apr-07 1:20
Sachin R Sangoi2-Apr-07 1:20 
QuestionSDI as Main View with Zero to Many MDI-like Child Views Pin
C. Peterson31-Mar-07 18:52
C. Peterson31-Mar-07 18:52 
QuestionAbout multi-column listbox Pin
Chen-XuNuo31-Mar-07 16:20
Chen-XuNuo31-Mar-07 16:20 
I am doing a multi-column listbox,I set its styles:OwnerDraw-Fixed,Multi-column and "No integal height".Then I add virtual function MeasureItem and add code :
void CColorListBox::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
// TODO: Add your code to determine the size of specified item
CRect rect;
GetWindowRect(&rect);

ScreenToClient(&rect);

lpMeasureItemStruct->itemHeight=rect.Height()/2;
lpMeasureItemStruct->itemWidth=rect.Width()/4;
}

I add a member function to initialize the data and call this function in PreSubclassWindow:
void CColorListBox::InitData()
{
SetItemData(0,RGB(255,0,0));
SetItemData(1,RGB(0,255,0));
SetItemData(2,RGB(0,0,255));
SetItemData(3,RGB(125,0,0));
SetItemData(4,RGB(0,125,0));
SetItemData(5,RGB(0,0,125));
SetItemData(6,RGB(125,125,0));
SetItemData(7,RGB(125,125,125));
}

The last I do DrawItem:
void CColorListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// TODO: Add your code to draw the specified item
CDC* pDC=CDC::FromHandle(lpDrawItemStruct->hDC);
UINT action=lpDrawItemStruct->itemAction;
UINT state=lpDrawItemStruct->itemState;
CRect rcItem=lpDrawItemStruct->rcItem;

//pDC->SetBkMode(TRANSPARENT);
if( !(state&ODS_SELECTED) )
pDC->FillSolidRect(&rcItem,(COLORREF)lpDrawItemStruct->itemData);
}

Is there something wrong in my operation?I set a breakpoint in MeasureItem and debug the program,but it don't run through the breakpoint?

I appreciate your comments~
AnswerRe: About multi-column listbox Pin
Chen-XuNuo1-Apr-07 1:22
Chen-XuNuo1-Apr-07 1:22 
GeneralRe: About multi-column listbox Pin
Hamid_RT1-Apr-07 18:22
Hamid_RT1-Apr-07 18:22 
QuestionCScroll behavior Pin
johny_d31-Mar-07 10:02
johny_d31-Mar-07 10:02 
AnswerRe: Warning while building a DLL Pin
prasad_som31-Mar-07 18:36
prasad_som31-Mar-07 18:36 
GeneralRe: Warning while building a DLL Pin
chelsea_blues1-Apr-07 5:54
chelsea_blues1-Apr-07 5:54 
QuestionEditbox in FormView Pin
CosminU31-Mar-07 7:16
CosminU31-Mar-07 7:16 
AnswerRe: Editbox in FormView Pin
bob1697231-Mar-07 18:14
bob1697231-Mar-07 18:14 
GeneralRe: Editbox in FormView Pin
CosminU1-Apr-07 23:35
CosminU1-Apr-07 23:35 
Questionasking how to program list only hidden files under linux in c Pin
Arif Liminto31-Mar-07 7:15
professionalArif Liminto31-Mar-07 7:15 
QuestionLinux? Pin
CPallini31-Mar-07 8:20
mveCPallini31-Mar-07 8:20 
AnswerRe: asking how to program list only hidden files under linux in c Pin
ThatsAlok1-Apr-07 21:18
ThatsAlok1-Apr-07 21:18 
QuestionHTF? :mad: Pin
_808631-Mar-07 6:53
_808631-Mar-07 6:53 
AnswerRe: HTF? :mad: Pin
PJ Arends31-Mar-07 7:20
professionalPJ Arends31-Mar-07 7:20 
GeneralRe: HTF? :mad: [modified] Pin
_808631-Mar-07 7:58
_808631-Mar-07 7:58 
GeneralRe: HTF? :mad: Pin
PJ Arends31-Mar-07 12:07
professionalPJ Arends31-Mar-07 12:07 
GeneralRe: HTF? :mad: Pin
_808631-Mar-07 16:49
_808631-Mar-07 16:49 
GeneralRe: HTF? :mad: Pin
CPallini31-Mar-07 12:08
mveCPallini31-Mar-07 12:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.