1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
void __fastcall Form1::PaintBox1Paint(TObject *Sender)
{
CGDRecord* pGdrec;
RECT rcDraw;
int nLeft = 11; // Text painting bounds
int nRight= viewInfo->Width-5;
int nTextHeight = 13;
if ((m_bmPaintBox1->Empty) ||
(m_bmPaintBox1->Width!=PaintBox1->Width))
{
m_bmPaintBox1->Width = PaintBox1->Width;
m_bmPaintBox1->Height= PaintBox1->Height;
m_bmPaintBox1->Canvas->Brush->Color = clWindow;
m_bmPaintBox1->Canvas->FillRect(Rect(0, 0, m_bmPaintBox1->Width, m_bmPaintBox1->Height));
m_bmPaintBox1->Canvas->Brush->Color = clHighlight;
m_bmPaintBox1->Canvas->FillRect(Rect(1, 24, m_bmPaintBox1->Width, 24+2));
}
PaintBox1->Canvas->Draw(0, 0, m_bmPaintBox1);
::SetBkMode(viewInfo->Canvas->Handle, TRANSPARENT);
TCHAR* pszDisplay = new TCHAR[_MAX_PATH];
AnsiString sDisplay;
// Display current folder name
viewInfo->Canvas->Brush->Color = clWindow;
viewInfo->Canvas->Font->Name = "Arial";
viewInfo->Canvas->Font->Size = 12;
viewInfo->Canvas->Font->Style = TFontStyles() << fsBold;
_tcscpy(pszDisplay, m_pszCurrentDir);
PathStripPath(pszDisplay);
SetRect(&rcDraw, nLeft, 3, nRight, 3+19);
::DrawText(viewInfo->Canvas->Handle, pszDisplay, -1, &rcDraw,
DT_SINGLELINE | DT_LEFT | DT_NOPREFIX | DT_END_ELLIPSIS | DT_NOCLIP);
// Display current file infos
if (GDGetFocused(pGdrec)) {
viewInfo->Canvas->Font->Name = "Verdana";
viewInfo->Canvas->Font->Size = 8;
_tcscpy(pszDisplay, pGdrec->m_sFullPath.c_str());
PathStripPath(pszDisplay);
SetRect(&rcDraw, nLeft+m_dwShlIconLarge+2, 41, nRight, 41+nTextHeight);
::DrawText(viewInfo->Canvas->Handle, pszDisplay, -1, &rcDraw, //(ici) DT_PATH_ELLIPSIS
DT_SINGLELINE | DT_LEFT | DT_NOPREFIX | DT_END_ELLIPSIS | DT_NOCLIP);
viewInfo->Canvas->Font->Style = TFontStyles();
SetRect(&rcDraw, nLeft+m_dwShlIconLarge+2, 54, nRight, 54+nTextHeight);
::DrawText(viewInfo->Canvas->Handle, pGdrec->m_sTypeName.c_str(), -1, &rcDraw,
DT_SINGLELINE | DT_LEFT | DT_NOPREFIX | DT_END_ELLIPSIS | DT_NOCLIP);
...
}
delete [] pszDisplay;
} |
Partager