Je veux mettre un static sur une texture de fond et tout ceci dans une boîte de dialogue. Quelque soit la méthode employée je n'arrive pas à rendre transparent ce static. Ci-dessous le source C++ et la ressource.
Merci.
C++ :
#include <windows.h>
#include "resource.h"
// Variables globales. -------------------------------------------------------
HINSTANCE hInst; // L'instance courante.
// Les prototypes. ------------------------------------------------------------
LRESULT CALLBACK DlgMainProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
hInst = hInstance ;
DialogBoxParam(hInst, (LPCTSTR)IDD_DLGMAIN, 0, (DLGPROC)DlgMainProc, 0);
return 0;
}
// Gestion des messages.
// ----------------------------------------------------------------------------
LRESULT CALLBACK DlgMainProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
//
// Traitement des messsages envoyés par la boite de dialogue IDD_DLGMAIN
// ----------------------------------------------------------------------------
// Les déclarations. ----------------------------------------------------------
static HBITMAP hbmp; // handle de l'image bitmap à afficher.
static HDC hdcCompat; // DC pour copier l'image.
HDC hdc; // device context (DC) pour window
PAINTSTRUCT ps; // Structure pour BeginPaint and EndPaint
switch (message) {
case WM_INITDIALOG : {
hbmp = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_MOSAIC));
// Crée un device context (DC) pout l'image bitmap.
// L'image bitmap est copiée depuis ce DC vers le DC de la fenêtre.
hdc = GetDC(hDlg);
hdcCompat = CreateCompatibleDC(hdc);
SelectObject(hdcCompat, hbmp);
return TRUE ;
}
case WM_PAINT : {
BeginPaint(hDlg, &ps);
StretchBlt( ps.hdc, // HDC de destination.
0, // X-Coord. destination.
0, // Y-Coord. destination.
72, // Largeur de destination.
72, // Hauteur de destination.
hdcCompat, // Handle de la source.
0,
0,
72,
72,
SRCCOPY);
EndPaint(hDlg, &ps);
}
case WM_COMMAND : {
if (LOWORD(wParam) == IDOK) {
return TRUE ;
}
if (LOWORD(wParam) == IDCANCEL) {
EndDialog(hDlg, LOWORD(wParam));
return TRUE ;
}
break ;
}
default : {
return FALSE ;
}
}
return FALSE ;
}
La resource :
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DLGMAIN DIALOGEX 0, 0, 248, 95
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,191,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,191,24,50,14
CONTROL "Static",IDC_STATIC,"Static",SS_SIMPLE | SS_CENTERIMAGE |
WS_GROUP,7,7,102,18,WS_EX_TRANSPARENT
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DLGMAIN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 241
TOPMARGIN, 7
BOTTOMMARGIN, 88
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_MOSAIC BITMAP DISCARDABLE "Login_Mosaique.bmp"
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED