CButton::Create



  • Hallo,
    ich versuche in einem Dialog einen neuen Button einzufügen und gehe vor wie überall in der Hilfe beschrieben :

    CButton myButton1;
    // Create a push button.
    myButton1.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,
    CRect(10,10,100,30), this , 1);

    Als Pameter 4 muss ich einen "CWnd *pPatentWnd" angeben und hier weiß ich nicht weiter. Mit "this" funktioniert es bei mir nicht.

    Kann mir einer helfen???

    Danke
    Jürgen



  • Wo (in welcher Funktion) steht denn dieser Code?



  • Habt den Fehler Fehler jetzt endlich selber gefunden. Hatte das CButton Objekt dierekt mit in der Funktion OnPaint deklariert, also wurde es sofort nach dem Ende von OnPaint auch wieder gelöscht.

    Aber ich habe jetzt eine neue Frage :
    Kann ich die Position und die Größe von dem Button nachträglich ändern ?



  • cbutton is wie jedes control ein cwnd

    also

    Window Size and Position

    GetWindowPlacement Retrieves the show state and the normal (restored), minimized, and maximized positions of a window.
    SetWindowPlacement Sets the show state and the normal (restored), minimized, and maximized positions for a window.
    GetWindowRgn Retrieves a copy of the window region of a window.
    SetWindowRgn Sets the region of a window.
    IsIconic Determines whether CWnd is minimized (iconic).
    IsZoomed Determines whether CWnd is maximized.
    MoveWindow Changes the position and dimensions of CWnd.
    SetWindowPos Changes the size, position, and ordering of child, pop-up, and top-level windows.
    ArrangeIconicWindows Arranges all the minimized (iconic) child windows.
    BringWindowToTop Brings CWnd to the top of a stack of overlapping windows.
    GetWindowRect Gets the screen coordinates of CWnd.
    GetClientRect Gets the dimensions of the CWnd client area.



  • Danke, es läuft jetzt


Anmelden zum Antworten