Der Button wird weiter unten angezeigt.
Wenn ich Zeit habe, werde ich es in PB konvertieren.
http://www.vbarchiv.net/archiv/tipp_308.html
Das sieht dann so aus:

Gruß Falko

Code: Alles auswählen
Picture1.Picture = LoadPicture(App.Path & _
"\Bildgrau.gif")ist kein Hexenwerk:weiß der der Geier, was der Befehl alles macht.Code: Alles auswählen
Picture1.Picture = LoadPicture(App.Path & "\Bildgrau.gif")
Code: Alles auswählen
BOOL CALLBACK OwnDrawProc(HWND hDlg, UINT message, WPARAM wParam,
LPARAM lParam)
{
HDC hdcMem;
LPDRAWITEMSTRUCT lpdis;
switch (message)
{
case WM_INITDIALOG:
// hinst, hbm1 and hbm2 are defined globally.
hbm1 = LoadBitmap((HANDLE) hinst, "OwnBit1");
hbm2 = LoadBitmap((HANDLE) hinst, "OwnBit2");
return TRUE;
case WM_DRAWITEM:
lpdis = (LPDRAWITEMSTRUCT) lParam;
hdcMem = CreateCompatibleDC(lpdis->hDC);
if (lpdis->itemState & ODS_SELECTED) // if selected
SelectObject(hdcMem, hbm2);
else
SelectObject(hdcMem, hbm1);
// Destination
StretchBlt(
lpdis->hDC, // destination DC
lpdis->rcItem.left, // x upper left
lpdis->rcItem.top, // y upper left
// The next two lines specify the width and
// height.
lpdis->rcItem.right - lpdis->rcItem.left,
lpdis->rcItem.bottom - lpdis->rcItem.top,
hdcMem, // source device context
0, 0, // x and y upper left
32, // source bitmap width
32, // source bitmap height
SRCCOPY); // raster operation
DeleteDC(hdcMem);
return TRUE;
case WM_COMMAND:
if (wParam == IDOK
|| wParam == IDCANCEL)
{
EndDialog(hDlg, TRUE);
return TRUE;
}
if (HIWORD(wParam) == BN_CLICKED)
{
switch (LOWORD(wParam))
{
case IDC_OWNERDRAW:
// application-defined processing
break;
}
}
break;
case WM_DESTROY:
DeleteObject(hbm1); // delete bitmaps
DeleteObject(hbm2);
break;
}
return FALSE;
UNREFERENCED_PARAMETER(lParam);
}
Code: Alles auswählen
;Draw Image und Text im Button
;written by Falko 2005
;
;http://www.iconarchive.com/icon/art/gortsiconsvol1_by_gort/Rojo.ico
;
;TextStructure
Trect.RECT
Trect\left =38 ;X-linke obere Ecke
Trect\top =12 ;Y-linke obere Ecke
Trect\right =80 ;X-rechte untere Ecke
Trect\bottom =25 ;Y-rechte untere Ecke
If OpenWindow(0,100,100,400,200,#PB_Window_SystemMenu,"Button")And CreateGadgetList(WindowID(0))
Picture1 = LoadImage( 1,"Rojo.ico") ; Hier ein Grafik.ico 32x32 einfügen
dc=ButtonGadget(2, 10,10,80,40,"")
HDC=GetDC_(dc)
SetBkMode_(HDC,#TRANSPARENT) ; Hintergrund Transparent
SetTextColor_(HDC,$FF0000) ; Textfarbe
Repeat
DrawText_(HDC,"FALKO",-1,Trect,#DT_SINGLELINE) ;Text zeichnen
DrawIcon_(HDC,3,3,Picture1) ;Icon zeichnen
Until WaitWindowEvent()=#PB_Event_CloseWindow
CloseWindow(0)
EndIfwenn du dich noch ca 2 - 3 tage gedulten kannst wirds da ne lib von mir geben die unter anderem das kann. wirst du dann auch auf purearea.net im showcase finden.Donald hat geschrieben:Hi,
gibt es eine Routine mit der man in einem Button ein Icon und einen
Text (String) einblenden kann.
Wahlweise:
Icon links - Text rechts und umgekehrt ?
Icon oben - Text unten und umgekehrt ?
Hi nicolaus,nicolaus hat geschrieben: wenn du dich noch ca 2 - 3 tage gedulten kannst wirds da ne lib von mir geben die unter anderem das kann. wirst du dann auch auf purearea.net im showcase finden.