<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problem mit Zeichnen(GDI+)]]></title><description><![CDATA[<p>Hallo ich hab ein problem mit der GDI+:<br />
Wenn ich etwas zeichnen will bleibt der Bildschirm weiÃŸ</p>
<pre><code class="language-cpp">#define WIN32_LEAN_AND_MEAN
#include &lt;windows.h&gt;
#include &lt;ole2.h&gt;
#include &lt;gdiplus.h&gt;

#pragma comment(lib, &quot;kernel32.lib&quot;)
#pragma comment(lib, &quot;user32.lib&quot;)
#pragma comment(lib, &quot;gdiplus.lib&quot;)
#define _T(x) TEXT(x)

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

INT CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCommandLine, INT nCmdShow)
{
   WNDCLASSEX wndc = {0};
   wndc.cbSize = sizeof(wndc);
   wndc.lpszClassName = _T(&quot;TestClass&quot;);
   wndc.lpfnWndProc = WndProc;
   wndc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
   wndc.hIcon = LoadIcon(0, IDI_APPLICATION);
    wndc.hCursor = LoadCursor (NULL, IDC_ARROW);

   ULONG ul1;
   Gdiplus::GdiplusStartupInput gsi;
   gsi.GdiplusVersion = 1;
   Gdiplus::GdiplusStartupOutput gso = {0};
   Gdiplus::GdiplusStartup(&amp;ul1, &amp;gsi, &amp;gso);

   RegisterClassEx(&amp;wndc);
   HWND hWnd = CreateWindowEx(WS_EX_APPWINDOW, _T(&quot;TestClass&quot;), _T(&quot;TestWindow&quot;), WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, CW_USEDEFAULT, 600, 600, NULL, NULL, NULL, NULL);
   ShowWindow(hWnd, SW_NORMAL);
   InvalidateRect(hWnd, NULL, TRUE);
   UpdateWindow(hWnd);
   MSG msg;
   while(GetMessage(&amp;msg, NULL, 0, 0))
   {
      TranslateMessage(&amp;msg);
      DispatchMessage(&amp;msg);
   }
   UnregisterClass(wndc.lpszClassName, NULL);

   Gdiplus::GdiplusShutdown(ul1);
   return 0;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
   using namespace Gdiplus;
   switch(msg)
   {
   case WM_CLOSE:
      DestroyWindow(hWnd);
      return 0;
   case WM_QUIT:
      PostQuitMessage(0);
      return 0;
   case WM_PAINT:
      {
         PAINTSTRUCT ps;
         BeginPaint(hWnd, &amp;ps);

         Graphics* gr = new Graphics(hWnd);
         SolidBrush* br1 = new SolidBrush(Color::Red);
         SolidBrush* br2 = new SolidBrush(Color::Green);
         SolidBrush* br3 = new SolidBrush(Color::Yellow);
         SolidBrush* br4 = new SolidBrush(Color::Blue);
         gr-&gt;Clear(Color::White);
         // Nummer 1
         Rect rects1[] =
         {
            Rect(25, 25, 25, 150),
            Rect(50, 25, 50, 25),
            Rect(75, 50, 25, 50),
            Rect(50, 75, 25, 25)
         };
         gr-&gt;FillRectangles(br1, rects1, sizeof(rects1) / sizeof(Rect));
         // Nummer 2
         Rect rects2[] =
         {
            Rect(125, 25, 25, 25),
            Rect(125, 75, 25, 100)
         };
         gr-&gt;FillRectangles(br2, rects2, sizeof(rects2) / sizeof(Rect));
         // Nummer 3
         Rect rects3[] =
         {
            Rect(175, 25, 25, 100),
            Rect(200, 125, 25, 50),
            Rect(225, 25, 25, 100)
         };
         gr-&gt;FillRectangles(br3, rects3, sizeof(rects3) / sizeof(Rect));
         // Nummer 4
         Rect rects4[] =
         {
            Rect(275, 25, 25, 150)
         };
         gr-&gt;FillRectangles(br4, rects4, sizeof(rects4) / sizeof(Rect));
         PointF pts[] =
         {
            PointF(300, 75),
            PointF(300, 100),
            PointF(350, 50),
            PointF(350, 25)
         };
         gr-&gt;FillPolygon(br4, pts, sizeof(pts) / sizeof(PointF));
         pts[0].Y += 25;
         pts[1].Y += 25;
         pts[2].Y += 125;
         pts[3].Y += 125;
         gr-&gt;FillPolygon(br4, pts, sizeof(pts) / sizeof(PointF));
         // Nummer 5
         RectF rects5[] =
         {
            RectF(375, 25, 25, 150),
            RectF(400, 25, 50, 25),
            RectF(400, 87.5f, 50, 25),
            RectF(400, 150, 50, 25)
         };
         gr-&gt;FillRectangles(br1, rects5, sizeof(rects1) / sizeof(Rect));

         // Nummer 6
         Rect rects6[] =
         {
            Rect(25, 200, 25, 150)
         };
         gr-&gt;FillRectangles(br2, rects6, sizeof(rects4) / sizeof(Rect));
         for(int i = 0; i &lt; 4; i++)
            pts[i].Y += 175, pts[i].X -= 250;
         gr-&gt;FillPolygon(br2, pts, sizeof(pts) / sizeof(PointF));
         pts[0].Y -= 25;
         pts[1].Y -= 25;
         pts[2].Y -= 125;
         pts[3].Y -= 125;
         gr-&gt;FillPolygon(br2, pts, sizeof(pts) / sizeof(PointF));
         // Nummer 7
         Rect rects7[] =
         {
            Rect(125, 200, 25, 150),
            Rect(150, 200, 25, 25),
            Rect(175, 200, 25, 150),
            Rect(150, 250, 25, 25)
         };
         gr-&gt;FillRectangles(br3, rects7, sizeof(rects7) / sizeof(Rect));
         // Nummer 8
         Rect rects8[] =
         {
            Rect(225, 200, 25, 150),
            Rect(300, 200, 25, 150)
         };
         gr-&gt;FillRectangles(br4, rects8, sizeof(rects8) / sizeof(Rect));
         PointF pts1[] =
         {
            PointF(250, 200),
            PointF(300, 300),
            PointF(300, 350),
            PointF(250, 250)
         };
         gr-&gt;FillPolygon(br4, pts1, sizeof(pts1) / sizeof(PointF));
         // Nummer 9
         rects8[0].X += 125;
         rects8[1].X += 125;
         for(int i = 0; i &lt; 4; i++)
            pts1[i].X += 125;
         gr-&gt;FillRectangles(br4, rects8, sizeof(rects8) / sizeof(Rect));
         gr-&gt;FillPolygon(br4, pts1, sizeof(pts1) / sizeof(PointF));

         // Nummer 10
         rects8[0].X = 25;
         rects8[1].X = 100;
         rects8[0].Y += 175;
         rects8[1].Y += 175;
         for(int i = 0; i &lt; 4; i++)
            pts1[i].X -= 325, pts1[i].Y += 175;
         gr-&gt;FillRectangles(br1, rects8, sizeof(rects8) / sizeof(Rect));
         gr-&gt;FillPolygon(br1, pts1, sizeof(pts1) / sizeof(PointF));
         // Nummer 11
         rects2[0].X = 150;
         rects2[1].X = 150;
         rects2[0].Y += 350;
         rects2[1].Y += 350;
         gr-&gt;FillRectangles(br2, rects2, sizeof(rects2) / sizeof(Rect));
         // Nummer 12
         RectF rects9[] =
         {
            RectF(200, 375, 25, 150),
            RectF(225, 375, 50, 25),
            RectF(225, 500, 50, 25)
         };
         gr-&gt;FillRectangles(br3, rects9, sizeof(rects9) / sizeof(Rect));
         // Nummer 13
         RectF rects10[] =
         {
            RectF(300, 375, 25, 150),
            RectF(325, 437, 25, 25),
            RectF(350, 375, 25, 150)
         };
         gr-&gt;FillRectangles(br4, rects10, sizeof(rects9) / sizeof(Rect));
         // Nummer 14
         RectF rects11[] =
         {
            RectF(400, 375, 75, 25),
            RectF(425, 375, 25, 150)
         };
         gr-&gt;FillRectangles(br1, rects11, sizeof(rects11) / sizeof(Rect));
         // Nummer 15
         RectF rects12[] =
         {
            RectF(500, 375, 75, 25),
            RectF(500, 400, 25, 50),
            RectF(525, 425, 50, 25),
            RectF(550, 450, 25, 50),
            RectF(500, 500, 75, 25)
         };
         gr-&gt;FillRectangles(br2, rects12, sizeof(rects12) / sizeof(Rect));

         delete gr;
         delete br1;
         delete br2;
         delete br3;
         delete br4;

         EndPaint(hWnd, &amp;ps);
         return 0;
      }
   default:
      break;
   }
   return DefWindowProc(hWnd, msg, wParam, lParam);
}
</code></pre>
<p>Ich bin fÃ¼r jede hilfe dankbar</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/219730/problem-mit-zeichnen-gdi</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 07:24:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/219730.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 06 Aug 2008 19:34:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit Zeichnen(GDI+) on Wed, 06 Aug 2008 19:34:44 GMT]]></title><description><![CDATA[<p>Hallo ich hab ein problem mit der GDI+:<br />
Wenn ich etwas zeichnen will bleibt der Bildschirm weiÃŸ</p>
<pre><code class="language-cpp">#define WIN32_LEAN_AND_MEAN
#include &lt;windows.h&gt;
#include &lt;ole2.h&gt;
#include &lt;gdiplus.h&gt;

#pragma comment(lib, &quot;kernel32.lib&quot;)
#pragma comment(lib, &quot;user32.lib&quot;)
#pragma comment(lib, &quot;gdiplus.lib&quot;)
#define _T(x) TEXT(x)

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

INT CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCommandLine, INT nCmdShow)
{
   WNDCLASSEX wndc = {0};
   wndc.cbSize = sizeof(wndc);
   wndc.lpszClassName = _T(&quot;TestClass&quot;);
   wndc.lpfnWndProc = WndProc;
   wndc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
   wndc.hIcon = LoadIcon(0, IDI_APPLICATION);
    wndc.hCursor = LoadCursor (NULL, IDC_ARROW);

   ULONG ul1;
   Gdiplus::GdiplusStartupInput gsi;
   gsi.GdiplusVersion = 1;
   Gdiplus::GdiplusStartupOutput gso = {0};
   Gdiplus::GdiplusStartup(&amp;ul1, &amp;gsi, &amp;gso);

   RegisterClassEx(&amp;wndc);
   HWND hWnd = CreateWindowEx(WS_EX_APPWINDOW, _T(&quot;TestClass&quot;), _T(&quot;TestWindow&quot;), WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, CW_USEDEFAULT, 600, 600, NULL, NULL, NULL, NULL);
   ShowWindow(hWnd, SW_NORMAL);
   InvalidateRect(hWnd, NULL, TRUE);
   UpdateWindow(hWnd);
   MSG msg;
   while(GetMessage(&amp;msg, NULL, 0, 0))
   {
      TranslateMessage(&amp;msg);
      DispatchMessage(&amp;msg);
   }
   UnregisterClass(wndc.lpszClassName, NULL);

   Gdiplus::GdiplusShutdown(ul1);
   return 0;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
   using namespace Gdiplus;
   switch(msg)
   {
   case WM_CLOSE:
      DestroyWindow(hWnd);
      return 0;
   case WM_QUIT:
      PostQuitMessage(0);
      return 0;
   case WM_PAINT:
      {
         PAINTSTRUCT ps;
         BeginPaint(hWnd, &amp;ps);

         Graphics* gr = new Graphics(hWnd);
         SolidBrush* br1 = new SolidBrush(Color::Red);
         SolidBrush* br2 = new SolidBrush(Color::Green);
         SolidBrush* br3 = new SolidBrush(Color::Yellow);
         SolidBrush* br4 = new SolidBrush(Color::Blue);
         gr-&gt;Clear(Color::White);
         // Nummer 1
         Rect rects1[] =
         {
            Rect(25, 25, 25, 150),
            Rect(50, 25, 50, 25),
            Rect(75, 50, 25, 50),
            Rect(50, 75, 25, 25)
         };
         gr-&gt;FillRectangles(br1, rects1, sizeof(rects1) / sizeof(Rect));
         // Nummer 2
         Rect rects2[] =
         {
            Rect(125, 25, 25, 25),
            Rect(125, 75, 25, 100)
         };
         gr-&gt;FillRectangles(br2, rects2, sizeof(rects2) / sizeof(Rect));
         // Nummer 3
         Rect rects3[] =
         {
            Rect(175, 25, 25, 100),
            Rect(200, 125, 25, 50),
            Rect(225, 25, 25, 100)
         };
         gr-&gt;FillRectangles(br3, rects3, sizeof(rects3) / sizeof(Rect));
         // Nummer 4
         Rect rects4[] =
         {
            Rect(275, 25, 25, 150)
         };
         gr-&gt;FillRectangles(br4, rects4, sizeof(rects4) / sizeof(Rect));
         PointF pts[] =
         {
            PointF(300, 75),
            PointF(300, 100),
            PointF(350, 50),
            PointF(350, 25)
         };
         gr-&gt;FillPolygon(br4, pts, sizeof(pts) / sizeof(PointF));
         pts[0].Y += 25;
         pts[1].Y += 25;
         pts[2].Y += 125;
         pts[3].Y += 125;
         gr-&gt;FillPolygon(br4, pts, sizeof(pts) / sizeof(PointF));
         // Nummer 5
         RectF rects5[] =
         {
            RectF(375, 25, 25, 150),
            RectF(400, 25, 50, 25),
            RectF(400, 87.5f, 50, 25),
            RectF(400, 150, 50, 25)
         };
         gr-&gt;FillRectangles(br1, rects5, sizeof(rects1) / sizeof(Rect));

         // Nummer 6
         Rect rects6[] =
         {
            Rect(25, 200, 25, 150)
         };
         gr-&gt;FillRectangles(br2, rects6, sizeof(rects4) / sizeof(Rect));
         for(int i = 0; i &lt; 4; i++)
            pts[i].Y += 175, pts[i].X -= 250;
         gr-&gt;FillPolygon(br2, pts, sizeof(pts) / sizeof(PointF));
         pts[0].Y -= 25;
         pts[1].Y -= 25;
         pts[2].Y -= 125;
         pts[3].Y -= 125;
         gr-&gt;FillPolygon(br2, pts, sizeof(pts) / sizeof(PointF));
         // Nummer 7
         Rect rects7[] =
         {
            Rect(125, 200, 25, 150),
            Rect(150, 200, 25, 25),
            Rect(175, 200, 25, 150),
            Rect(150, 250, 25, 25)
         };
         gr-&gt;FillRectangles(br3, rects7, sizeof(rects7) / sizeof(Rect));
         // Nummer 8
         Rect rects8[] =
         {
            Rect(225, 200, 25, 150),
            Rect(300, 200, 25, 150)
         };
         gr-&gt;FillRectangles(br4, rects8, sizeof(rects8) / sizeof(Rect));
         PointF pts1[] =
         {
            PointF(250, 200),
            PointF(300, 300),
            PointF(300, 350),
            PointF(250, 250)
         };
         gr-&gt;FillPolygon(br4, pts1, sizeof(pts1) / sizeof(PointF));
         // Nummer 9
         rects8[0].X += 125;
         rects8[1].X += 125;
         for(int i = 0; i &lt; 4; i++)
            pts1[i].X += 125;
         gr-&gt;FillRectangles(br4, rects8, sizeof(rects8) / sizeof(Rect));
         gr-&gt;FillPolygon(br4, pts1, sizeof(pts1) / sizeof(PointF));

         // Nummer 10
         rects8[0].X = 25;
         rects8[1].X = 100;
         rects8[0].Y += 175;
         rects8[1].Y += 175;
         for(int i = 0; i &lt; 4; i++)
            pts1[i].X -= 325, pts1[i].Y += 175;
         gr-&gt;FillRectangles(br1, rects8, sizeof(rects8) / sizeof(Rect));
         gr-&gt;FillPolygon(br1, pts1, sizeof(pts1) / sizeof(PointF));
         // Nummer 11
         rects2[0].X = 150;
         rects2[1].X = 150;
         rects2[0].Y += 350;
         rects2[1].Y += 350;
         gr-&gt;FillRectangles(br2, rects2, sizeof(rects2) / sizeof(Rect));
         // Nummer 12
         RectF rects9[] =
         {
            RectF(200, 375, 25, 150),
            RectF(225, 375, 50, 25),
            RectF(225, 500, 50, 25)
         };
         gr-&gt;FillRectangles(br3, rects9, sizeof(rects9) / sizeof(Rect));
         // Nummer 13
         RectF rects10[] =
         {
            RectF(300, 375, 25, 150),
            RectF(325, 437, 25, 25),
            RectF(350, 375, 25, 150)
         };
         gr-&gt;FillRectangles(br4, rects10, sizeof(rects9) / sizeof(Rect));
         // Nummer 14
         RectF rects11[] =
         {
            RectF(400, 375, 75, 25),
            RectF(425, 375, 25, 150)
         };
         gr-&gt;FillRectangles(br1, rects11, sizeof(rects11) / sizeof(Rect));
         // Nummer 15
         RectF rects12[] =
         {
            RectF(500, 375, 75, 25),
            RectF(500, 400, 25, 50),
            RectF(525, 425, 50, 25),
            RectF(550, 450, 25, 50),
            RectF(500, 500, 75, 25)
         };
         gr-&gt;FillRectangles(br2, rects12, sizeof(rects12) / sizeof(Rect));

         delete gr;
         delete br1;
         delete br2;
         delete br3;
         delete br4;

         EndPaint(hWnd, &amp;ps);
         return 0;
      }
   default:
      break;
   }
   return DefWindowProc(hWnd, msg, wParam, lParam);
}
</code></pre>
<p>Ich bin fÃ¼r jede hilfe dankbar</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1560443</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1560443</guid><dc:creator><![CDATA[katmandu_]]></dc:creator><pubDate>Wed, 06 Aug 2008 19:34:44 GMT</pubDate></item></channel></rss>