Click here to Skip to main content
15,919,879 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: operating system Pin
LighthouseJ10-Nov-05 7:42
LighthouseJ10-Nov-05 7:42 
QuestionDamn it - why does this code compile? Pin
Chintoo72310-Nov-05 6:17
Chintoo72310-Nov-05 6:17 
AnswerRe: Damn it - why does this code compile? Pin
Chris Meech10-Nov-05 6:56
Chris Meech10-Nov-05 6:56 
GeneralRe: Damn it - why does this code compile? Pin
Chintoo72310-Nov-05 7:29
Chintoo72310-Nov-05 7:29 
AnswerRe: Damn it - why does this code compile? Pin
Maximilien10-Nov-05 7:06
Maximilien10-Nov-05 7:06 
GeneralRe: Damn it - why does this code compile? Pin
Chintoo72310-Nov-05 7:43
Chintoo72310-Nov-05 7:43 
AnswerRe: Damn it - why does this code compile? Pin
James R. Twine10-Nov-05 8:37
James R. Twine10-Nov-05 8:37 
QuestionTrying to create a custom CListBox control that uses a CRichEditCtrl Pin
Danny S10-Nov-05 5:12
Danny S10-Nov-05 5:12 
Today, we have an informational dialog where the information is displayed in
a RichText control. The only action for the user is to press the OK button
to dismiss the dialog.

My desire is to enhance this dialog by adding a 'Go To' button where the
user would select one of the informational items in the list, press the 'Go
To' button, the dialog would disappear, and then the 'go to' action occurs.
I still need to display the information using RichText.

Following an example, I attempted to create a custom CListBox control where
the items in the listbox would be displayed using the CRichTextCtrl. The
custom CListBox control contains owner methods of DrawItem and MeasureItem.
The first draft for DrawItem is included. This code appears to work but is
far from perfect. It lacks code for item selection and in my sample code I
can get it to write outside of the boundary of the control. Furthermore, I
am not sure what needs to be done for MeasureItem method.


void CRichEditListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC* pDC = CDC::FromHandle (lpDrawItemStruct->hDC);

if (lpDrawItemStruct->itemID != -1)
{
COLORREF TextBkClr = SysColor (COLOR_WINDOW);

CString Text;
GetText (lpDrawItemStruct->itemID, Text);

CRect rect;
GetItemRect (lpDrawItemStruct->itemID, rect);

// Format the text and render it

UINT Left = ::MulDiv (rect.left, 1440, pDC->GetDeviceCaps (LOGPIXELSX));
UINT Top = ::MulDiv (rect.top, 1440, pDC->GetDeviceCaps (LOGPIXELSY));
UINT Right = ::MulDiv (rect.right, 1440, pDC->GetDeviceCaps (LOGPIXELSX));
UINT Bottom = ::MulDiv (rect.bottom, 1440, pDC->GetDeviceCaps (LOGPIXELSY));

CRect Rect (Left, Top, Right, Bottom);

FORMATRANGE fr;
fr.hdc = pDC->m_hDC;
fr.hdcTarget = pDC->m_hDC;
fr.rc = Rect;
fr.rcPage = Rect;
fr.chrg.cpMin = 0;
fr.chrg.cpMax = -1;

UINT StreamType;
if (Text.Left (6) == "{\\rtf1")
StreamType = SF_RTF;
else
StreamType = SF_TEXT;


EDITSTREAM es =
{
(DWORD)&Text, 0, EditStreamCallBack
};

m_pRichEditTemp->SetSel (0,-1);
m_pRichEditTemp->SetBackgroundColor (FALSE, TextBkClr);
m_pRichEditTemp->Clear ();
m_pRichEditTemp->StreamIn (StreamType, es);
m_pRichEditTemp->FormatRange (&fr, TRUE);

// Update the display with the new formatting
CRect rcClient;
m_pRichEditTemp->GetClientRect (&rcClient);
m_pRichEditTemp->DisplayBand (&rcClient);
}
}


I have examined the internet and information is scarce. My hope is that
some one can point me in the correct direction or can suggest another
approach.


Thank you for your support.
Dan


QuestionCxImage,gif animation Pin
Csaba Csata10-Nov-05 5:10
Csaba Csata10-Nov-05 5:10 
QuestionUsing database and recordsets with multiple .mdb files. Pin
Mark F.10-Nov-05 4:50
Mark F.10-Nov-05 4:50 
AnswerRe: Using database and recordsets with multiple .mdb files. Pin
hairy_hats10-Nov-05 5:33
hairy_hats10-Nov-05 5:33 
GeneralRe: Using database and recordsets with multiple .mdb files. Pin
Mark F.10-Nov-05 6:14
Mark F.10-Nov-05 6:14 
AnswerRe: Using database and recordsets with multiple .mdb files. Pin
David Crow10-Nov-05 8:54
David Crow10-Nov-05 8:54 
GeneralRe: Using database and recordsets with multiple .mdb files. Pin
Mark F.11-Nov-05 10:15
Mark F.11-Nov-05 10:15 
QuestionDirectX - How to Create Virtual Video Capture Source using the Filter Pin
Vishal Jariwala10-Nov-05 4:15
Vishal Jariwala10-Nov-05 4:15 
QuestionWeird memory issue Pin
Axonn Echysttas10-Nov-05 4:00
Axonn Echysttas10-Nov-05 4:00 
AnswerRe: Weird memory issue Pin
S. Senthil Kumar10-Nov-05 4:55
S. Senthil Kumar10-Nov-05 4:55 
GeneralRe: Weird memory issue Pin
Axonn Echysttas10-Nov-05 6:24
Axonn Echysttas10-Nov-05 6:24 
GeneralRe: Weird memory issue Pin
S. Senthil Kumar10-Nov-05 19:02
S. Senthil Kumar10-Nov-05 19:02 
QuestionHow to remname a VC++ project Pin
TUMB10-Nov-05 3:54
TUMB10-Nov-05 3:54 
AnswerRe: How to remname a VC++ project Pin
Axonn Echysttas10-Nov-05 4:12
Axonn Echysttas10-Nov-05 4:12 
AnswerRe: How to remname a VC++ project Pin
Robin Hilliard10-Nov-05 6:59
Robin Hilliard10-Nov-05 6:59 
Question_vsnprintf questions Pin
ita_cas10-Nov-05 2:35
ita_cas10-Nov-05 2:35 
AnswerRe: _vsnprintf questions Pin
toxcct10-Nov-05 2:46
toxcct10-Nov-05 2:46 
GeneralRe: _vsnprintf questions Pin
kakan10-Nov-05 3:21
professionalkakan10-Nov-05 3:21 

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.