Click here to Skip to main content
15,891,749 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: File Serialization versus old style data saving on files Pin
David Crow22-May-08 6:48
David Crow22-May-08 6:48 
QuestionProblem with CHttpFile and HTML Pin
Sylv3322-May-08 4:06
Sylv3322-May-08 4:06 
QuestionHow long int can the threads ID be... Pin
pl_kode22-May-08 4:03
pl_kode22-May-08 4:03 
AnswerRe: How long int can the threads ID be... Pin
CPallini22-May-08 4:13
mveCPallini22-May-08 4:13 
AnswerRe: How long int can the threads ID be... Pin
Mike Dimmick22-May-08 4:39
Mike Dimmick22-May-08 4:39 
QuestionProblem with select row in list control Pin
tataxin22-May-08 2:56
tataxin22-May-08 2:56 
AnswerRe: Problem with select row in list control Pin
David Crow22-May-08 3:28
David Crow22-May-08 3:28 
GeneralRe: Problem with select row in list control Pin
tataxin22-May-08 3:43
tataxin22-May-08 3:43 
Thank you for your answer, DavidCrow.
Actually, I have a int member of dialog to keep the old row.
So this function look like this:

void AlarmCompreMsgDig::OnLvnItemchangedList1(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR);
	m_lstAlarmCompreMsg.SetItemState(-1, 0, LVIS_SELECTED); // first, diselect the row

	int rowIndex = pNMLV->iItem;
	
	CRect rec;  // boundary rectangular that wrap the row
	m_lstAlarmCompreMsg.GetItemRect(rowIndex, rec, LVIR_BOUNDS);


	// a little adjust the rectangular
        rec.top -= 2;
	rec.bottom += 2;

	CDC* cdc = m_lstAlarmCompreMsg.GetDC();

	CPen aPen;
	
        // oldRowIndex is the member of dialog
       if (oldRowIndex == rowIndex){ // this occurs 1st, and 3rd also 
             aPen.CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); // select color Black (background color)
        } 
        else // this occurs 2nd
        {
             aPen.CreatePen(PS_SOLID, 1, RGB(255, 255, 255)); // select color White
             oldRowIndex = rowIndex;   // update oldRowIndex
        }        
	
	CPen* pOldPen = cdc->SelectObject(&aPen); // Select the pen
	
	// Now draw the rectangular
	cdc->Rectangle(rec);

        // select back the old pen
	cdc->SelectObject(pOldPen);
        
        *pResult = 0;
}


But there is something wrong here: this function is called 3 time totally. The 1st time it will erase the old rectangular, the second time it draw new rectangular, and then the last time it erase the new created rectangular.

I don't know why???
QuestionRe: Problem with select row in list control Pin
David Crow22-May-08 4:16
David Crow22-May-08 4:16 
AnswerRe: Problem with select row in list control Pin
tataxin22-May-08 4:35
tataxin22-May-08 4:35 
GeneralRe: Problem with select row in list control Pin
David Crow22-May-08 5:41
David Crow22-May-08 5:41 
AnswerRe: Problem with select row in list control Pin
tataxin22-May-08 5:49
tataxin22-May-08 5:49 
QuestionGetDIBits Pin
subramanyeswari22-May-08 2:54
subramanyeswari22-May-08 2:54 
AnswerRe: GetDIBits Pin
CPallini22-May-08 3:30
mveCPallini22-May-08 3:30 
AnswerRe: GetDIBits Pin
Hamid_RT22-May-08 4:21
Hamid_RT22-May-08 4:21 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 18:18
subramanyeswari22-May-08 18:18 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:01
Hamid_RT22-May-08 19:01 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:07
subramanyeswari22-May-08 19:07 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:17
Hamid_RT22-May-08 19:17 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:22
subramanyeswari22-May-08 19:22 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:29
Hamid_RT22-May-08 19:29 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:34
subramanyeswari22-May-08 19:34 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 19:46
Hamid_RT22-May-08 19:46 
GeneralRe: GetDIBits Pin
subramanyeswari22-May-08 19:51
subramanyeswari22-May-08 19:51 
GeneralRe: GetDIBits Pin
Hamid_RT22-May-08 20:15
Hamid_RT22-May-08 20:15 

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.