Results 1 to 13 of 13

Thread: Desktop-style application

  1. #1

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Desktop-style application

    Hello,

    I've been puzzling over the best strategy for my application for a while now, but keep on coming up against brick walls, so i thought i'd pick the brains of the people here.

    The application has a main form from which subforms are launched (but kept within the boundaries of the main form). The main form should always remain behind the subforms (like the desktop always remains behind the applications in windows) but still respond to click events, and there is the equivalent of the windows taskbar at the bottom of the application to manage all the forms.

    The attached picture explains it better. I created the app using MDI, but i had to use a borderless form as the background so it keeps coming to the front. I haven't managed to find a way of keeping one form to the back.

    It seems that i can't do it that way, so i was wondering if anyone knew of similar examples, or other ways in which this could be achieved.

    Thanks for your help,
    Attached Images Attached Images  

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Desktop-style application

    Zorder might help.. just create a Public sub that sets the Zorder so the main form is always last...
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Desktop-style application

    you can try using SetWindowPos API. try putting this in a module:
    VB Code:
    1. Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
    2.   ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    3. Public Const HWND_TOPMOST = -1
    4. Public Const HWND_NOTOPMOST = -2
    5. Public Const SWP_NOMOVE = &H2
    6. Public Const SWP_NOSIZE = &H1

    and while loading the sub-form, use this:
    VB Code:
    1. Call SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
    Show Appreciation. Rate Posts.

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Desktop-style application

    but that will also keep the windows above other apps as well.. just so u know
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Desktop-style application

    Quote Originally Posted by Static
    Zorder might help.. just create a Public sub that sets the Zorder so the main form is always last...
    but then the back-form wont react to any mouse press or any such event.
    Show Appreciation. Rate Posts.

  6. #6
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Desktop-style application

    Quote Originally Posted by Static
    but that will also keep the windows above other apps as well.. just so u know
    yes it will. but actually what he is trying to do is that when the user tries to click on the background form to open another subform, all the previously opened subforms must not get back to the main form. Zorder wont help in this regard, i think so.
    Show Appreciation. Rate Posts.

  7. #7
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Desktop-style application

    Zorder will not stop u from clicking the form..
    it just sets the order of "who" is in front.. BUT I just thought of this.. it will cause a flicker of being brought to the top, then being pushed to the back again.

    you could always create your own forms from picture boxes if might take more work but it would work
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  8. #8

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Desktop-style application

    In MDI pictured above there is frmMain - the MDIForm and frmTimeTable - MDIChild which is the background you can see with two buttons.

    i wish to keep frmTimeTable at the back of all the MDIChild forms. Neither zorder, nor setwindowpos can do this. Putting controls on the MDIForm background isn't possible either, so i guess i can't do what i want to do that way. i was wondering if there were any alternative solutions to create the app i want (or solutions to the MDI problem!)

  9. #9
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Desktop-style application

    attached is a quick sample I just made....using a picturebox as a "form"
    Attached Files Attached Files
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  10. #10

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Desktop-style application

    thanks static, that's the style of app that i want. but i wanted to keep nice xp gradient borders round the 'subforms'.

  11. #11
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Desktop-style application

    then all u need to do is create a "picture" in as the background in your pictureboxes.. it could make it look exactly like the form

    take a look at this attachment
    Attached Files Attached Files
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  12. #12

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Desktop-style application

    i won't be able to resize the form if i do that though, will i?

    otherwise it'd be perfect

  13. #13
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Desktop-style application

    well.. u could with a bit of coding.. never tried that.. but search for resising controls
    then search for resizing images should be able to do it
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width