I think it is....
GDI is pretty prehistoric in some ways....
It's why background image are so uncommon, prefer tghe background color
property...
or wait for longhorn ;-)
> Many thanks for your help...
> Andreas
> It's why background image are so uncommon, prefer tghe background color
> property...
Well it looks like this is my only option, because I don't want my program
to look so slow, just because of a simple background image... wanted to have
a simple multi colour bg as in office 2003... do you happen to know if
there's a way to have multiple colours with a transition as background?
Thanks,
Andreas
Cablito - 18 Oct 2004 18:41 GMT
use the gdi drawing gradient. If thats not good enough in performance, drop
.net and write MFC c++ code
> > It's why background image are so uncommon, prefer tghe background color
> > property...
[quoted text clipped - 6 lines]
> Thanks,
> Andreas
Jay B. Harlow [MVP - Outlook] - 19 Oct 2004 00:19 GMT
Andreas,
I've used the following In my Forms in both VS.NET 2002 & VS.NET 2003
without any real performance problems...
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
MyBase.OnResize(e)
If Not Me.BackgroundImage Is Nothing Then
Me.BackgroundImage.Dispose()
Me.BackgroundImage = Nothing
End If
Dim image As New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height)
Dim gr As Graphics = Graphics.FromImage(image)
Dim rect As New Rectangle(New Point(0, 0), Me.ClientSize)
Dim brush As New LinearGradientBrush(rect, _
Color.RosyBrown, ControlPaint.LightLight(Color.RosyBrown), _
LinearGradientMode.Vertical)
brush.SetBlendTriangularShape(0.33)
gr.FillRectangle(brush, rect)
gr.Dispose()
Me.BackgroundImage = image
End Sub
The image is always the same size as the form, so there is no tiling going
on.
Just set the BackColor of controls that support it to Transparent, they will
then pick up the colors from the above Image.
Hope this helps
Jay
>> It's why background image are so uncommon, prefer tghe background color
>> property...
[quoted text clipped - 6 lines]
> Thanks,
> Andreas
Andreas van de Sand - 19 Oct 2004 08:01 GMT
> I've used the following In my Forms in both VS.NET 2002 & VS.NET 2003
> without any real performance problems...
Thanks Jay, tried this, and at least it's better. Still slow, but not as bad
as with an image.
Thanks very much for your help everyone!
Andreas
Jay B. Harlow [MVP - Outlook] - 19 Oct 2004 15:12 GMT
Andreas,
Only the form itself should have the background image.
All your controls should have BackColor = Transparent.
Can you define "slow", when is it "slow" specifically.
Can you post a 20-25 line program (or email me) that accurately shows that
it is slow?
As using the above routine, the only time it is even close to "slow" is when
you resize the form itself. Even then on a 866 PIII, I don't really notice
it as being slower then normal (it flickers slightly, but that's about it).
Hope this helps
Jay
>> I've used the following In my Forms in both VS.NET 2002 & VS.NET 2003
>> without any real performance problems...
[quoted text clipped - 3 lines]
> Thanks very much for your help everyone!
> Andreas
Andreas van de Sand - 20 Oct 2004 04:41 GMT
Jay,
> Only the form itself should have the background image.
>
> All your controls should have BackColor = Transparent.
yes, that's what it is.
> Can you define "slow", when is it "slow" specifically.
it's slow when I'm showing a panel which contains 3 listBox controls with
splitters in between and another (transparent) panel.
I'm setting the DockingState of the panel to Fill at runtime and change the
visibility of the panel to visible.
And that's what takes time... not the backgroundimage itself, just the
(automatic) resizing of the controls (according to their Fill state). You
see them appearing and resizing, one by one.
But it's really better now than before with an image from a file.
So again, many thanks!
Andreas