Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Borderless Krypton Form, Maximized, Top Most = True > Fullscreen does not overlap on task bar. #1037

Open
pgaraneta opened this issue Jul 1, 2023 · 10 comments
Labels
bug Something isn't working regression Something was working in a previous release, but isn't working now.
Milestone

Comments

@pgaraneta
Copy link

Describe the bug
In a multi screen setup, having a Borderless Krypton Form, Window state set to Maximized and Top Most = True, does not go fully full screen and does not overlap the task bar.

To Reproduce
Steps to reproduce the behavior:

  1. Create project, set form Border style to None.
  2. Set window state to Maximized
  3. Top most = true
  4. Launch.

Expected behavior
Borderless form, after loading should be full screen and overlap the windows task bar.

Desktop (please complete the following information):

  • OS: Windows 11 Home 22H2
  • Version Windows Feature Experience Pack 1000.22642.1000.0

Additional context
Add any other context about the problem here.

@pgaraneta pgaraneta added the bug Something isn't working label Jul 1, 2023
@Smurf-IV
Copy link
Member

Smurf-IV commented Jul 2, 2023

Does a winform "Go over" the taskbar when FullScreen ??

@pgaraneta
Copy link
Author

Yes, borderless windows form, when maximized and set on top, goes over the taskbar.

@Wagnerp
Copy link
Contributor

Wagnerp commented Jul 2, 2023

Might be possible to delve into the winforms repo to see if anything is missing?

@Wagnerp
Copy link
Contributor

Wagnerp commented Jul 4, 2023

@Smurf-IV The property MdiChildrenMinimizedAnchorBottom is also missing from KForm?

@Wagnerp
Copy link
Contributor

Wagnerp commented Jul 4, 2023

Found the code, WinForms repository -> Forms, lines 5105 - 5123

 // Only enforce the minimum size if the form has a border and is a top
        // level form.
        FormBorderStyle borderStyle = FormBorderStyle;
        if (borderStyle != FormBorderStyle.None
            && borderStyle != FormBorderStyle.FixedToolWindow
            && borderStyle != FormBorderStyle.SizableToolWindow
            && ParentInternal is null)
        {
            Size min = SystemInformation.MinWindowTrackSize;
            if (height < min.Height)
            {
                height = min.Height;
            }

            if (width < min.Width)
            {
                width = min.Width;
            }
        }

@Wagnerp
Copy link
Contributor

Wagnerp commented Jul 4, 2023

@pgaraneta & @Smurf-IV, A lot is missing from KForm vs form

KForm

   protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
        {
            var updatedHeight = height;

            // With the Aero glass appearance we need to reduce height by the top border, 
            // otherwise each time the window is maximized and restored it grows in size
            if (ApplyComposition && (FormBorderStyle != FormBorderStyle.None))
            {
                updatedHeight = height - RealWindowBorders.Top;
            }

            base.SetBoundsCore(x, y, width, updatedHeight, specified);
        }

Form

 [EditorBrowsable(EditorBrowsableState.Advanced)]
    protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
    {
        if (WindowState != FormWindowState.Normal)
        {
            // See RestoreWindowBoundsIfNecessary for an explanation of this
            // Only restore position when x,y is not -1,-1
            if (x != -1 || y != -1)
            {
                _restoredWindowBoundsSpecified |= (specified & (BoundsSpecified.X | BoundsSpecified.Y));
            }

            _restoredWindowBoundsSpecified |= (specified & (BoundsSpecified.Width | BoundsSpecified.Height));

            if ((specified & BoundsSpecified.X) != 0)
            {
                _restoredWindowBounds.X = x;
            }

            if ((specified & BoundsSpecified.Y) != 0)
            {
                _restoredWindowBounds.Y = y;
            }

            if ((specified & BoundsSpecified.Width) != 0)
            {
                _restoredWindowBounds.Width = width;
                _formStateEx[FormStateExWindowBoundsWidthIsClientSize] = 0;
            }

            if ((specified & BoundsSpecified.Height) != 0)
            {
                _restoredWindowBounds.Height = height;
                _formStateEx[FormStateExWindowBoundsHeightIsClientSize] = 0;
            }
        }

        // Update RestoreBounds
        if ((specified & BoundsSpecified.X) != 0)
        {
            _restoreBounds.X = x;
        }

        if ((specified & BoundsSpecified.Y) != 0)
        {
            _restoreBounds.Y = y;
        }

        if ((specified & BoundsSpecified.Width) != 0 || _restoreBounds.Width == -1)
        {
            _restoreBounds.Width = width;
        }

        if ((specified & BoundsSpecified.Height) != 0 || _restoreBounds.Height == -1)
        {
            _restoreBounds.Height = height;
        }

        // Enforce maximum size...
        if (WindowState == FormWindowState.Normal && (Height != height || Width != width))
        {
            Size max = SystemInformation.MaxWindowTrackSize;
            if (height > max.Height)
            {
                height = max.Height;
            }

            if (width > max.Width)
            {
                width = max.Width;
            }
        }

        // Only enforce the minimum size if the form has a border and is a top
        // level form.
        FormBorderStyle borderStyle = FormBorderStyle;
        if (borderStyle != FormBorderStyle.None
            && borderStyle != FormBorderStyle.FixedToolWindow
            && borderStyle != FormBorderStyle.SizableToolWindow
            && ParentInternal is null)
        {
            Size min = SystemInformation.MinWindowTrackSize;
            if (height < min.Height)
            {
                height = min.Height;
            }

            if (width < min.Width)
            {
                width = min.Width;
            }
        }

        base.SetBoundsCore(x, y, width, height, specified);
    }

@Smurf-IV
Copy link
Member

Still confused by this statement:

@pgaraneta & @Smurf-IV, A lot is missing from KForm vs form

Because the KForm overrides, and then calls the base class ????
So it will go into the Form version anyway !

@Smurf-IV Smurf-IV self-assigned this Sep 30, 2023
@Smurf-IV Smurf-IV added the in progress A fix for this issue is in the works. label Sep 30, 2023
Smurf-IV added a commit that referenced this issue Sep 30, 2023
- Fix a few nullables
- mask the confusing warning
  - #Warning CS8622 Nullability of reference types in type of parameter 'sender' of 'void

#1037
@Smurf-IV Smurf-IV added completed This issue has been completed. and removed in progress A fix for this issue is in the works. labels Sep 30, 2023
@Smurf-IV Smurf-IV removed their assignment Sep 30, 2023
@Smurf-IV Smurf-IV added this to the Version 8 milestone Sep 30, 2023
@Wagnerp
Copy link
Contributor

Wagnerp commented Dec 17, 2023

@Smurf-IV Using today's alpha (debug), it seems to not work anymore?

1037

@Wagnerp Wagnerp reopened this Dec 17, 2023
@Smurf-IV Smurf-IV added regression Something was working in a previous release, but isn't working now. and removed completed This issue has been completed. labels Jan 3, 2024
@Smurf-IV
Copy link
Member

Smurf-IV commented Jan 3, 2024

@Wagnerp Should this be fixed and merged back into V80 ?
Also I noticed that once one of those buttons has been pressed then it will not go back into "FullScreen" - tested on Win 10

@Wagnerp
Copy link
Contributor

Wagnerp commented Jan 3, 2024

@Wagnerp Should this be fixed and merged back into V80 ? Also I noticed that once one of those buttons has been pressed then it will not go back into "FullScreen" - tested on Win 10

@Smurf-IV If it's going to be a simple fix then yes. Trying to avoid the 'merge madness' that happened between V70 & V80 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Something was working in a previous release, but isn't working now.
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants