|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Setting background in vscrollbar to grayI'm working in VB6 and would like to set the background of the VScrollbar
control to gray (it defaults to white). There is backcolor property for this control; is there any way to do what I want. Thanks... Dan Dan wrote:
> I'm working in VB6 and would like to set the background of the Unfortunately, that's a bug in (all versions of) 32-bit VB. See the 2nd> VScrollbar control to gray (it defaults to white). There is > backcolor property for this control; is there any way to do what I > want. Question in this article: http://vb.mvps.org/articles/ap199810.pdf Short story is, you need to subclass the form, and "eat" the WM_CTLCOLORSCROLLBAR messages it gets. By "eat", do you mean that I return a brush handle to paint the background
gray, or do you mean that I should simply return 0? Dan Show quoteHide quote "Karl E. Peterson" wrote: > Dan wrote: > > I'm working in VB6 and would like to set the background of the > > VScrollbar control to gray (it defaults to white). There is > > backcolor property for this control; is there any way to do what I > > want. > > Unfortunately, that's a bug in (all versions of) 32-bit VB. See the 2nd > Question in this article: > > http://vb.mvps.org/articles/ap199810.pdf > > Short story is, you need to subclass the form, and "eat" the > WM_CTLCOLORSCROLLBAR messages it gets. > -- > Working without a .NET? > http://classicvb.org/ > > > Dan wrote:
> By "eat", do you mean that I return a brush handle to paint the As I wrote in that column:> background gray, or do you mean that I should simply return 0? "By simply instructing MsgHook to intercept this message, but not reacting in any fashion whatsoever to the receipt of the message, you instruct Windows to use the default colors for these controls." So, yeah, returning zero would be the proper non-response. <g> Show quoteHide quote > "Karl E. Peterson" wrote: > >> Dan wrote: >>> I'm working in VB6 and would like to set the background of the >>> VScrollbar control to gray (it defaults to white). There is >>> backcolor property for this control; is there any way to do what I >>> want. >> >> Unfortunately, that's a bug in (all versions of) 32-bit VB. See the >> 2nd Question in this article: >> >> http://vb.mvps.org/articles/ap199810.pdf >> >> Short story is, you need to subclass the form, and "eat" the >> WM_CTLCOLORSCROLLBAR messages it gets. >> -- >> Working without a .NET? >> http://classicvb.org/ Thanks Karl. I downloaded MsgHook, and applied the code from your article,
but I'm still getting the same behavior. I wonder if it's because the vscrollbar is part of Francesco Balena's Superlistbox control: http://www.fawcette.com/archives/premier/mgznarch/VBPJ/1999/08aug99/fb0899.pdf Show quoteHide quote "Karl E. Peterson" wrote: > Dan wrote: > > By "eat", do you mean that I return a brush handle to paint the > > background gray, or do you mean that I should simply return 0? > > As I wrote in that column: > > "By simply instructing MsgHook to intercept this message, but not reacting > in any fashion whatsoever to the receipt of the message, you instruct > Windows to use the default colors for these controls." > > So, yeah, returning zero would be the proper non-response. <g> > -- > Working without a .NET? > http://classicvb.org/ > > > > > "Karl E. Peterson" wrote: > > > >> Dan wrote: > >>> I'm working in VB6 and would like to set the background of the > >>> VScrollbar control to gray (it defaults to white). There is > >>> backcolor property for this control; is there any way to do what I > >>> want. > >> > >> Unfortunately, that's a bug in (all versions of) 32-bit VB. See the > >> 2nd Question in this article: > >> > >> http://vb.mvps.org/articles/ap199810.pdf > >> > >> Short story is, you need to subclass the form, and "eat" the > >> WM_CTLCOLORSCROLLBAR messages it gets. > >> -- > >> Working without a .NET? > >> http://classicvb.org/ > > > > "Dan" <D**@discussions.microsoft.com> wrote in message "The SuperListBox control comprises two constituent controls: a standard news:B26F3F44-12D0-4051-B6A5-7D86BE48A6CE@microsoft.com... > Thanks Karl. I downloaded MsgHook, and applied the code from your > article, > but I'm still getting the same behavior. I wonder if it's because the > vscrollbar is part of Francesco Balena's Superlistbox control: > http://www.fawcette.com/archives/premier/mgznarch/VBPJ/1999/08aug99/fb0899.pdf > listbox and a vertical scrollbar." If that scrollbar is the instrinsic scrollbar that's always in the toolbox then.... no. It shouldn't make a difference. If that scrollbar is part of the Windowless library he mentions in that article then.... yes. Forget about subclassing code having any effect on that one. No window = no hWnd = no subclassing.... even Windows isn't keeping track of that one. -- Ken Halter - MS-MVP-VB - Please keep all discussions in the groups.. DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Dan wrote:
> Thanks Karl. I downloaded MsgHook, and applied the code from your Remember, MsgHook is but a convenience, especially since VB5 added AddressOf> article, to the arsenal. To see my method of native subclassing, check out: http://vb.mvps.org/samples/HookMe > but I'm still getting the same behavior. I wonder if it's http://www.fawcette.com/archives/premier/mgznarch/VBPJ/1999/08aug99/fb0899.pdf> because the vscrollbar is part of Francesco Balena's Superlistbox > control: > Ah, well, as Ken says, all bets are off in that case. I have no idea what Francesco did, without a lot of dissection. The reason I was hooking the form in the first place, was Windows sends that message to the scrollbar's parent window. You familiar with Spy++? Yes, I'm very familiar with Spy++ (not sure whether to brag about it though :).
I think Ken is right: there is no hWnd property on Balena's scrollbar (even though it's named vScrollBar). Show quoteHide quote "Karl E. Peterson" wrote: > Dan wrote: > > Thanks Karl. I downloaded MsgHook, and applied the code from your > > article, > > Remember, MsgHook is but a convenience, especially since VB5 added AddressOf > to the arsenal. To see my method of native subclassing, check out: > > http://vb.mvps.org/samples/HookMe > > > but I'm still getting the same behavior. I wonder if it's > > because the vscrollbar is part of Francesco Balena's Superlistbox > > control: > > > http://www.fawcette.com/archives/premier/mgznarch/VBPJ/1999/08aug99/fb0899.pdf > > Ah, well, as Ken says, all bets are off in that case. I have no idea what > Francesco did, without a lot of dissection. The reason I was hooking the > form in the first place, was Windows sends that message to the scrollbar's > parent window. You familiar with Spy++? > -- > Working without a .NET? > http://classicvb.org/ > > > Dan wrote:
> Yes, I'm very familiar with Spy++ (not sure whether to brag about it <g>> though :). > I think Ken is right: there is no hWnd property on Balena's scrollbar Ouch. Well, time to reinvent the wheel, then, eh? Bummer...> (even though it's named vScrollBar). Hmmmm, why don't you just wave the Spy++ window finder cursor over it, just to be sure. Nope, it doesn't show up as a window. I wonder why he was using a windowless
control there. Show quoteHide quote "Karl E. Peterson" wrote: > Dan wrote: > > Yes, I'm very familiar with Spy++ (not sure whether to brag about it > > though :). > > <g> > > > I think Ken is right: there is no hWnd property on Balena's scrollbar > > (even though it's named vScrollBar). > > Ouch. Well, time to reinvent the wheel, then, eh? Bummer... > > Hmmmm, why don't you just wave the Spy++ window finder cursor over it, just > to be sure. > -- > Working without a .NET? > http://classicvb.org/ > > > "Dan" <D**@discussions.microsoft.com> wrote in message Performance...news:3953C6CF-4B90-4457-AB81-FE4565345F7B@microsoft.com... > Nope, it doesn't show up as a window. I wonder why he was using a > windowless > control there. > On the first page ot that article, there's a benchmark that compares a regular textbox to a windowless textbox. The windowless version shows that it ran "2.5 times faster". Considering the fact that he tested this on a poor old 333mhz PC, I'll bet you can swap the windowless version for the "real thing" and never know the difference (performance wise) -- Ken Halter - MS-MVP-VB - Please keep all discussions in the groups.. DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm |
|||||||||||||||||||||||