Dialog OnPaint Picture Control
-
Halle Zusammen,
ich habe wiedermal ein Problem

Ich habe einen Dialog in dem ich ein Bild anzeigen will (Picture Control).
Sobald der Dialog aufgeht möchte ich das Bild schon sehen.Nun ist es so, dass ich (beim debuggen) das Bild zwar sehe, und die restlichen Elemete (Editbox,...) nicht - aber sobald dann die OnPaint Methode aufgerufen wird, sehe ich alle Elemente des Dialogs, aber das Picture Control Bild wurde grau übermalt.
Ich habe eine Methode draw() welche mein Bild zeichnet.
BOOL OnInitDialog() { // ... draw(); } void draw() { // ... CDC * pDC = m_pStatic->GetDC(); // Picture Control Static // ... }Ich ahbe auch schon das hier gefunden, hilft allerdings auch nichts
void OnPaint() { CPaintDC dc(this); // device context for painting draw(&dc); } void draw(CDC * pDC) { // ... // zeiche mit pDC }Bin dankbar für jeden tipp
Danke schön :p
-
Lässt du in OnInitDialog() den Dialog schon anzeigen, mit ShowWindow() oder ähnliches? Also bevor du draw() aufrufst? Weil der Dialog erst nach OnInitDialog() angezeigt wird. Die OnPaint() kannst du meiner Meinung nach komplett aus deinem Projekt entfernen. Das ist meiner Meinung nach veraltet.
Ich würde das so machen:- OnPaint() komplett entfernen
- global const UINT WM_ON_APP_STARTUP = WM_APP + 1; deklarieren
- in OnInitDialog() PostMessage(WM_ON_APP_STARTUP); hinzufügen
- dann eine Fkt. OnAppStartup() bauen wo das Bild gezeichnet wirdso mach ich das meistens.