GDI+ graphics::Fill* - Methoden Problem



  • hallo allerseits!

    habe seitdem ich gdi+ probiert habe das Problem dass keine der Fill-Methoden funktioniert...

    alle draw etc. methoden funktionieren problemlos.

    fehler:"Keine Instanz von überladene Funktion "GdiPlus::Graphics::FillRectangle" stimmt mit der Argumentenliste überein

    ich benutze vs 2010

    danke schon im voraus!



  • Kristallkugel?



  • // DesktopPainting.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
    //
    
    #include "stdafx.h"
    #include <iostream>
    #include <windows.h>  // für die GDI+ wird auch windows.h benötigt
    #include <gdiplus.h>  // dieser Header ist für alle GDI+ Klassen, Funktionen usw.
    #include<conio.h>
    #pragma comment(lib, "gdiplus.lib") 
    
    using namespace Gdiplus; // 01
    using namespace std;
    
    HDC hdc=GetWindowDC(GetDesktopWindow());
    //bildschirmauflösung
    size_t width = (size_t)GetSystemMetrics(SM_CXSCREEN);
    size_t height = (size_t)GetSystemMetrics(SM_CYSCREEN);
    
    void paint(HDC hdc) {
       Graphics graphics(hdc);    // 04
       Pen      pen(Color(255, 0, 0, 255));   // 05
       pen.SetColor(Color::Black);
       graphics.Clear(Color::Blue);
       //hier wäre graphics.FillRectangle(0,0,300,300);
    }
    
    int WINAPI WinMain()
    {
    	cout<<width<<":"<<height;
       GdiplusStartupInput gdiplusStartupInput;
       ULONG_PTR           gdiplusToken;  
       GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); // 02
       int i=0;
       while(i<100){
    	   Sleep(50);
    	   paint(hdc);
    	   i++;
       }
    }
    


  • einfach mal eine Blick in die Dokumentation werfen - dann wird dir auch klar, warum du FillRectangle so nicht verwenden kannst.



  • entschuligung für meine dummheit. hab mir grad die msdn durchgelesen und finde nichts dazu -.-





  • ok thx. habs jz selbst herausgefunden...
    dachte mir dass pen automatisch in brush konvertiert wird...
    derweil ist das was andres


Anmelden zum Antworten