This week we we're asked to modify an empty windows application so that it would then display some text and to draw a line.
It was some simple code that had to be added into the the OnPaint void to get them both working.
To get it to create a line the code needed was
//line
Pen pen(Color(255, 0, 0, 255));
graphics.DrawLine(&pen, 0, 0, 200, 100);
and then to create text on the screen as well it meant having to add this code as well,
SolidBrush brush(Color(255, 0, 0, 255));
FontFamily fontFamily(L"Times New Roman");
Font font(&fontFamily, 24, FontStyleRegular, UnitPixel);
PointF pointF(10.0f, 20.0f);
graphics.DrawString(L"My World Soon!", -1, &font, pointF, &brush);
The finished product of both of these is the message "My World Soon" with a diaganal blue line going through in.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment