winforms tab does not fit the window size











up vote
0
down vote

favorite












I created a .NET Framework 4.0 winforms project and added a "tab" as you can see in the following picture:



enter image description here



From the View Designer both tabs (Profile and Features) looks like they fit the rectangle window, but when I run the program, the "Profile" tab looks the same but the "Features" tab suddenly does not fit the rectangle anymore and looks like that:



enter image description here



I don't want to give the user the option to enlarge the window.



I am wondering why it looks like it fit the rectangle window but when I run the application, it does not.



This is the "Features" tab from the MainForm:



        this.TabPage2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.TabPage2.Controls.Add(this.listBoxShowFriendsBirthday);
this.TabPage2.Controls.Add(this.buttonShowFriendsBirthday);
this.TabPage2.Controls.Add(this.label1);
this.TabPage2.Controls.Add(this.monthCalendar1);
this.TabPage2.Controls.Add(this.postTextBox);
this.TabPage2.Controls.Add(this.pictureBoxEvent);
this.TabPage2.Controls.Add(this.listBoxFetchEvents);
this.TabPage2.Controls.Add(this.buttonFetchEvents);
this.TabPage2.Controls.Add(this.postButton);
this.TabPage2.Location = new System.Drawing.Point(8, 39);
this.TabPage2.Name = "tabPage2";
this.TabPage2.Padding = new System.Windows.Forms.Padding(3);
this.TabPage2.Size = new System.Drawing.Size(1976, 806);
this.TabPage2.TabIndex = 1;
this.TabPage2.Text = "Features";
this.TabPage2.UseVisualStyleBackColor = true;









share|improve this question
























  • Is your application DPI-Aware? I assume it's not. Read here: How to configure an app to run correctly on a machine with a high DPI setting. Some notes I've written: (these are being updated).
    – Jimi
    Nov 22 at 13:34

















up vote
0
down vote

favorite












I created a .NET Framework 4.0 winforms project and added a "tab" as you can see in the following picture:



enter image description here



From the View Designer both tabs (Profile and Features) looks like they fit the rectangle window, but when I run the program, the "Profile" tab looks the same but the "Features" tab suddenly does not fit the rectangle anymore and looks like that:



enter image description here



I don't want to give the user the option to enlarge the window.



I am wondering why it looks like it fit the rectangle window but when I run the application, it does not.



This is the "Features" tab from the MainForm:



        this.TabPage2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.TabPage2.Controls.Add(this.listBoxShowFriendsBirthday);
this.TabPage2.Controls.Add(this.buttonShowFriendsBirthday);
this.TabPage2.Controls.Add(this.label1);
this.TabPage2.Controls.Add(this.monthCalendar1);
this.TabPage2.Controls.Add(this.postTextBox);
this.TabPage2.Controls.Add(this.pictureBoxEvent);
this.TabPage2.Controls.Add(this.listBoxFetchEvents);
this.TabPage2.Controls.Add(this.buttonFetchEvents);
this.TabPage2.Controls.Add(this.postButton);
this.TabPage2.Location = new System.Drawing.Point(8, 39);
this.TabPage2.Name = "tabPage2";
this.TabPage2.Padding = new System.Windows.Forms.Padding(3);
this.TabPage2.Size = new System.Drawing.Size(1976, 806);
this.TabPage2.TabIndex = 1;
this.TabPage2.Text = "Features";
this.TabPage2.UseVisualStyleBackColor = true;









share|improve this question
























  • Is your application DPI-Aware? I assume it's not. Read here: How to configure an app to run correctly on a machine with a high DPI setting. Some notes I've written: (these are being updated).
    – Jimi
    Nov 22 at 13:34















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I created a .NET Framework 4.0 winforms project and added a "tab" as you can see in the following picture:



enter image description here



From the View Designer both tabs (Profile and Features) looks like they fit the rectangle window, but when I run the program, the "Profile" tab looks the same but the "Features" tab suddenly does not fit the rectangle anymore and looks like that:



enter image description here



I don't want to give the user the option to enlarge the window.



I am wondering why it looks like it fit the rectangle window but when I run the application, it does not.



This is the "Features" tab from the MainForm:



        this.TabPage2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.TabPage2.Controls.Add(this.listBoxShowFriendsBirthday);
this.TabPage2.Controls.Add(this.buttonShowFriendsBirthday);
this.TabPage2.Controls.Add(this.label1);
this.TabPage2.Controls.Add(this.monthCalendar1);
this.TabPage2.Controls.Add(this.postTextBox);
this.TabPage2.Controls.Add(this.pictureBoxEvent);
this.TabPage2.Controls.Add(this.listBoxFetchEvents);
this.TabPage2.Controls.Add(this.buttonFetchEvents);
this.TabPage2.Controls.Add(this.postButton);
this.TabPage2.Location = new System.Drawing.Point(8, 39);
this.TabPage2.Name = "tabPage2";
this.TabPage2.Padding = new System.Windows.Forms.Padding(3);
this.TabPage2.Size = new System.Drawing.Size(1976, 806);
this.TabPage2.TabIndex = 1;
this.TabPage2.Text = "Features";
this.TabPage2.UseVisualStyleBackColor = true;









share|improve this question















I created a .NET Framework 4.0 winforms project and added a "tab" as you can see in the following picture:



enter image description here



From the View Designer both tabs (Profile and Features) looks like they fit the rectangle window, but when I run the program, the "Profile" tab looks the same but the "Features" tab suddenly does not fit the rectangle anymore and looks like that:



enter image description here



I don't want to give the user the option to enlarge the window.



I am wondering why it looks like it fit the rectangle window but when I run the application, it does not.



This is the "Features" tab from the MainForm:



        this.TabPage2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.TabPage2.Controls.Add(this.listBoxShowFriendsBirthday);
this.TabPage2.Controls.Add(this.buttonShowFriendsBirthday);
this.TabPage2.Controls.Add(this.label1);
this.TabPage2.Controls.Add(this.monthCalendar1);
this.TabPage2.Controls.Add(this.postTextBox);
this.TabPage2.Controls.Add(this.pictureBoxEvent);
this.TabPage2.Controls.Add(this.listBoxFetchEvents);
this.TabPage2.Controls.Add(this.buttonFetchEvents);
this.TabPage2.Controls.Add(this.postButton);
this.TabPage2.Location = new System.Drawing.Point(8, 39);
this.TabPage2.Name = "tabPage2";
this.TabPage2.Padding = new System.Windows.Forms.Padding(3);
this.TabPage2.Size = new System.Drawing.Size(1976, 806);
this.TabPage2.TabIndex = 1;
this.TabPage2.Text = "Features";
this.TabPage2.UseVisualStyleBackColor = true;






c# .net winforms






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 at 8:11









Lennart

5,945124965




5,945124965










asked Nov 22 at 8:04









I.zvi

1009




1009












  • Is your application DPI-Aware? I assume it's not. Read here: How to configure an app to run correctly on a machine with a high DPI setting. Some notes I've written: (these are being updated).
    – Jimi
    Nov 22 at 13:34




















  • Is your application DPI-Aware? I assume it's not. Read here: How to configure an app to run correctly on a machine with a high DPI setting. Some notes I've written: (these are being updated).
    – Jimi
    Nov 22 at 13:34


















Is your application DPI-Aware? I assume it's not. Read here: How to configure an app to run correctly on a machine with a high DPI setting. Some notes I've written: (these are being updated).
– Jimi
Nov 22 at 13:34






Is your application DPI-Aware? I assume it's not. Read here: How to configure an app to run correctly on a machine with a high DPI setting. Some notes I've written: (these are being updated).
– Jimi
Nov 22 at 13:34














2 Answers
2






active

oldest

votes

















up vote
0
down vote













I suggest you to use Dock and Anchor properties of controls. This way you can also allow to user resizing the window.



Dock:



enter image description here



Anchor:



enter image description here



See - How to: Anchor and Dock Child Controls in a FlowLayoutPanel Control






share|improve this answer





















  • I want to leave the window size as is and don't let the user play with it
    – I.zvi
    Nov 22 at 8:28










  • Anyway, if you use Dock and Anchor properties you will get what you need. Give a try
    – ikram
    Nov 22 at 8:30


















up vote
0
down vote













To prevent the user from rescaling their window:
c# how to prevent user from resizing my application window?



but aside from that, I'd suggest, (just like ikram said) to use docking, that way you're certain your lay-out will remain, no matter the resolution/screensize the user has.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426338%2fwinforms-tab-does-not-fit-the-window-size%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    I suggest you to use Dock and Anchor properties of controls. This way you can also allow to user resizing the window.



    Dock:



    enter image description here



    Anchor:



    enter image description here



    See - How to: Anchor and Dock Child Controls in a FlowLayoutPanel Control






    share|improve this answer





















    • I want to leave the window size as is and don't let the user play with it
      – I.zvi
      Nov 22 at 8:28










    • Anyway, if you use Dock and Anchor properties you will get what you need. Give a try
      – ikram
      Nov 22 at 8:30















    up vote
    0
    down vote













    I suggest you to use Dock and Anchor properties of controls. This way you can also allow to user resizing the window.



    Dock:



    enter image description here



    Anchor:



    enter image description here



    See - How to: Anchor and Dock Child Controls in a FlowLayoutPanel Control






    share|improve this answer





















    • I want to leave the window size as is and don't let the user play with it
      – I.zvi
      Nov 22 at 8:28










    • Anyway, if you use Dock and Anchor properties you will get what you need. Give a try
      – ikram
      Nov 22 at 8:30













    up vote
    0
    down vote










    up vote
    0
    down vote









    I suggest you to use Dock and Anchor properties of controls. This way you can also allow to user resizing the window.



    Dock:



    enter image description here



    Anchor:



    enter image description here



    See - How to: Anchor and Dock Child Controls in a FlowLayoutPanel Control






    share|improve this answer












    I suggest you to use Dock and Anchor properties of controls. This way you can also allow to user resizing the window.



    Dock:



    enter image description here



    Anchor:



    enter image description here



    See - How to: Anchor and Dock Child Controls in a FlowLayoutPanel Control







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 22 at 8:11









    ikram

    2,0692922




    2,0692922












    • I want to leave the window size as is and don't let the user play with it
      – I.zvi
      Nov 22 at 8:28










    • Anyway, if you use Dock and Anchor properties you will get what you need. Give a try
      – ikram
      Nov 22 at 8:30


















    • I want to leave the window size as is and don't let the user play with it
      – I.zvi
      Nov 22 at 8:28










    • Anyway, if you use Dock and Anchor properties you will get what you need. Give a try
      – ikram
      Nov 22 at 8:30
















    I want to leave the window size as is and don't let the user play with it
    – I.zvi
    Nov 22 at 8:28




    I want to leave the window size as is and don't let the user play with it
    – I.zvi
    Nov 22 at 8:28












    Anyway, if you use Dock and Anchor properties you will get what you need. Give a try
    – ikram
    Nov 22 at 8:30




    Anyway, if you use Dock and Anchor properties you will get what you need. Give a try
    – ikram
    Nov 22 at 8:30












    up vote
    0
    down vote













    To prevent the user from rescaling their window:
    c# how to prevent user from resizing my application window?



    but aside from that, I'd suggest, (just like ikram said) to use docking, that way you're certain your lay-out will remain, no matter the resolution/screensize the user has.






    share|improve this answer

























      up vote
      0
      down vote













      To prevent the user from rescaling their window:
      c# how to prevent user from resizing my application window?



      but aside from that, I'd suggest, (just like ikram said) to use docking, that way you're certain your lay-out will remain, no matter the resolution/screensize the user has.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        To prevent the user from rescaling their window:
        c# how to prevent user from resizing my application window?



        but aside from that, I'd suggest, (just like ikram said) to use docking, that way you're certain your lay-out will remain, no matter the resolution/screensize the user has.






        share|improve this answer












        To prevent the user from rescaling their window:
        c# how to prevent user from resizing my application window?



        but aside from that, I'd suggest, (just like ikram said) to use docking, that way you're certain your lay-out will remain, no matter the resolution/screensize the user has.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 22 at 8:40









        Dennis Vanhout

        554




        554






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426338%2fwinforms-tab-does-not-fit-the-window-size%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Catalogne

            Violoncelliste

            Héron pourpré