Slider on Gradient Toolbar |
Post Reply |
Author | |
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
Posted: 07 February 2005 at 8:43pm |
Ok, well I finally got it working, and its a lot of hackish looking
code probably, but you CAN have sliders on the toolbars, with gradient
backgrounds showing thru and all. They work perfectly, even with
customization drawing the border on top of it. I put in a sunken
3D border for when it has focus instead of the dotted outline it
normally would get. They work in menus and don't have to close the menu
when used either. And of course, it works with other themes other than
the Office 2003 (extended) theme too.
I forgot and took the screenshots on Windows 2000, but it works with the XP slider too: Edited by Ark42 |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
The code involves firstly a custom implementation of a memory DC. You must use TransparentBlt instead of BitBlt, which means you need to target 98/ME/2000/XP (no 95/NT) or at least LoadLibrary msimg32 and get TransparentBlt that way if you want a fallback. The slider's dummy parent will respond to WM_CTLCOLORSTATIC and set the background brush to a solid key color, used for your TransparentBlt. I use 255,16,255 because its a bright purple nobody should really want anyways. Your control derived from CSliderCtrl needs to use the memory DC with the TransparentBlt. I set its OnPaint handler to GetCurrentMessage and use the HDC provided in the wParam parameter, and if no HDC is provided, it will instead tell the parent to redraw, and respond with a dummy CPaintDC setup and no drawing. If it does have a HDC provided, it sets up the memory DC and calls DefWindowProc with it. Make sure you added WS_EX_TRANSPARENT to the control derived from CSliderCtrl so the background shows through. The last trick is that in your control derived from CXTPControlCustom, you need to override Draw(), adjust the viewport origin with m_rcControl, and send WM_PAINT to the CSliderCtrl derived control with the HDC provided to Draw(). Make sure to restore the viewport origin after the sendmessage call. Seems like lots of funny hacks to get it to work, and I don't want to paste all the tons of code for it, but its definately possible to do! Edited by Ark42 |
|
mjm_d
Newbie Joined: 20 September 2005 Status: Offline Points: 10 |
Post Options
Thanks(0)
|
you can see the Sample "CommonControls"
|
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Unless something has changed, no, that sample never worked for anything other than the office 2000 theme with solid color backgrounds.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Was the GetParent()->Print(pDC, PRF_CLIENT); in CXTPControlSliderCtrl::CtlColor in your sample a feature added to a new version of CodeJock recently? I recall trying to get something a little simpler like that to work in the past but could not find a way to properly derive the controls to set up the painting like that. So before, I was forced to use a TransparentBlt, but this way looks cleaner and safer for Win95/98.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
yes, WM_PRINT support was added in 9.80 version only...
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Thats great, I might have to redo mine classes using that. I also like how yours are resizable too, that must be another new feature in 9.80+? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello, Actually resizeable feature and inteface was added in 9.60 :) from Release Notes: Added ability to resize ComboBox and Edit controls by user in Customize mode |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Wow, I didn't even notice that for some reason. When you resize a combobox, the is the dropdown part supposed to be resized as well? It seems to stay the original width. Doesn't really matter though, since its already a bonus mini-feature in my program now, I didn't know they where even resizable. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello, It will resize automatically if you don't set it to some static value. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
lorax1284
Groupie Joined: 10 September 2005 Location: Canada Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Hello; I have this code downloaded and it gets the "AboutDlg" bits included and compiled in alright (or so I believe) but I get a whole pile of these:
CXTPControl::GetAccessibleName(struct tagVARIANT,unsigned short * *)" (?GetAccessibleName@CXTPControl@@MAEJUtagVARIANT@@PAPAG@Z) XTPControlSlider.obj : error LNK2001: unresolved external symbol "protected: virtual long __thiscall CXTPControl::GetAccessibleName(struct tagVARIANT,unsigned short * *)" (?GetAccessibleName@CXTPControl@@MAEJUtagVARIANT@@PAPAG@Z) Is there any way to fix this? It took quite a bit of work to get to this point, too... is there documentation someone could point me at, for properly locating downloaded code samples on my file system so they'll compile? Thanks |
|
Ryan Germann
Product Manager & UI Designer |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Change this option:
Configuration Properties->C/C++->Language->Treat wchar_t as Builtin Type = Yes.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
lorax1284
Groupie Joined: 10 September 2005 Location: Canada Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Thanks; that did the trick.
I noticed there is a .bmp file: ToolbarVolume.bmp Is that a mask file that is required to make the skin show through? I'm pretty sure we're not using a mask of any kind. Thanks |
|
Ryan Germann
Product Manager & UI Designer |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
I can't download attachment.. seems it was lost when we changed forum engine. Can you upload it again?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
lorax1284
Groupie Joined: 10 September 2005 Location: Canada Status: Offline Points: 14 |
Post Options
Thanks(0)
|
uploads/20060808_230916_20060712_100956.zip
Sorry Oleg; I misunderstood that you wanted me to upload it... here it is. Incidentally, that slider sample shows the CodeJock "skin" applied to a slider on a toolbar, but the problem I need to solve is that the slider on the toolbar is not adopting the WindowBlinds skin. Also, there seems to be a raised "tablet" area around all of the buttons and the slider that are on toolbars, which I'd like do to away with. I've attached a screenshot, enlarged to show detail, and I've filled the areas that show up as "silver" with Magenta to make them stand out... they are just grey on my GUI, but I want them to basically be transparent so the skin will show through. Thanks |
|
Ryan Germann
Product Manager & UI Designer |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Question was how to use Office 2003 theme + Slider... but seems it is WinXP theme... If you use WinXP you don't need all this code in CtlColor
just comment handlers.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |