none
vb.net windows form mouse click RRS feed

  • Question

  • Hi friends,

    I have a problem with viewing a form.

    I have 2 forms in total to my project.

    1 form called mainform

    2 form called settings

    on Main form I have 1 button and when clicked I show the second form(settings) on the right of first form.

     settings.Size = New Size(0, Me.Height)
           settings.Location = New Point(Me.Right, Me.Top)
            settings.Show()

    My problem now is:

    if I click on my desktop or  to a word page opened or chrome opened first form goes behind and if I click the icon mainform on taskbar it shows but not the  secondform (settings) that remain behind.

    how can I do to show together forms if icon on taskbar is presset?

    if I click minimize form I can show them together throught this code:

    Private Sub main_SizeChanged(sender As Object, e As EventArgs) Handles Me.SizeChanged If Me.WindowState = FormWindowState.Normal Then

    mainform.show() settings.show() End If

    I have tried gotfocus or lostfocus with not good result also mousecapturechanged event.

    what i'm trying now is to understand if mouse click on mainform then show together forms

    else if mouse click outside mainform together forms must go behind.

    Hope I have explain good my problem, and hope someone can help me.

    thank you


    Friday, July 14, 2017 1:46 PM

Answers

  • Try replacing ‘settings.Show()’ with ‘settings.Show(Me)’. Some of the other code will not be needed.

    Friday, July 14, 2017 5:35 PM

All replies

  • i think you should test showDialog to show form as dialog window

    and don't forget to call dispose when finish because close will not close the form(settings) it just will hide the form

    Friday, July 14, 2017 2:33 PM
  • Hi

    Maybe .BringToFront would help?


    Regards Les, Livingston, Scotland

    Friday, July 14, 2017 2:36 PM
  • I have tried also bringtofront without results.

    but my question remain, the click of icon on taskbar does have a control or not?

    I could resolve my problem if I intercept the icon click on my taskbar.

    if I click it, it show me the first form so I think can add ther also settings.show but do not know where to put the code.

    on mouse click, on mouse down? where?

    thanks

    Friday, July 14, 2017 2:58 PM
  • Try replacing ‘settings.Show()’ with ‘settings.Show(Me)’. Some of the other code will not be needed.

    Friday, July 14, 2017 5:35 PM
  • Yes probably the code to "show them together" is not needed if the other form is a child of the main form, as will be the case with "settings.Show(Me)".


    Sam Hobbs
    SimpleSamples.Info

    Saturday, July 15, 2017 6:45 PM
  • This is not a VB language question. You should ask your question in the forum for your UI, such as Windows Forms, WPF or UWP.

    There are controls for windows that slide in and out, such as what the Object Bowser in VS does. I think the SplitView Class for UWP does that. Perhaps you could do something like that.



    Sam Hobbs
    SimpleSamples.Info

    Saturday, July 15, 2017 6:52 PM
  • Hi PaoloDeBeneditis,

    It seems that Viorel_ solved your issue now, please remember to close your thread by marking his post as answer, it is very beneficial to other community members who face the same issue.

    Thanks for your understanding.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 19, 2017 7:48 AM
    Moderator