Ребята привет. Почему через GDI+ не получается рисовать на форме? Исходник: http://ifolder.ru/5909072| Код | void CRelis_1Dlg::OnBnClickedButton1() { // TODO: Add your control notification handler code here using namespace Gdiplus;
CPaintDC dc(this); Graphics graphics(dc.m_hDC);
// Pen can also be constructed using a brush or another pen. There is a second parameter - a width which defaults to 1.0f Pen blue (Color(255, 0, 0, 255)); Pen red (Color(255, 255, 0, 0));
int y = 256;
int x; for (x = 0; x < 256; x += 5) { graphics.DrawLine(&blue, 0, y, x, 0); graphics.DrawLine(&red, 256, x, y, 256); y -= 5; }
for (y = 0; y < 256; y++) { Pen pen(Color(y, 0, 255,0)); // A green pen with shifting alpha graphics.DrawLine(&pen, 0, y, 256, y); // The sleep is to slow it down so you can watch the effect Sleep(1); }
for (x = 0; x < 256; x++) { Pen pen(Color(x, 255, 0, 255)); // A green pen with shifting alpha graphics.DrawLine(&pen, x, 100, x, 200); // The sleep is to slow it down so you can watch the effect Sleep(1); } }
|
|