Lazarus

Programming => Widgetset => CustomDrawn => Topic started by: Dibo on September 20, 2012, 02:53:21 pm

Title: Transparent Custom Drawn Controls
Post by: Dibo on September 20, 2012, 02:53:21 pm
Hi,

I'm writting own drawer for custom drawn controls. But all controls inherit from (TCDControl -> TCustomControl), so background by default is without transparent (I get uniform gray color).
I think that non-container controls (like TCDStaticText, TCDButton etc) should inherit from TGraphicControl which has support for transparent background.
Custom Drawn Controls have potencial and I really like this idea, but lack of transparency disqualify this package for creating modern and fancy interfaces. For example I even can't drop TCDStaticText on panel which have gradient or some graphic :'(

Regards
Title: Re: Transparent Custom Drawn Controls
Post by: lainz on September 20, 2012, 07:17:53 pm
Maybe not for standar buttons, those have a nice Focus stage.

BTW I think it's a good idea to add TCDGraphicButton and other graphic controls.
Title: Re: Transparent Custom Drawn Controls
Post by: Dibo on September 20, 2012, 07:44:23 pm
The best thing in Custom Drawn Controls is that all drawing logic is in drawer object. So I am just creating own component TMyCDStaticText which inherit from TGraphicControl and then in Paint method I call GetDefaultDrawer.DrawStaticText(). So with this trick I have transparent label. This same with buttons etc... :)
Title: Re: Transparent Custom Drawn Controls
Post by: lainz on September 20, 2012, 08:37:34 pm
Nice, those are for your projects or you will include them in BGRAControls?
Title: Re: Transparent Custom Drawn Controls
Post by: Dibo on September 20, 2012, 09:00:58 pm
For my project. But this is my first serious contact with Custom Drawn Controls and... I liked it :) . Many interesting tools for creating GUI (e.g for text edit).
I am thinking how can I merge it with BGRA Controls. Or maybe create new independent package? Because BGRA Controls are hm, free style :) . Each control has different look and destiny. I am thinking about package which use BGRABitmap for creating uniform fancy styles with the same color scheme for all controls (like your Windows 7 drawer for CD). Gnome look is good example for a start :) . Standard BGRA Controls will be development with own way (as so far)
Title: Re: Transparent Custom Drawn Controls
Post by: lainz on September 20, 2012, 11:09:14 pm
Really I don't know =)

If for example you add TCDGraphicButton to get something like in the Windows 7 Drawer or TBGRAImageButton I need BGRABitmapThemeUtils that comes with BGRAControls (At least for now, unless at some point Circular add 9-slice-scaling to bgrabitmap).

Or if you're using bctypes / bctools.. the rest of BGRAControls are just controls that just need bgrabitmap.

Is just duplicating the needed files isn't it? Or using both, bgracontrols and the new related to custom drawn package..
Title: Re: Transparent Custom Drawn Controls
Post by: Dibo on September 20, 2012, 11:31:05 pm
I'm thinking about dedicated BGRA package for custom drawn controls, not releated to BGRAControls, for example BGRA Custom Drawn ;) . So if I really decide to create this package, we could move all your "windows 7 drawer" stuff to the new package (this should not have affect for others controls like knob, bcbutton, bcpanel etc...). BCTypes, BCTools etc, those are BGRAControls framework tools, and I supose that they will not examine in CD (it has different drawing logic). I have to think about it
Title: Re: Transparent Custom Drawn Controls
Post by: lainz on September 21, 2012, 02:04:24 am
Ok, well move all things in the folder, and copy bgrabitmapthemeutils.pas, so the package will be independent from bgracontrols
Title: Re: Transparent Custom Drawn Controls
Post by: felipemdc on September 24, 2012, 04:12:17 pm
I would prefer a drawer code which can draw Windows 7 style controls without needing BGRABitmap. Such a code could be commited directly into Lazarus and benefit all LCL-CustomDrawn users.
Title: Re: Transparent Custom Drawn Controls
Post by: lainz on September 25, 2012, 09:44:48 pm
To do that, we need 9slicescaling for custom drawn library

the bgra slicescaling:
http://bgracontrols.svn.sourceforge.net/viewvc/bgracontrols/

it will replace bgrabitmapthemeutils.pas in the Windows 7 Drawer, it is more flexible.

some old code with tbitmap
https://sourceforge.net/p/bmpthemeutils/home/
TinyPortal © 2005-2018