|
-
Jan 29th, 2008, 05:28 PM
#1
Thread Starter
Addicted Member
-
Jan 29th, 2008, 05:31 PM
#2
Re: [2005] Background image in MDIForm
use child forms bringtofront
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jan 29th, 2008, 05:37 PM
#3
Thread Starter
Addicted Member
Re: [2005] Background image in MDIForm
Code is for childforms:
Code:
frmStok.MdiParent = Me
frmStok.Show()
frmStok.BringToFront()
It should work?
-
Jan 29th, 2008, 06:16 PM
#4
Re: [2005] Background image in MDIForm
If you are not aware of the MdiClient class then nothing you do will work. Follow the MDI Background link in my signature for the solution.
-
Jan 29th, 2008, 07:43 PM
#5
Thread Starter
Addicted Member
Re: [2005] Background image in MDIForm
It doenst work. It is as same as "Me.BackgroundImage". If I move a childform on the picture it is being cut and bad I will put a screenshot...

Image with the text "Logo Alanı" is normally not like that.
It happens with your and my code. It only doesnt happen if I put the image in a picturebox but then picturebox stands in front of the forms.
Last edited by Genom; Jan 29th, 2008 at 08:05 PM.
Dim Me As Coder
-
Jan 29th, 2008, 08:12 PM
#6
Re: [2005] Background image in MDIForm
Odd that it works perfectly for me. Post your EXACT code.
-
Jan 29th, 2008, 08:18 PM
#7
Thread Starter
Addicted Member
Re: [2005] Background image in MDIForm
have you tried move form "out" the form and let scrollbars appear and move them?
Maybe it is because of my splitcontainer...
-
Jan 29th, 2008, 08:22 PM
#8
Re: [2005] Background image in MDIForm
Start with a brand new project and try it. Does it work? If not then what is different about the new project compared to the original? Make changes one by one to the new project to make it resemble the original. When the new project breaks you've found your issue. That's called software development.
-
Jan 30th, 2008, 01:13 PM
#9
Thread Starter
Addicted Member
Re: [2005] Background image in MDIForm
The problem is that it happens in an empty project too. And I cant find any solution for that. If it happens in an empty project too with a simple MDI form I cant find the differences which cause this problem. And it amazing that .net developers dont know this...?
-
Jan 30th, 2008, 01:47 PM
#10
Thread Starter
Addicted Member
-
Jan 30th, 2008, 04:59 PM
#11
Re: [2005] Background image in MDIForm
I think I see what you're saying now. If you scroll the parent form the background doesn't get redrawn properly. I didn't register the scrolling bit before. That does present some problems as there doesn't immediately appear to be an appropriate event to use to refresh the background. I'll look into it.
-
Jan 30th, 2008, 05:04 PM
#12
Thread Starter
Addicted Member
Re: [2005] Background image in MDIForm
thanks ... and sorry for my bad explanation and english...
-
Jan 31st, 2008, 10:19 AM
#13
Re: [2005] Background image in MDIForm
This probably won't be simple to accomplish. Unfortunatly the MDIClient class is not easy to work with because it can't be inherited to add custom functionality, and it also doesn't inherit from scrollable control (even though it is a scrollable control) so you don't get a scroll event. It does fire sizing events when scrollbars are changed from visible to invisible (from dragging child form) because the scrollbars change the available client size of the control, however no events fire if you scroll the scrollbars by clicking the arrows up and down, so you still get tearing of the image.
-
Jan 31st, 2008, 12:54 PM
#14
Thread Starter
Addicted Member
Re: [2005] Background image in MDIForm
Because of this I changed my code and put a picturebox but this time it comes in front of the forms and if I send back it disappears... Can you give me an idea about this issue?
-
Jan 31st, 2008, 01:38 PM
#15
Thread Starter
Addicted Member
Re: [2005] Background image in MDIForm
For who cares it I have finally found a solution...
vb Code:
Private Sub frmStok_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move Dim MDI As frmMDI = Me.MdiParent MDI.LogoKoy(1) 'puts the picture End Sub
frmStok is a childform. the parameter "1" tells that picture has been taken and only refreshs it... (Me.BackgroundImage = Image.FromFile(Path))
It works but it has a bad effect on performance.
-
Jan 31st, 2008, 05:46 PM
#16
Re: [2005] Background image in MDIForm
 Originally Posted by Genom
Because of this I changed my code and put a picturebox but this time it comes in front of the forms and if I send back it disappears... Can you give me an idea about this issue?
Think about it for a bit. The form contains an MdiClient control. The MdiClient control contains the child forms. If you put any other control, like a PictureBox, on top of the MdiClient then of course it's going to be on top of anything the MdiClient contains too.
It really comes down to the fact that you're not intended to do this sort of thing so no easy way has been provided. If you were supposed to then the MdiClient control wouldn't be hidden in the first place.
What you could do is try drawing the Image using GDI+ instead of using the BackgroundImage property. I've got a feeling that this would not work either though, because the issue already encountered suggests that the MdiClient is not repainted when it's scrolled. Might be worth a look though.
-
Jan 31st, 2008, 06:07 PM
#17
Thread Starter
Addicted Member
Re: [RESOLVED] [2005] Background image in MDIForm
yes the event is missing too. However it is "resolved" and thank you a lot!!!
-
Jan 31st, 2008, 07:49 PM
#18
Re: [RESOLVED] [2005] Background image in MDIForm
One final idea. You could subclass the MdiClient with a NativeWindow, which doesn't require you to actually inherit the MdiClient class. You would then intercept the appropriate Windows messages and you could then force the MdiClient to repaint at the appropriate times.
I've messed with subclassing in VB a bit but I'm far from an expert. If you want to investigate this route then I suggest that you look up the NativeWindow class and subclassing on MSDN.
-
Feb 1st, 2008, 12:44 PM
#19
Thread Starter
Addicted Member
Re: [RESOLVED] [2005] Background image in MDIForm
I think performance wont be better than repainting it every childform move... But I will keep in mind it will be very useful for my projects...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|