changing what a pushbutton looks like
-
can someone plz give me a tutorial on how to change a pushbuttons appearance using GDI. i'd like to do it completely in Win32/SDK also Thanks In Advance, Tim Zorn
-
-
What did you want help with ? Christian Graus - Microsoft MVP - C++
-
What did you want help with ? Christian Graus - Microsoft MVP - C++
this is my code for useing ADO link Paradox DataBase. but it throw wrong so maybe you can help me. i will greatly appreciated BOOL CTM21App::InitInstance() { CString connectsource; _ConnectionPtr pCon; AfxOleInit(); AfxEnableControlContainer(); pCon.CreateInstance(__uuidof(Connection)); try { connectsource.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%d\\work\TM21Vol4\gentan500\Database;Extended Properties=Paradox 4.81;Persist Security Info=False"); pCon->Open((_bstr_t)connectsource,"","",adModeUnknown); } catch(_com_error e) { AfxMessageBox("open .db wrong"); return FALSE; } } nothing
-
can someone plz give me a tutorial on how to change a pushbuttons appearance using GDI. i'd like to do it completely in Win32/SDK also Thanks In Advance, Tim Zorn
An alternative to making a fully owner-drawn button, is to put an icon or bitmap on a standard pushbutton. From a quick look at some old SDK-level code, the code is something like this:
buttonHwnd = CreateWindow("button", "", WS_CHILD | WS_VISIBLE | BS_ICON | BS_PUSHBUTTON, ButtonXPos, ButtonYPos, ButtonWidth, ButtonHeight, hwndMain, (HMENU)buttonId, hAppInst, NULL);
hButtonIcon = LoadIcon(hAppInst, MAKEINTRESOURCE(IDI_ButtonIcon));
SendMessage(buttonHwnd , BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)(HANDLE)hButtonIcon);
Right at the moment I forget what all the parameters are, but if you need help, just ask. -
this is my code for useing ADO link Paradox DataBase. but it throw wrong so maybe you can help me. i will greatly appreciated BOOL CTM21App::InitInstance() { CString connectsource; _ConnectionPtr pCon; AfxOleInit(); AfxEnableControlContainer(); pCon.CreateInstance(__uuidof(Connection)); try { connectsource.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%d\\work\TM21Vol4\gentan500\Database;Extended Properties=Paradox 4.81;Persist Security Info=False"); pCon->Open((_bstr_t)connectsource,"","",adModeUnknown); } catch(_com_error e) { AfxMessageBox("open .db wrong"); return FALSE; } } nothing
I'm sorry, I'm really not sure. What's the _com_error you catch, have you looked ? Christian Graus - Microsoft MVP - C++
-
An alternative to making a fully owner-drawn button, is to put an icon or bitmap on a standard pushbutton. From a quick look at some old SDK-level code, the code is something like this:
buttonHwnd = CreateWindow("button", "", WS_CHILD | WS_VISIBLE | BS_ICON | BS_PUSHBUTTON, ButtonXPos, ButtonYPos, ButtonWidth, ButtonHeight, hwndMain, (HMENU)buttonId, hAppInst, NULL);
hButtonIcon = LoadIcon(hAppInst, MAKEINTRESOURCE(IDI_ButtonIcon));
SendMessage(buttonHwnd , BM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)(HANDLE)hButtonIcon);
Right at the moment I forget what all the parameters are, but if you need help, just ask. -
-
thanks a bunch man. but how do u get it to have text along with an image. also how do i get the image to stretch across the whole button
I put bitmaps and icons on the buttons, but the basis was standard Windows pushbuttons. I don't have time to check now, but I think I made the size of the icons / bitmap such that they neatly fitted onto the flat grey foreground of the button. I can't remember what happens if the bitmap or icon is too big for the foreground. I would guess that if the bitmap if too big, you loose the 3D "animation" effect at the edges of the button. To have text with an image, maybe just include the text in your bitmap / icon. I will try to have a look at what I did later today (I'm on a course for the next 9 hours.)
-
thanks a bunch man. but how do u get it to have text along with an image. also how do i get the image to stretch across the whole button
Sorry - I had a quick look, but the earliest version I have on my work PC uses Icons on buttons (that version uses the code I posted previously.) If it is any use to you, I am sure I can find a backup disk at home with a version which puts bitmaps on buttons. Let me know if I must find it! (Or any other similar questions.)
-
Sorry - I had a quick look, but the earliest version I have on my work PC uses Icons on buttons (that version uses the code I posted previously.) If it is any use to you, I am sure I can find a backup disk at home with a version which puts bitmaps on buttons. Let me know if I must find it! (Or any other similar questions.)
i know how to put bitmaps on buttons now but i dont know how to do it the way i want. i want a bitmap to be stretched across the button and i want to be able to put text on the button. i have found an article that does it but i dont understand the source so im asking for help. For Example: a program called ICQ is skinned so it has custom buttons. but when i look at it's resourses the buttons are not ownerdrawn. all i want to do is make a custom button that has text on it. i dont even need the handling for if its selected, default, etc cuz i can find that out myself help would be appriciated thx:)