Results 1 to 23 of 23

Thread: [RESOLVED] Issue with fullscreen code

  1. #1

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Resolved [RESOLVED] Issue with fullscreen code

    Howdy!

    I am having a issue with getting my Win form app to go into fullscreen - Well sort of.

    See if you exit after you enter then enter again it works just fine - But when you go into it the first time it sitll shows some of the taskbar.
    (See below)
    Code:
        Private Sub ToolStripButton5_Click(sender As Object, e As EventArgs) Handles ToolStripButton5.Click, FullScreenToolStripMenuItem.Click
            ToolStripButton5.Visible = False
            ControlBox = False
            Me.WindowState = FormWindowState.Maximized
            Me.Size = SystemInformation.PrimaryMonitorSize
            Me.WindowState = 2
            Me.Location = New Point(0, 0)
            Me.TopMost = True
            Me.FormBorderStyle = 0
            Me.TopMost = True
            ToolStripButton6.Visible = True
        End Sub
    'Exit FullScreen.
        Private Sub ToolStripButton6_Click_1(sender As Object, e As EventArgs) Handles ToolStripButton6.Click, ExitFullScreenToolStripMenuItem.Click
            Me.WindowState = FormWindowState.Normal
            Me.Size = MaximumSize
            Me.FormBorderStyle = FormBorderStyle.Sizable
            ToolStripButton5.Visible = True
            ControlBox = True
            Me.TopMost = False
            ToolStripButton6.Visible = False
        End Sub


    When you first load the application and every time - you have to go into - back out and back into fullscreen just for it to be right.

    The code took me a few months to come up with. This being is because there is no native "Form.GoFullScreen"

    Wished it was that easy - Sure there is a way for me to write a class maybe but rather not for now.

    The code really isn't that hard to understand...But I just don't understand why it isn't working when I hit fullscreen the first time...


    Some pictures:

    Form load


    1st FullScreen

    2nd FullScreen

    Updated the second screenshot to display fullscreen better
    Last edited by jdc20181; Nov 10th, 2016 at 06:30 PM.
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  2. #2

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    P.S. I know the stip menu overlaps Not really worried thats going away soon
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  3. #3
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    Re: Issue with fullscreen code

    Why do you even have this line? What is '2'? You will actively have to put that number in, and remove a specific enumeration....

    Quote Originally Posted by jdc20181 View Post
    ...
    Code:
    ...
    
            Me.WindowState = 2
    ...
    ...
    To maximize your application just make the form maximized: you don't need to mess with the forms size or border.

    Me.WindowState = FormWindowState.Maximized
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  4. #4
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,598

    Re: Issue with fullscreen code

    He doesn't want to maximize the form, he wants to make it "fullscreen", i.e. the client area fills the full screen, no window decorations.

    It does seem like there are extra things in there that aren't needed.
    The following work for me.

    Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
    Me.Size = SystemInformation.PrimaryMonitorSize
    Me.Location = New Point(0, 0)
    Me.TopMost = True

    Since you are processing things in an event handler for a control that you are manipulating, that might be an issue, I don't know.
    I would try to do the control manipulation outside the control's event handler.
    So, put the code into a sub, and then invoke the sub asynchronously to see if that helps.
    For instance, create a sub named makeFullScreen and put the code in there.
    In the event handler asynchronously Invoke the sub by using BeginInvoke:

    Me.BeginInvoke( makeFullScreen)

    That way your code will have left the event handler for the toolstrip before trying to hide the toolstrip.
    Since the toolstrip would want to draw the button pressed in the up state when you release the button, but you've also told it to hide itself during the event, you've created a paradox for the code. Things you've told the form or controls to do that change their appearance don't happen while you're in your code. They happen later when the window gets the messages you've caused by calling those methods, or setting those properties.

    Even doing the code outside the event may not guarantee the hiding and drawing don't conflict, but at least gives it a good chance to work, first time.
    Last edited by passel; Nov 11th, 2016 at 09:08 AM.

  5. #5
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    Re: Issue with fullscreen code

    Quote Originally Posted by passel View Post
    He doesn't want to maximize the form, he wants to make it "fullscreen", i.e. the client area fills the full screen, no window decorations.

    It does seem like there are extra things in there that aren't needed.
    The following work for me.

    Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
    Me.Size = SystemInformation.PrimaryMonitorSize
    Me.Location = New Point(0, 0)
    Me.TopMost = True

    ...
    Ah I see. Well, you can still use maximized and border style none.

    However...

    Changing the border style of a form can cause funky things to happen, in VS2005 it was terrible, and caused events to loose their handlers. In 2010, it's better but can cause some errors (I can easily generate stack overflow errors when changing a form border style).

    I believe changing the style causes the window handle to be recreated (thinking back to the C++ days), but could be wrong.
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  6. #6
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: Issue with fullscreen code

    If this is something that is designed to run "kiosk mode", he can change all the window settings design-time. I've written a number of programs designed to be full-screen dominant, hiding the fact that there's even an operating system running underneath, or an easy way to access it. For things like shop-floor control systems, message-boards being displayed on large, airport style displays, and kiosks, this is just an everyday thing. passel pretty much nailed everything that needs to be done for the basics. Disabling, or making it hard to access the underlying operating system is trickier.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  7. #7

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    Quote Originally Posted by passel View Post
    He doesn't want to maximize the form, he wants to make it "fullscreen", i.e. the client area fills the full screen, no window decorations.



    Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
    Me.Size = SystemInformation.PrimaryMonitorSize
    Me.Location = New Point(0, 0)
    Me.TopMost = True

    Since you are processing things in an event handler for a control that you are manipulating, that might be an issue, I don't know.
    I would try to do the control manipulation outside the control's event handler.
    So, put the code into a sub, and then invoke the sub asynchronously to see if that helps.
    For instance, create a sub named makeFullScreen and put the code in there.
    In the event handler asynchronously Invoke the sub by using BeginInvoke:

    Me.BeginInvoke( makeFullScreen)

    That way your code will have left the event handler for the toolstrip before trying to hide the toolstrip.
    Since the toolstrip would want to draw the button pressed in the up state when you release the button, but you've also told it to hide itself
    Yep that is the goal - to make it "Fullscreen" by doing what I did it hides the task bar (But the issue is it doesn't do it the first time around)

    Quote Originally Posted by SJWhiteley View Post
    Ah I see. Well, you can still use maximized and border style none.

    However...

    Changing the border style of a form can cause funky things to happen, in VS2005 it was terrible, and caused events to loose their handlers. In 2010, it's better but can cause some errors (I can easily generate stack overflow errors when changing a form border style).

    I believe changing the style causes the window handle to be recreated (thinking back to the C++ days), but could be wrong.
    The code hides the task bar because there is no Me.GoFullScreen() Function - So The code is different than what you have been describing.


    Quote Originally Posted by Jenner View Post
    If this is something that is designed to run "kiosk mode", he can change all the window settings design-time. I've written a number of programs designed to be full-screen dominant, hiding the fact that there's even an operating system running underneath, or an easy way to access it. For things like shop-floor control systems, message-boards being displayed on large, airport style displays, and kiosks, this is just an everyday thing. passel pretty much nailed everything that needs to be done for the basics. Disabling, or making it hard to access the underlying operating system is trickier.
    Kisok mode? I have no clue what that is - The project is my browser project. It is a function that all major browsers have.




    If y'all wanna see what it does you can always download it and try it yourself : http://beffsbrowser.tk

    The screenshots made the demo - so you don't need to download but - if you wish ^ there is teh website - Currently in version 1.6.0

    Thanks.


    I am gonna try The suggestion passel said.

    And seeing what the reduced code does.

    However -


    The code should make the taskbar disappear. With the taskbar it isn't fullscreen.


    Thanks again.
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  8. #8

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    Quote Originally Posted by SJWhiteley View Post
    Why do you even have this line? What is '2'? You will actively have to put that number in, and remove a specific enumeration....



    To maximize your application just make the form maximized: you don't need to mess with the forms size or border.

    Me.WindowState = FormWindowState.Maximized
    I think this is a older method to make the screen max (Not liek fullscreen max but max size or something) But not certain - I tried googling to get a good answer but I honestly have no clue. This is a bug I am trying to patch up - Written a while ago.
    Last edited by jdc20181; Nov 11th, 2016 at 11:25 AM.
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  9. #9

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    Not sure what I did wrong - but
    Expression does not produce a value. Is what I get...

    http://screenshot.sh/n8ex90B2ZfUdw
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  10. #10

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    Well good news is the menu stip isn't overlapped anymore (Thanks so much!) Bad news is I can't seem to get it to do it the first time Still.
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Issue with fullscreen code

    Did you try what Passel suggested?

    I've done this, as well, for a splash screen like form that had to behave a bit differently than a real splash screen. I had the settings in design mode rather than in code, so I didn't do the Size or Location, but it's still about the same.
    My usual boring signature: Nothing

  12. #12

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    Quote Originally Posted by Shaggy Hiker View Post
    Did you try what Passel suggested?

    I've done this, as well, for a splash screen like form that had to behave a bit differently than a real splash screen. I had the settings in design mode rather than in code, so I didn't do the Size or Location, but it's still about the same.
    I used the code - And it fixed the overlap of the menu strip (which is great)
    but idk how to invoke it - Because of what I said in post 10...
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  13. #13
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,598

    Re: Issue with fullscreen code

    I don't know that I can offer anything more at this point. I can't look at your links, or any of the images you posted as they are blocked from my work. If I remember, I'll look at them some hours from now so I can see what you're referring to.

  14. #14

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    odd they are blocked....That is the screenshot program I use ScreenShooter. They save only easy peasy...But that is appreciated -
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  15. #15
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,598

    Re: Issue with fullscreen code

    Generally, big business is assuming that file and photo sharing sites are not business related, so doesn't allow access without getting a waiver. Just one of those facts of life, which is one reason posting an image on this forum would be preferred, and it will probably have a longer access, and be more immediate in any case. But large screen captures are discourages, as they will be reduced when posted so can be impossible to read if too large an area is captured.

  16. #16
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Issue with fullscreen code

    Hello,

    See attached project.
    Attached Files Attached Files

  17. #17

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    Quote Originally Posted by kareninstructor View Post
    Hello,

    See attached project.
    I am using VS 2013 (cause 15 won't install it was being dumb) hopefully this will still work.

    I really appreciate you taking the time to do this

    Thanks!!
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  18. #18
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Issue with fullscreen code

    Quote Originally Posted by jdc20181 View Post
    I am using VS 2013 (cause 15 won't install it was being dumb) hopefully this will still work.

    I really appreciate you taking the time to do this

    Thanks!!
    If you can't load the project I have the same project in VS2012 (original project) on OneDrive,

    https://1drv.ms/u/s!AtGAgKKpqdWjhE1QMO-gN8sVEsgK

  19. #19

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    It does still work but I don't understand how you came up with "NormalMode" theres no code for it...Like there is for make fullscreen.
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  20. #20
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Issue with fullscreen code

    Quote Originally Posted by jdc20181 View Post
    It does still work but I don't understand how you came up with "NormalMode" theres no code for it...Like there is for make fullscreen.
    The code is the last method in FormExtensions

  21. #21

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    Thanks!

    So - What do I need to make it fully functioning in my project migrating the essentials?

    From what I can tell (Just recomfirm and I will be marking this resolved)

    - I need the code in the Form Extensions (For the sake of NormalMode.)

    - The MakeFullScreen Sub code.

    Will the "MakeFullScreen" code be enough?

    Thanks again (just trying to understand your code I am still learning even though I have been programming for nearly 2 years)
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  22. #22

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: Issue with fullscreen code

    Edit: I think I got it working just fine now, again Thanks for your help. I am always trying to learn. I have had many people use my browser so making it the best quality I can for my user base is important.

    Thanks!
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  23. #23

    Thread Starter
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,175

    Re: [RESOLVED] Issue with fullscreen code

    Ok so I changed the code from what i had to normalmode() but it still hides the task bar when I Exit fullscreen....
    Disclaimer: When code is given for example - it is merely a example.




    Unless said otherwise indicated - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

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