Can anybody tell me how to draw a grayed button. This is a button made of an up and a down bitmap. I send the message EnableWindow,hButton,FALSE but this doesn't gray the button bitmap only disables button so it receives no input. Is there any function similar to the toolbar function SendMessage,hToolBar,TB_ENABLEBUTTON,308,FALSE that I can use?
Any help suggestions appreciated.
best regards,
czDrillard
Any help suggestions appreciated.
best regards,
czDrillard
Hi,
why not just
and Blit a bitmap of the grayed button on this place?
:)
Greets YaWNS
why not just
invoke ShowWindow,hButton,SW_HIDE
and Blit a bitmap of the grayed button on this place?
:)
Greets YaWNS
Hi czDrillard
I assume you are wanting it, because the greyed control don?t looks very nice.
It?s easy to draw a grey image do seems like and disabled buton.
Get PaintshopPro (From jasc software).
1 - Load your image on it.
2 - With the magic tool select the background of your image (The color you want to looks as an mask, for example.
3 - Invert the selction (under the menu has this option)
4 - On menu tell it to convert to gray scale.
5 - Unselect the image
6 - Save it.
That?s all.
Regards
Beyond2000!
I assume you are wanting it, because the greyed control don?t looks very nice.
It?s easy to draw a grey image do seems like and disabled buton.
Get PaintshopPro (From jasc software).
1 - Load your image on it.
2 - With the magic tool select the background of your image (The color you want to looks as an mask, for example.
3 - Invert the selction (under the menu has this option)
4 - On menu tell it to convert to gray scale.
5 - Unselect the image
6 - Save it.
That?s all.
Regards
Beyond2000!
Hi,
here is the solution, sorry, not in assembler, but you should understand the mechanism.
It works with HDC's.
The greyed pictures look very
'*** Picture, 304 x 16 Pixel
y&=10
Whileloop 16
x&=10
Whileloop 304
Pixel&=GetPixel(x&,y&)
wert1&=GetRValue(pixel&)
wert2&=GetGValue(pixel&)
wert3&=GetBValue(pixel&)
'*** 127, 128, 129 scheinen optimale Werte zu sein f?r die "quasi-Standard Toolbar-Icons"
'
If (wert1&<127) and (wert2&<128) and (wert3&<129)
SetPixel x&,y&+32,Rgb(r&,g&,b&)
SetPixel x&+1,y&+33,Rgb(255,255,255)
EndIf
x&=x&+1
EndWhile
y&=y&+1
EndWhile
here is the solution, sorry, not in assembler, but you should understand the mechanism.
It works with HDC's.
The greyed pictures look very
'*** Picture, 304 x 16 Pixel
y&=10
Whileloop 16
x&=10
Whileloop 304
Pixel&=GetPixel(x&,y&)
wert1&=GetRValue(pixel&)
wert2&=GetGValue(pixel&)
wert3&=GetBValue(pixel&)
'*** 127, 128, 129 scheinen optimale Werte zu sein f?r die "quasi-Standard Toolbar-Icons"
'
If (wert1&<127) and (wert2&<128) and (wert3&<129)
SetPixel x&,y&+32,Rgb(r&,g&,b&)
SetPixel x&+1,y&+33,Rgb(255,255,255)
EndIf
x&=x&+1
EndWhile
y&=y&+1
EndWhile
DrawState
Thanks all for replies,
I took a little of everybodies advice:) First I created my colored text button with flag set to SW_HIDE then I made a new button in Paint Shop Pro. For text color I used RGB 128,128,128 then made a white drop shadow 1 pixel left and 1 pixel down. This creates an image identical to the gray text typically used on disabled menus or buttons. I display this grayed text button image and when I need to switch I use destroy window to get rid of it and SW_NORMAL to display my active color text button. Looks and works great!
best regards,
czDrillard
I took a little of everybodies advice:) First I created my colored text button with flag set to SW_HIDE then I made a new button in Paint Shop Pro. For text color I used RGB 128,128,128 then made a white drop shadow 1 pixel left and 1 pixel down. This creates an image identical to the gray text typically used on disabled menus or buttons. I display this grayed text button image and when I need to switch I use destroy window to get rid of it and SW_NORMAL to display my active color text button. Looks and works great!
best regards,
czDrillard
Hi czDrillard
post an example of what you did (zip file). It?s always good have new exampels here on the board.
It?s better when we see new techniques around.
Regards
Beyond2000!
post an example of what you did (zip file). It?s always good have new exampels here on the board.
It?s better when we see new techniques around.
Regards
Beyond2000!
DrawState
I have attached a zip file with source and exe for those who want to see. I'm not recommending it be done this way. As comrade has pointed out there is a windows api 'DrawState' which will accomplish this task.
Btw, I used a MASM proceedure called BmpButton to handle the mouse input. Before I wrote my own but it's a lot of work. The only caution I have about using BmpButton is that there is no way, or at least I don't know of any, to use DeleteObject on the bitmaps which are used. This seems to result in a memory leak. If anybody knows anything about this I would like to hear your thoughts.
best regards,
czDrillard
Btw, I used a MASM proceedure called BmpButton to handle the mouse input. Before I wrote my own but it's a lot of work. The only caution I have about using BmpButton is that there is no way, or at least I don't know of any, to use DeleteObject on the bitmaps which are used. This seems to result in a memory leak. If anybody knows anything about this I would like to hear your thoughts.
best regards,
czDrillard
Hmm,
is it just this OS (Win NT 4.0 SP5) which cannot display your program correctly?
Greets YaWNS
is it just this OS (Win NT 4.0 SP5) which cannot display your program correctly?
Greets YaWNS
YaWNS,
look at his resource file and the coordinates of the created buttons.
They are placed out of the dialog.... seems like he didnt run the exe himself :)
look at his resource file and the coordinates of the created buttons.
They are placed out of the dialog.... seems like he didnt run the exe himself :)
Hi,
Don't work under XP.
Only a little window opens, but no reaction...
Nordwind64
Don't work under XP.
Only a little window opens, but no reaction...
Nordwind64
YaWNS,
look at his resource file and the coordinates of the created buttons.
They are placed out of the dialog.... seems like he didnt run the exe himself :)
Well, didn't have time to look at it at school.
My ANSI-C Teacher already looked at me in some curious way, because I didn't do my C Assignement (which was already finished) but surfed on "some mysterious website" :)
Wasn't that czDrillards Problem some time before with his keygens/crackmes?
Greets YaWNS
Wasn't that czDrillards Problem some time before with his keygens/crackmes?
:/
I don't know why the program should malfunction under NT/XP I only have Windows 98 and here it looks good. (I did test it before posting) I've seen this problem before and asked questions on many forums and the general answer seems that different fonts alter the positions of dialog controls e.g russian windows not show the same as american windows. I don't know if this is true and I've never found a satisfactory solution. Maybe there is something wrong with the BmpButton function?
I'm not sure I understand the comments about the resource file. The button coordinates are given in the source code, not the resouce script. Maybe it looks like an error because the text control in the resource use dialog units and the bitmaps in the source code use windows pixels.
Brad, thanks for the link. I don't know if this is exactly what I am looking for because I want to emboss the text to give it a recessed 3D look, not just gray it.
Btw, in the past the name czDrillard may have been associated with unmentionable sites and activities. Long ago I came to realize that I may, in some small measure, be responsible for disseminating knowledge that could be put to an illegal use. Therefore I closed all these sites and concentrated on my work with a software development firm.
best regards,
czDrillard
I'm not sure I understand the comments about the resource file. The button coordinates are given in the source code, not the resouce script. Maybe it looks like an error because the text control in the resource use dialog units and the bitmaps in the source code use windows pixels.
Brad, thanks for the link. I don't know if this is exactly what I am looking for because I want to emboss the text to give it a recessed 3D look, not just gray it.
Btw, in the past the name czDrillard may have been associated with unmentionable sites and activities. Long ago I came to realize that I may, in some small measure, be responsible for disseminating knowledge that could be put to an illegal use. Therefore I closed all these sites and concentrated on my work with a software development firm.
best regards,
czDrillard