Click here to Skip to main content
14,266,286 members
   

C#

 
GeneralRe: WinForms, Window with FormBorderStyle.None and Taskbar moved doesn't adjust to new size Pin
Eddy Vluggen28-May-19 23:30
mveEddy Vluggen28-May-19 23:30 
GeneralRe: WinForms, Window with FormBorderStyle.None and Taskbar moved doesn't adjust to new size Pin
Ken Guru29-May-19 4:24
memberKen Guru29-May-19 4:24 
AnswerRe: WinForms, Window with FormBorderStyle.None and Taskbar moved doesn't adjust to new size Pin
BillWoodruff28-May-19 15:52
mveBillWoodruff28-May-19 15:52 
GeneralRe: WinForms, Window with FormBorderStyle.None and Taskbar moved doesn't adjust to new size Pin
Ken Guru28-May-19 21:54
memberKen Guru28-May-19 21:54 
GeneralRe: WinForms, Window with FormBorderStyle.None and Taskbar moved doesn't adjust to new size Pin
BillWoodruff29-May-19 3:17
mveBillWoodruff29-May-19 3:17 
AnswerRe: WinForms, Window with FormBorderStyle.None and Taskbar moved doesn't adjust to new size Pin
Gerry Schmitz29-May-19 3:47
mveGerry Schmitz29-May-19 3:47 
GeneralRe: WinForms, Window with FormBorderStyle.None and Taskbar moved doesn't adjust to new size Pin
Ken Guru29-May-19 4:28
memberKen Guru29-May-19 4:28 
AnswerRe: WinForms, Window with FormBorderStyle.None and Taskbar moved doesn't adjust to new size Pin
BillWoodruff29-May-19 7:12
mveBillWoodruff29-May-19 7:12 
@Ken-Guru I think I've found a way to get you somewhat there: this works for me in VS 2017 using .NET 4.7. I set the Form 'WindowState to 'Normal, and the 'StartPosition to 'Manual because ... those settings "worked."

I tried using the old P/Invokes ... FindWindow and IsWindowVisible ... to try to get the state of TaskBar visibility, but kept getting a 'visible result even when the TaskBar was hidden.

Hopefully, you can take it from here, and please do post any better technique you may come up with.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.Win32;

namespace MaxonTBarChange
{
    public partial class Form1 : Form
    {
        public Rectangle AppBounds;

        public Form1()
        {
            InitializeComponent();

            AppBounds = Screen.PrimaryScreen.WorkingArea;

            this.Bounds = AppBounds;

            SystemEvents.UserPreferenceChanged += SystemEventsOnUserPreferenceChanged;

            this.Closing += OnClosing;
        }

        private void OnClosing(object sender, CancelEventArgs e)
        {
            SystemEvents.UserPreferenceChanged -= SystemEventsOnUserPreferenceChanged;
        }

        private void SystemEventsOnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
        {
            // changing TaskBar location: category: 'Desktop
            // Console.WriteLine(e.Category.ToString());

            var bnds = Screen.PrimaryScreen.WorkingArea;

            if (AppBounds != bnds)
            {
                AppBounds = bnds;
                this.Bounds = AppBounds;
            }
        }
    }
}

«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot


modified 31-May-19 2:17am.

QuestionC# using class library how to get download pdf link in mail Pin
Member 1447263827-May-19 20:28
memberMember 1447263827-May-19 20:28 
AnswerRe: C# using class library how to get download pdf link in mail PinPopular
OriginalGriff27-May-19 20:30
protectorOriginalGriff27-May-19 20:30 
AnswerRe: C# using class library how to get download pdf link in mail Pin
Dave Kreskowiak28-May-19 4:35
mveDave Kreskowiak28-May-19 4:35 
QuestionC# 8's 'switch syntax gives me the willies Pin
BillWoodruff27-May-19 0:57
mveBillWoodruff27-May-19 0:57 
AnswerRe: C# 8's 'switch syntax gives me the willies Pin
OriginalGriff27-May-19 1:56
protectorOriginalGriff27-May-19 1:56 
GeneralRe: C# 8's 'switch syntax gives me the willies Pin
BillWoodruff27-May-19 2:25
mveBillWoodruff27-May-19 2:25 
AnswerRe: C# 8's 'switch syntax gives me the willies Pin
#realJSOP27-May-19 7:28
mve#realJSOP27-May-19 7:28 
GeneralRe: C# 8's 'switch syntax gives me the willies Pin
OriginalGriff27-May-19 8:05
protectorOriginalGriff27-May-19 8:05 
GeneralRe: C# 8's 'switch syntax gives me the willies Pin
#realJSOP27-May-19 9:18
mve#realJSOP27-May-19 9:18 
GeneralRe: C# 8's 'switch syntax gives me the willies Pin
Eddy Vluggen27-May-19 10:04
mveEddy Vluggen27-May-19 10:04 
GeneralRe: C# 8's 'switch syntax gives me the willies Pin
OriginalGriff27-May-19 19:57
protectorOriginalGriff27-May-19 19:57 
GeneralRe: C# 8's 'switch syntax gives me the willies Pin
Eddy Vluggen28-May-19 11:15
mveEddy Vluggen28-May-19 11:15 
QuestionHow to get the Count of webseit visitors using Razor ASP.Core ? Pin
Abdalla Ben Omran26-May-19 23:43
memberAbdalla Ben Omran26-May-19 23:43 
AnswerRe: How to get the Count of webseit visitors using Razor ASP.Core ? Pin
OriginalGriff27-May-19 0:43
protectorOriginalGriff27-May-19 0:43 
GeneralRe: How to get the Count of webseit visitors using Razor ASP.Core ? Pin
Abdalla Ben Omran27-May-19 0:59
memberAbdalla Ben Omran27-May-19 0:59 
GeneralRe: How to get the Count of webseit visitors using Razor ASP.Core ? Pin
OriginalGriff27-May-19 1:05
protectorOriginalGriff27-May-19 1:05 
GeneralRe: How to get the Count of webseit visitors using Razor ASP.Core ? Pin
Abdalla Ben Omran27-May-19 1:56
memberAbdalla Ben Omran27-May-19 1:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.