MCPcopy Create free account
hub / github.com/TortoiseGit/TortoiseGit / GetTextSize

Method GetTextSize

src/Utils/MiscUI/MessageBox.cpp:791–814  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

789}
790
791CSize CMessageBox::GetTextSize(const CString& str)
792{
793 CRect rect;
794 GetWindowRect(&rect);
795
796 CDC * pDC = GetDC();
797
798 CDC memDC;
799 CBitmap bitmap;
800 memDC.CreateCompatibleDC(pDC);
801 bitmap.CreateCompatibleBitmap(pDC, rect.Width(), rect.Height());
802 CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
803
804 //get the minimum size of the rectangle of the tooltip
805 CSize sz = DrawText(&memDC, rect, str, m_LogFont, TRUE);
806
807 memDC.SelectObject(pOldBitmap);
808 memDC.DeleteDC();
809 bitmap.DeleteObject();
810
811 ReleaseDC(pDC);
812
813 return sz;
814}
815
816CSize CMessageBox::GetIconSize(HICON hIcon)
817{

Callers

nothing calls this directly

Calls 8

DrawTextFunction · 0.85
CreateCompatibleDCMethod · 0.80
SelectObjectMethod · 0.80
DeleteDCMethod · 0.80
WidthMethod · 0.45
HeightMethod · 0.45
DeleteObjectMethod · 0.45

Tested by

no test coverage detected