Click here to Skip to main content
15,913,584 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Changing the resolution dynamically Pin
David Crow1-Oct-03 7:27
David Crow1-Oct-03 7:27 
GeneralRe: Changing the resolution dynamically Pin
Bernhard1-Oct-03 19:11
Bernhard1-Oct-03 19:11 
GeneralRe: Changing the resolution dynamically Pin
Anthony_Yio1-Oct-03 15:28
Anthony_Yio1-Oct-03 15:28 
GeneralGDI+ font and scalable graphics Pin
Member 55064430-Sep-03 22:50
Member 55064430-Sep-03 22:50 
GeneralRe: GDI+ font and scalable graphics Pin
arturapps1-Oct-03 2:58
arturapps1-Oct-03 2:58 
GeneralRe: GDI+ font and scalable graphics Pin
Member 5506441-Oct-03 3:09
Member 5506441-Oct-03 3:09 
GeneralRe: GDI+ font and scalable graphics Pin
arturapps1-Oct-03 3:23
arturapps1-Oct-03 3:23 
GeneralRe: GDI+ font and scalable graphics Pin
Member 5506441-Oct-03 3:26
Member 5506441-Oct-03 3:26 
here is the code used;

void CChildView::OnPaint()
{
CPaintDC dc(this); // device context for painting

Matrix myMatrix;
myMatrix.Translate(m_cx / 2.0f + m_fOffsetX, m_cy / 2.0f + m_fOffsetY);
myMatrix.Scale(m_fZoom, m_fZoom) ;
graphics.SetTransform(&myMatrix);

// Create a string.
WCHAR string[256];
wcscpy(string, L"These days, products with VIA's new PT880 and the SiS 655FX are becoming available");

// Initialize arguments.
FontFamily fontFamily(L"Arial");
Font myFont(&fontFamily, 14, FontStyleRegular, UnitPoint);

// the hardcoded coords come from MeasureString();
PointF origin(-753 / 2.0f, 0.0f);
SolidBrush blackBrush(Color(255, 0, 0, 0));
Status status = graphics.DrawString(string, (INT)wcslen(string), &myFont, origin, &blackBrush);

RectF boundingBox;
graphics.MeasureString(string, (INT)wcslen(string), &myFont, origin, &boundingBox);

// Get the height of myFont.
REAL height = myFont.GetHeight(&graphics);

wcscpy(string, L"et blablabla...");
origin.Y += height;
status = graphics.DrawString(string, (INT)wcslen(string), &myFont, origin, &blackBrush);

// here we draw a rectangle around the text, the values come from the initial MeasureString()
// Create a Pen object.
Pen blackPen(Color(255, 0, 0, 0), 1);

// Draw the rectangle.
// the hardcoded coords come from MeasureString();
graphics.DrawRectangle(&blackPen, -753 / 2, 0, 753, 23);
}

GeneralRe: GDI+ font and scalable graphics Pin
Joel Lucsy1-Oct-03 3:40
Joel Lucsy1-Oct-03 3:40 
GeneralCommand Line to Edit Control Pin
skallestad30-Sep-03 22:18
skallestad30-Sep-03 22:18 
GeneralRe: Command Line to Edit Control Pin
David Crow1-Oct-03 4:14
David Crow1-Oct-03 4:14 
GeneralThanks! Pin
skallestad1-Oct-03 7:44
skallestad1-Oct-03 7:44 
GeneralCTreeCtrl and MFC Dialog Pin
hph30-Sep-03 21:09
hph30-Sep-03 21:09 
GeneralRe: CTreeCtrl and MFC Dialog Pin
hph1-Oct-03 2:09
hph1-Oct-03 2:09 
GeneralRe: CTreeCtrl and MFC Dialog Pin
Mike Dimmick1-Oct-03 2:09
Mike Dimmick1-Oct-03 2:09 
GeneralRe: CTreeCtrl and MFC Dialog Pin
Michael Dunn1-Oct-03 5:19
sitebuilderMichael Dunn1-Oct-03 5:19 
GeneralKilling program execution Pin
esepich30-Sep-03 18:32
esepich30-Sep-03 18:32 
GeneralRe: Killing program execution Pin
keegan30-Sep-03 19:06
keegan30-Sep-03 19:06 
GeneralRe: Killing program execution Pin
Mike Dimmick1-Oct-03 2:12
Mike Dimmick1-Oct-03 2:12 
GeneralRe: Killing program execution Pin
Arjan Schouten1-Oct-03 4:33
Arjan Schouten1-Oct-03 4:33 
GeneralCEdit and Regions Pin
Fozed30-Sep-03 17:48
Fozed30-Sep-03 17:48 
GeneralPassing a vector of pointers Pin
mcoloney30-Sep-03 16:06
mcoloney30-Sep-03 16:06 
GeneralRe: Passing a vector of pointers Pin
Dave Bryant30-Sep-03 16:16
Dave Bryant30-Sep-03 16:16 
GeneralRe: Passing a vector of pointers Pin
mcoloney30-Sep-03 16:38
mcoloney30-Sep-03 16:38 
GeneralRe: Passing a vector of pointers Pin
Dave Bryant30-Sep-03 16:43
Dave Bryant30-Sep-03 16:43 

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.