Click here to Skip to main content
15,897,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Need to create Document and Excel in vc++ Pin
harinath6-May-03 7:57
professionalharinath6-May-03 7:57 
QuestionHow to get all the controls in a CDialog? Pin
melwyn6-May-03 5:19
melwyn6-May-03 5:19 
AnswerRe: How to get all the controls in a CDialog? Pin
harinath6-May-03 5:22
professionalharinath6-May-03 5:22 
GeneralRe: How to get all the controls in a CDialog? Pin
basementman6-May-03 5:45
basementman6-May-03 5:45 
GeneralRe: How to get all the controls in a CDialog? Pin
melwyn8-May-03 1:28
melwyn8-May-03 1:28 
GeneralRe: How to get all the controls in a CDialog? Pin
melwyn7-May-03 22:47
melwyn7-May-03 22:47 
Questionhow to rotate text without having to select another font Pin
didida6-May-03 5:02
sussdidida6-May-03 5:02 
AnswerRe: how to rotate text without having to select another font Pin
basementman6-May-03 6:08
basementman6-May-03 6:08 
You need to create a new font and set the LOGFONT's lfEscapement value to the rotation required prior to creating the font. See the sample below:

// helper text-drawing function
void DrawOrientedText(CDC *pDC, CRect oR, short iOrientation, CString cText, LPLOGFONT lpLF, UINT iFlags/*=DT_CENTER*/,BOOL bSuppressSpace/*=FALSE*/)
{
CFont *pOldFont;
CFont oFont;
short iOldEscapement;
BOOL bExtruded = FALSE;
BOOL bRecessed = FALSE;
BOOL bHeavy = FALSE;

CString cDrawText;

if (iFlags & DRAW_EXTRUDED)
bExtruded = TRUE;

if (iFlags & DRAW_RECESSED)
bRecessed = TRUE;

if (iFlags & DRAW_HEAVY)
bHeavy = TRUE;

iFlags &= ~(DRAW_EXTRUDED|DRAW_RECESSED|DRAW_HEAVY);

if (bSuppressSpace)
cDrawText = cText;
else
cDrawText = CString(" ")+cText+CString(" ");

if (lpLF)
{
iOldEscapement = (short)lpLF->lfEscapement;

lpLF->lfEscapement = 0;

if (iOrientation == iORIENT_90)
lpLF->lfEscapement = 900;

if (iOrientation == iORIENT_270)
lpLF->lfEscapement = 2700;

oFont.CreateFontIndirect(lpLF);
pOldFont = pDC->SelectObject(&oFont);

lpLF->lfEscapement = iOldEscapement;
}

short iOldBkMode = pDC->SetBkMode(TRANSPARENT);

if (iOrientation == iORIENT_NORM || iOrientation == iORIENT_TB)
{
if (iOrientation == iORIENT_TB)
{
CString cTempText = cDrawText;
short iLen = cTempText.GetLength();
cDrawText = "";

char caChar[4];

caChar[1] = 13;
caChar[2] = 10;
caChar[3] = 0;

for (int iLup = 0; iLup < iLen; iLup++)
{
caChar[0] = cTempText[iLup];
if (caChar[0] == 13 || caChar[0] == 10)
caChar[0] = ' ';

cDrawText += CString(caChar);
}
}

if (iOrientation == iORIENT_TB || cDrawText.Find("\n") > -1)
iFlags |= DT_WORDBREAK;
else
iFlags |= DT_SINGLELINE;

iFlags |= DT_NOPREFIX;

if (bExtruded || bRecessed)
DrawTextSpecial(pDC,cDrawText,oR,iFlags,bExtruded,bRecessed,bHeavy);

pDC->DrawText(cDrawText,cDrawText.GetLength(),&oR,iFlags);
}
else
{
short iFontAdj = 5; // default to 10pt
if (lpLF)
iFontAdj = abs(lpLF->lfHeight) / 2;

if (iOrientation == iORIENT_270)
iFontAdj = (-iFontAdj) + 1;
else
iFontAdj -= 1;

short iX = oR.left + (oR.Width() / 2) - 1 + iFontAdj;
short iY = oR.top + (oR.Height() / 2);

short iOldAlign = pDC->SetTextAlign(TA_CENTER|TA_BASELINE);

if (bExtruded || bRecessed)
TextOutSpecial(pDC,cDrawText,iX,iY,bExtruded,bRecessed,bHeavy);

pDC->TextOut(iX, iY, cDrawText);

pDC->SetTextAlign(iOldAlign);
}

if (lpLF)
pDC->SelectObject(pOldFont);

pDC->SetBkMode(iOldBkMode);
}
GeneralPls Help Me. Pin
stilgar6-May-03 4:54
stilgar6-May-03 4:54 
GeneralCopy a pointer to an element of an array of pointers Pin
Majid Shahabfar6-May-03 4:13
Majid Shahabfar6-May-03 4:13 
GeneralRe: Copy a pointer to an element of an array of pointers Pin
David Crow6-May-03 4:28
David Crow6-May-03 4:28 
GeneralRe: Copy a pointer to an element of an array of pointers Pin
Hans Ruck6-May-03 4:28
Hans Ruck6-May-03 4:28 
GeneralRe: Copy a pointer to an element of an array of pointers Pin
jhaga6-May-03 4:36
professionaljhaga6-May-03 4:36 
GeneralRe: Copy a pointer to an element of an array of pointers Pin
Peter Mares6-May-03 4:48
Peter Mares6-May-03 4:48 
GeneralCoCreateInstance Tracing Pin
Daniel Turini6-May-03 4:01
Daniel Turini6-May-03 4:01 
GeneralFinding/Loading resources Pin
will13836-May-03 3:37
will13836-May-03 3:37 
GeneralRe: Finding/Loading resources Pin
David Crow6-May-03 4:06
David Crow6-May-03 4:06 
GeneralRe: Finding/Loading resources Pin
will13836-May-03 4:34
will13836-May-03 4:34 
GeneralRe: Finding/Loading resources Pin
David Crow6-May-03 4:39
David Crow6-May-03 4:39 
GeneralRe: Finding/Loading resources Pin
will13836-May-03 4:44
will13836-May-03 4:44 
GeneralRe: Finding/Loading resources Pin
basementman6-May-03 4:50
basementman6-May-03 4:50 
GeneralRe: Finding/Loading resources Pin
will13836-May-03 5:16
will13836-May-03 5:16 
GeneralRe: Finding/Loading resources Pin
basementman6-May-03 5:24
basementman6-May-03 5:24 
GeneralRe: Finding/Loading resources Pin
will13836-May-03 5:36
will13836-May-03 5:36 
GeneralRe: Finding/Loading resources Pin
David Crow6-May-03 6:02
David Crow6-May-03 6:02 

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.