Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Ich möchte auf einem Dialog ein BMP-Bild (256 Farbe) als Hintergrund darstellen.

Ich habe folgenden Code ausprobiert, ohne Erfolg.

CWnd* pWnd = GetDlgItem (IDD_DIALOG);

CPaintDC dc(pWnd);

CDC pControlDC;

CBitmap bit;

bit.LoadBitmap(IDB_HINTERGRUND);

pControlDC.CreateCompatibleDC(&dc);

pControlDC.SelectObject(&bit);

dc.BitBlt(0,0,100,50,&pControlDC,0,0,SRCCOPY);

Was ist daran falsch?

Der Compiler meldet keinen Fehler. Die Anwendung auf dem PocketPC zeigt aber kein Bild.

Diesen Code habe ich in OnInitDialog() eingefügt.

Den Code selbst habe ich aus irgend einem Buch entnommen. Weiß nicht mehr welches.

Mehr kann ich dazu nicht sagen.

Aber wenn es andere Möglichkeiten gibt werden ich auch glücklich sein :) .

Die MSDN Library sagt zu CPaintDC:

A CPaintDC object can only be used when responding to a WM_PAINT message, usually in your OnPaint message-handler method.

Das ganze muss also in OnPaint stehen.

Was ist IDD_DIALOG?

Und nochmal: Prüf die Rückgabewerte der Funktionen!

Was liefern GetDlgItem, LoadBitmap und BitBlt zurück? Das sind die absoluten Grundlagen der Fehlersuche.

Ich habs ausprobiert.

Wie du schon sagtest muss folgender Code in WM_PAINT Funktion stehen:

CDC pControlDC;

CBitmap bit;

bit.LoadBitmap(IDB_HINTERGRUNDBILD);

pControlDC.CreateCompatibleDC(&dc);

pControlDC.SelectObject(&bit);

dc.BitBlt(0,0,200,100,&pControlDC,0,0,SRCCOPY);

Dann wird es funktionieren! :)

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.