Simple and effective. Much better than some interfaces where every frame is a different rainbow color or the graphics get in the way of the functionality.
Actually, the blue is from the current selected windows theme (which is right now set to the default blue). The side panel is from Dacris' control set and it fully integrates with the windows theme.
Actually, that is a graphic. I have the luxury of our users being locked into using the default blue theme exclusively (or so the network admin tells me) so I just created that gradient in photoshop and included it. If they werent locked in I guess I would have had to create the gradient in code going from the left taskpane backcolor (or whatever system color that is using) to white.
yeah, very pretty. would be interesting to see the code to make that gradiant depending upon the system colours actually.
i think that would be a good thing to do anyway. it might be a learning experience, and it would be more efficient as you don't need to have a bitmap or other image format bundled with your exe, reduces the size.
although whatever really, just wud be interesting to see the code to do that. i haven't worked with graphics before in code
Odd you should mention that! I just got up to take a leak not 5 minutes ago and I said to myself, "Hey, why not just code that gradiant this afternoon and scrape the image..."
Originally posted by LITHIA hehe, i must be pyschic
can you include the code you write please? dat wud be interesting! thanks
OK, this is my code. First I draw a solid white rectangle 31 pixels high and the width of the form. I then draw the gradient rectangle on top of the white. I did this because I could not find a quick way to adjust the gradient fade rate. This solution puts the gradient on only half of the form width so we still get the nice white half. Finally, I draw the black border around the rectangle.
The only additional line of code in the OnResize event. That line is
Me.Refresh
My next step would be to draw the text as well but since a label works, I'm not too interested in adding that step at this time.
VB Code:
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim g As Graphics = e.Graphics
Dim startColor As Color = Color.CornflowerBlue
Dim halfRect As Rectangle = New Rectangle(0, 0, Me.Width \ 2, 31)
Dim rect As Rectangle = New Rectangle(0, 0, Me.Width + 50, 31)
Dim MyPen As Pen = New Pen(Color.Black)
Dim MyBrush As LinearGradientBrush = New LinearGradientBrush(halfRect, startColor, Color.White, LinearGradientMode.Horizontal)
Dim MyBackFillBrush As SolidBrush = New SolidBrush(Color.White)
"The smoothing mode specifies whether lines, curves, and the edges of filled areas use smoothing (also called antialiasing). One exception is that path gradient brushes do not obey the smoothing mode. Areas filled using a PathGradientBrush object are rendered the same way (aliased) regardless of the SmoothingMode property."
LinearGradients don't fall into that category I believe... so you could make it look even purdier...
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
'Create a gradient brush as a large client area with specified
'start/end color and gradient mode.
Dim br As New LinearGradientBrush(Me.ClientRectangle, _
m_StartColor, m_EndColor, m_GradientMode)
'paint the rectangle
e.Graphics.FillRectangle(br, Me.ClientRectangle)
'destroy the brush
br.Dispose()
'let the base control do the work...
MyBase.OnPaint(e)
End Sub
Private Sub GradientBackground_Resize(ByVal sender As Object, _
ByVal e As EventArgs)
Me.Invalidate()
End Sub
Now, add the new control to your toolbar, drag an instance to your form and you have a background gradient control that you can set start and end colors for as well as the gradient path.
Got to be honest - I ripped this out of Balena's book, but it works a treat!
How did you get the images on the buttons in the bottom corner with XP style? Is this a 3rd party control?
And is the "Pricing" & "Costs" rectangles a control as well or is it just a rounded rectangle with a label over the top bit, because thats the way i do it.
I noticed the one pixel thing and fixed it after I did the screen shot. Nice catch.
Wallabie,
I am using a third party class that extends the visual styles. That allows the button graphics and the look of the tab control. I'll post on Monday the name of the extender class (I'm home now and don't remember the name).
Since this is related to this, I figured I would ask my quetion here rather then post a new one.
I made a dropdown list box. And It's supposed to change the backround editor to a color.
So what I mean is. If I name one of them red.
I would show in the main file thing (where I want the backround color changed) that it should be
form.color ?
Thanks VBGuy, I tried NetXP Controls Suite and it's just GREAT.
Do you think my life is easy?
Do you think it's good to win?
do you think it's nice to kill?
Do you think learning is a must?
Do you think computers are nothing?
Do you think this post is stupid?
Do ypu think we're really humen?
Stop kidding around, the important is the core of your software - the internal functions and capabilities - . I personally use the EnableVisualStyle() function at startup for using WindowsXP interface, but believe me: I myself ignore the GUI after a short time, you will probably get busy with working and finishing the work you developped that app for.
Do you think my life is easy?
Do you think it's good to win?
do you think it's nice to kill?
Do you think learning is a must?
Do you think computers are nothing?
Do you think this post is stupid?
Do ypu think we're really humen?
I know that TLord. However, we all work differently don't we.
I like to get my GUI design nice and tight, looking good before getting into the mechnics of the code, otherwise I find myself re-writing all sorts of stuff if I'm unhappy with my GUI and changing it all the time.
Thanks for your comments though mate, interesting to see how different people work.
Right' defferent people have defferent ideaologies.
I've forgot to write one thing in my last reply: actually I have dozens of data, XML, confoguration, resource and media files in my application, so pushing DLL and other stuff - as I think - for using 3rd party components just won't go, because I organize all my files in individual folders, while - as I know - DLL references can't be moved from direct absulote path the executable.
If anyone knows how to move reference libraries (DLLs) from there by customization, please reply in this thread because this will help me a lot, and I think also many members will penifit from that.
Do you think my life is easy?
Do you think it's good to win?
do you think it's nice to kill?
Do you think learning is a must?
Do you think computers are nothing?
Do you think this post is stupid?
Do ypu think we're really humen?
Originally posted by LeeSalter OK. This is what I have.
Now, add the new control to your toolbar, drag an instance to your form and you have a background gradient control that you can set start and end colors for as well as the gradient path.
Got to be honest - I ripped this out of Balena's book, but it works a treat!
This is indeed very nice, and easy to use. I have added a panel coloured black to give a 1-pixel edge, and added teh gradient over the top of the panel (two pixels less in depth and height than the panel). If, however, I add a label as well, the text always appears underneath the gradient, not on top. Any ideas?
VBGuy thanks for posting the link for Skybound extenders.
I'm a fresh newbie when it comes to .NET, and I've been following the instructions on how to install and activate the extender class, but was confused about one thing.
In the documentation it says:
In addition to adding a VisualStyleProvider component to each form, you must call the VisualStyleProvider.EnableVisualStyles before Application.Run in your program entry point:
[Visual Basic]
Public Shared <STAThread()> _
Sub Main()
Skybound.VisualStyles.VisualStyleProvider.EnableVisualStyles()
Application.Run(New Form1())
End Sub
Where exactly in my Visual Basic Project do I paste this code? I've tried a few different things all of them to no avail.