void CMyView::OnPaint()
{
CPaintDC dc(this);
HDC hdc;
TEXTMETRIC tm;
TCHAR szOut[256];
hdc = ::BeginPaint(m_hWnd, &ps);
GetTextMetrics (hdc, &tm);
int cxCurrent = tm.tmAveCharWidth;
int cyCurrent = tm.tmHeight + tm.tmExternalLeading;
>> lstrcpy(szOut, L"Test\tTestTest");
ExtTextOut(hdc, cxCurrent, cyCurrent, 0, NULL,
szOut, lstrlen (szOut), NULL);
>> lstrcpy(szOut, L"Test\t TestTest");
ExtTextOut(hdc, cxCurrent, cyCurrent*2, 0, NULL,
szOut, lstrlen (szOut), NULL);
::EndPaint(m_hWnd, &ps);
}

Result:
Test[a hollow pane]TestTest
Test[a hollow pane] TestTest

why the char "\t" cannot be shown in eVC SDI's doc view?
any tip or suggestion would of great help.

Re: how to show char "\t" in eVC3 by Bruce

Bruce
Mon Nov 29 07:02:50 CST 2004

What do you expect to see? The \t is replaced with a number which is the
character number for a tab. You certainly will not see

Test\t TestTest


--
Bruce Eitman (eMVP)
Senior Engineer
beitman AT applieddata DOT net

Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups



Re: how to show char "\t" in eVC3 by Bruce

Bruce
Mon Nov 29 07:07:17 CST 2004

Oh, ignore that. I misread the question and not enough coffee yet.

--
Bruce Eitman (eMVP)
Senior Engineer
beitman AT applieddata DOT net

Applied Data Systems
www.applieddata.net
An ISO 9001:2000 Registered Company
Microsoft WEP Gold-level Member

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups

"Bruce Eitman (eMVP)" <beitmannospam@NOSPAM_applieddata.NOSPAM_net> wrote in
message news:e%23$B9Oh1EHA.1300@TK2MSFTNGP14.phx.gbl...
> What do you expect to see? The \t is replaced with a number which is the
> character number for a tab. You certainly will not see
>
> Test\t TestTest
>
>
> --
> Bruce Eitman (eMVP)
> Senior Engineer
> beitman AT applieddata DOT net
>
> Applied Data Systems
> www.applieddata.net
> An ISO 9001:2000 Registered Company
> Microsoft WEP Gold-level Member
>
> Do have an opinion on the effectiveness of Microsoft Windows Mobile and
> Embedded newsgroups? Let us know!
> https://www.windowsembeddedeval.com/community/newsgroups
>
>



Re: how to show char "\t" in eVC3 by rockone

rockone
Wed Dec 01 00:05:35 CST 2004

I implement the function TabbedTextOut() under eVC++3.
But I don't think it is enough good.
Any suggestion or tip would of great help.
>>
>>
/////////////////////////////////////////////////////////////////////////////////////////////
// all input parameters are same to TabbedTextOut,
// but return type is void, not LONG.
/////////////////////////////////////////////////////////////////////////////////////////////
void CMyView::myTabbedTextOut(HDC hDC,// handle to DC
int X, // x-coord of start
int Y, // y-coord of start
LPCTSTR lpString, // character string
int nCount,// number of characters
int nTabPositions,// number of tabs in array
CONST LPINT lpnTabStopPositions,// array of tab positions
int nTabOrigin // start of tab expansion
)
{
CString sTabString = lpString;
int nNextTabCharPos = sTabString.Find(L"\t");
if( nTabOrigin > 0) // if first tab character postion is not
{ // the start of tab expansion
int nTabCount = 0;
do{
nNextTabCharPos = sTabString.Find(L"\t", nNextTabCharPos+1);
nTabCount++;
if(nNextTabCharPos == -1)
break;
} while (nTabCount != nTabOrigin);
}
// Initialize the rectangle in which the text is to be formatted
RECT Rect;
Rect.left = X;
Rect.top = Y;
Rect.bottom = Rect.top + 20; // hard-code
Rect.right = X + lpnTabStopPositions[nTabOrigin];
LPRECT lpRect = &Rect;

CString sTemp = _T("");
for(int i=nTabOrigin; i<nTabPositions; i++)
{
sTemp.Empty(); // empty the string before using
if( nNextTabCharPos != -1 )
{
sTemp = sTabString.Left(nNextTabCharPos+1);
sTabString = sTabString.Right(nCount - nNextTabCharPos-1);
DrawText(hDC, sTemp, sTemp.GetLength(), lpRect,
DT_EXPANDTABS | DT_NOCLIP);
}
// get the length of the remanent character string
nCount = nCount - sTemp.GetLength();
// if there is no remanent character string
// or the character string doesn't contain tab characters
if(nCount == 0 || nNextTabCharPos == -1)
{
break;
}
nNextTabCharPos = sTabString.Find(L"\t");
Rect.left = X + lpnTabStopPositions[i];
if(i<nTabPositions-1)
{
Rect.right = X + lpnTabStopPositions[i+1];
lpRect = &Rect;
}
}
if(nCount != 0)// writes the remanent character string
{ // (that maybe not contain tab characters)
ExtTextOut(hDC, Rect.left, Rect.top, 0, NULL,
sTabString, sTabString.GetLength(), NULL);
}
}