By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,139 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

Painting MDI Form

P: n/a
Hi

Does anyone know a method to paint a gradient background to an MDI
Container?

I tried to use the Blend Control from VBPowerPack but each MDI Child will be
shown behind that control.
I tried BringToFront() or SendToBack() but have no results.

Now im searching for a method to paint a gradient background to that MDI
form.
This gradient must be repainted if the user changed the MDI Container size.

My last visit was here:
http://www.vbaccelerator.com/home/NE...ng/article.asp

This looks excactly like what i want.

Thanks for any help

Frank

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

Draw on a bitmap and set the mdi forms background image to the
bitmap. Try something like this

Dim WithEvents frm As New Form2

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

frm.MdiParent = Me

frm.Show()

End Sub

Private Sub DrawBackground()

Dim lbBack As New LinearGradientBrush(Me.ClientRectangle, Color.Blue,
Color.White, LinearGradientMode.ForwardDiagonal)

Dim bm As New Bitmap(Me.Width, Me.Height)

Dim g As Graphics = Graphics.FromImage(bm)

g.FillRectangle(lbBack, 0, 0, Me.ClientRectangle.Width,
Me.ClientRectangle.Height)

Me.BackgroundImage = bm

lbBack.Dispose()

End Sub

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Resize

DrawBackground()

End Sub
Private Sub frm_Move(ByVal sender As Object, ByVal e As System.EventArgs)
Handles frm.Move

DrawBackground()

End Sub

Ken

-------------------------

"Frank Liebelt" <li*********@arcor.de> wrote in message
news:41**********************@newsread4.arcor-online.net...
Hi

Does anyone know a method to paint a gradient background to an MDI
Container?

I tried to use the Blend Control from VBPowerPack but each MDI Child will be
shown behind that control.
I tried BringToFront() or SendToBack() but have no results.

Now im searching for a method to paint a gradient background to that MDI
form.
This gradient must be repainted if the user changed the MDI Container size.

My last visit was here:
http://www.vbaccelerator.com/home/NE...ng/article.asp

This looks excactly like what i want.

Thanks for any help

Frank


Nov 21 '05 #2

P: n/a
Hi Ken
Draw on a bitmap and set the mdi forms background image to the
bitmap. Try something like this

Dim WithEvents frm As New Form2

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

frm.MdiParent = Me

frm.Show()

End Sub

Private Sub DrawBackground()

Dim lbBack As New LinearGradientBrush(Me.ClientRectangle, Color.Blue,
Color.White, LinearGradientMode.ForwardDiagonal)

Dim bm As New Bitmap(Me.Width, Me.Height)

Dim g As Graphics = Graphics.FromImage(bm)

g.FillRectangle(lbBack, 0, 0, Me.ClientRectangle.Width,
Me.ClientRectangle.Height)

Me.BackgroundImage = bm

lbBack.Dispose()

End Sub

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Resize

DrawBackground()

End Sub
Private Sub frm_Move(ByVal sender As Object, ByVal e As System.EventArgs)
Handles frm.Move

DrawBackground()

End Sub


That helps me. Thank you

Frank
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.