Click here to Skip to main content
15,890,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to read the notepad file using vc++ Pin
Rajesh R Subramanian11-Dec-06 23:24
professionalRajesh R Subramanian11-Dec-06 23:24 
QuestionRe: how to read the notepad file using vc++ Pin
CPallini11-Dec-06 23:26
mveCPallini11-Dec-06 23:26 
AnswerRe: how to read the notepad file using vc++ Pin
Hamid_RT11-Dec-06 23:38
Hamid_RT11-Dec-06 23:38 
QuestionOwner draw combobox problem Pin
gajendrakashyap11-Dec-06 22:55
gajendrakashyap11-Dec-06 22:55 
AnswerRe: Owner draw combobox problem Pin
prasad_som11-Dec-06 23:34
prasad_som11-Dec-06 23:34 
GeneralRe: Owner draw combobox problem Pin
gajendrakashyap11-Dec-06 23:43
gajendrakashyap11-Dec-06 23:43 
GeneralRe: Owner draw combobox problem Pin
prasad_som12-Dec-06 0:10
prasad_som12-Dec-06 0:10 
GeneralRe: Owner draw combobox problem Pin
gajendrakashyap12-Dec-06 3:00
gajendrakashyap12-Dec-06 3:00 
Yes I'm using DDX control. I created the ctrl using drag and drop. Then I created the modeless dlg in OnInitDialog()function of Parent wnd as follows.

Modeless_Dlg* ptr_dlg = new Modeless_Dlg();

if(ptr_dlg)
{
ptr_dlg->Create(IDD_DIALOG_MODELESS, this);
ptr_dlg->ShowWindow(TRUE);
ptr_dlg->m_combo.AddString("FIRST");
ptr_dlg->m_combo.AddString("SECOND");
ptr_dlg->m_combo.AddString("THIRD");
}
else
AfxMessageBox("Error creating dlg");


The overridden drawitem method:
void CCustomComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
// TODO: Add your code to draw the specified item

ASSERT(lpDrawItemStruct->CtlType == ODT_COMBOBOX);
LPCTSTR lpszText = (LPCTSTR) lpDrawItemStruct->itemData;
ASSERT(lpszText != NULL);
CDC dc;

dc.Attach(lpDrawItemStruct->hDC);
ASSERT(lpDrawItemStruct->hwndItem = CWnd::GetSafeHwnd());

// Save these value to restore them when done drawing.
COLORREF crOldTextColor = dc.GetTextColor();
COLORREF crOldBkColor = dc.GetBkColor();

// If this item is selected, set the background color
// and the text color to appropriate values. Erase
// the rect by filling it with the background color.

CBrush br(RGB(255, 0, 0));

if ((lpDrawItemStruct->itemAction | ODA_SELECT) &&
(lpDrawItemStruct->itemState & ODS_SELECTED))
{
// Sets current cursor item color and selected item color
dc.SetTextColor(RGB(0, 255, 255));
// has no effect
//dc.SetBkColor(RGB(255, 0, 0));
// sets current cursor item background
dc.FillSolidRect(&lpDrawItemStruct->rcItem, RGB(0, 0, 0));

if ((lpDrawItemStruct->itemState | ODS_SELECTED) | (lpDrawItemStruct->itemAction & ODA_SELECT) )
dc.FrameRect(&lpDrawItemStruct->rcItem, &br);

}

else
{
// Sets list opening color and default combobox item color
dc.SetTextColor(RGB(0, 255, 255));
dc.FillSolidRect(&lpDrawItemStruct->rcItem, RGB(0, 0, 0));
}



// Draw the text.
dc.DrawText(
lpszText,
strlen(lpszText),
&lpDrawItemStruct->rcItem,
DT_CENTER|DT_SINGLELINE|DT_VCENTER);

// Reset the background color and the text color back to their
// original values.
dc.SetTextColor(crOldTextColor);
dc.SetBkColor(crOldBkColor);

dc.Detach();
}

Thats all the code I've added to the generated code.
I hope this helps you to figure out the problem...

Thanks,
Gaj
AnswerRe: Owner draw combobox problem Pin
prasad_som12-Dec-06 3:19
prasad_som12-Dec-06 3:19 
QuestionRe: Owner draw combobox problem Pin
gajendrakashyap12-Dec-06 3:36
gajendrakashyap12-Dec-06 3:36 
AnswerRe: Owner draw combobox problem Pin
Hamid_RT11-Dec-06 23:35
Hamid_RT11-Dec-06 23:35 
GeneralRe: Owner draw combobox problem Pin
gajendrakashyap11-Dec-06 23:50
gajendrakashyap11-Dec-06 23:50 
GeneralRe: Owner draw combobox problem Pin
Hamid_RT12-Dec-06 18:32
Hamid_RT12-Dec-06 18:32 
GeneralRe: Owner draw combobox problem Pin
gajendrakashyap12-Dec-06 19:33
gajendrakashyap12-Dec-06 19:33 
QuestionProblem in creating a property sheet and property pages Pin
Manjunath S11-Dec-06 22:38
Manjunath S11-Dec-06 22:38 
Questionlinker problems Pin
eddyroth11-Dec-06 22:05
eddyroth11-Dec-06 22:05 
QuestionHelp! Need Info on file transfer mechanism with resume download option. Pin
Sandeep Datta11-Dec-06 21:37
Sandeep Datta11-Dec-06 21:37 
AnswerRe: Help! Need Info on file transfer mechanism with resume download option. Pin
S Douglas11-Dec-06 22:10
professionalS Douglas11-Dec-06 22:10 
GeneralRe: Help! Need Info on file transfer mechanism with resume download option. Pin
Sandeep Datta12-Dec-06 1:48
Sandeep Datta12-Dec-06 1:48 
GeneralRe: Help! Need Info on file transfer mechanism with resume download option. Pin
S Douglas12-Dec-06 2:24
professionalS Douglas12-Dec-06 2:24 
QuestionContext help property of a dialog box Pin
zareee11-Dec-06 21:34
zareee11-Dec-06 21:34 
AnswerRe: Context help property of a dialog box Pin
prasad_som11-Dec-06 22:06
prasad_som11-Dec-06 22:06 
GeneralRe: Context help property of a dialog box Pin
zareee11-Dec-06 23:38
zareee11-Dec-06 23:38 
GeneralRe: Context help property of a dialog box Pin
prasad_som12-Dec-06 0:02
prasad_som12-Dec-06 0:02 
GeneralRe: Context help property of a dialog box Pin
Sam Hobbs12-Dec-06 15:47
Sam Hobbs12-Dec-06 15:47 

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.