Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Aug 25, 2019 8:28 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Gradient background on form
PostPosted: Wed Aug 10, 2011 9:29 pm 
Offline
User avatar

Joined: Sat Jun 04, 2011 8:29 am
Posts: 387
In VB6 I had a control that would let me make a form background gradient... so lighter color fading to darker color at bottom... makes the forms look a lot more up-to-date and stylish...

Is that possible in RB?

If that were on the mac, would that be ok? or would users see that as non-apple like?

i.e. should we ditch the gradient coloring?

_________________
Currently using:
Windows XP Pro SP3
Real Studio 2011 Release 4.3 Enterprise
and
Mac OS 10.7.4
Real Studio 2011 Release 4.3 Enterprise
(finally also compiled on Mac)


Top
 Profile  
Reply with quote  
 Post subject: Re: Gradient background on form
PostPosted: Thu Aug 11, 2011 9:39 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
Yes, it's possible in RB. You have a couple of options. 1) search for gradient algorithms and you'll find a couple in the forums. 2) Draw the gradient you want in a graphics program and then do a graphics.drawpicture to draw it in the window.paint event. I prefer 2 because it's MUCH less code and you only need a very small picture to do it.

The drawback, as I see it, is that it's not a standard UI so some people, especially Mac users, will not like it - but each app is different so it's really up to you. The other issue might be flickering in Windows as sometimes an odd background can cause the controls to excessively redraw.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Gradient background on form
PostPosted: Thu Aug 11, 2011 4:19 pm 
Offline
User avatar

Joined: Sat Jun 04, 2011 8:29 am
Posts: 387
If not using this type of gradient... are there other ways to "skin an app"? Or is that the only way... use a graphic?

I did hear from another programmer about flicker problems but did not ask him about whether he was using a gradient.

If I forego this gradient idea... what would be the "better way" or "more standard way" to stylize the windows so that it's not just boring gray? I can just set a color but what would the mac people think of that?

I have not used a mac regularly since the late 90s so just getting back into macs....

_________________
Currently using:
Windows XP Pro SP3
Real Studio 2011 Release 4.3 Enterprise
and
Mac OS 10.7.4
Real Studio 2011 Release 4.3 Enterprise
(finally also compiled on Mac)


Top
 Profile  
Reply with quote  
 Post subject: Re: Gradient background on form
PostPosted: Sun Aug 14, 2011 7:37 am 
Offline

Joined: Sat Mar 12, 2011 9:18 am
Posts: 71
You could add this in the Paint event of the Window:
dim i as integer, ratio, endratio as Double
dim StartColor, EndColor as Color


// Pick our colors
StartColor = RGB(235, 239, 242)
EndColor = RGB(186, 201, 214)


// Draw The Gradient
for i = g.Height DownTo 0

// Need our ratios of start / end
ratio = (i/g.Height)
endratio = ((g.Height-i)/g.Height)

// Determine the Color
g.ForeColor = RGB(StartColor.Red * endratio + EndColor.Red * ratio, StartColor.Green * endratio + EndColor.Green * ratio, StartColor.Blue * endratio + EndColor.Blue * ratio)

// Draw the current line
g.DrawLine 0, i, g.Width, i
next


P.S.: This is not my code but I forgot where I found it... Probably here on the forums.


Top
 Profile  
Reply with quote  
 Post subject: Re: Gradient background on form
PostPosted: Tue Aug 16, 2011 7:27 pm 
Offline
User avatar

Joined: Sat Jun 04, 2011 8:29 am
Posts: 387
Will this technique cause "flicker" on any of the platforms?

Just wondering if anyone knows....

_________________
Currently using:
Windows XP Pro SP3
Real Studio 2011 Release 4.3 Enterprise
and
Mac OS 10.7.4
Real Studio 2011 Release 4.3 Enterprise
(finally also compiled on Mac)


Top
 Profile  
Reply with quote  
 Post subject: Re: Gradient background on form
PostPosted: Tue Aug 16, 2011 7:35 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
I'll just say "probably" on Windows. You look at controls wrong on Windows and they'll flicker. :)

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group