How do I force a control to use the whole page?

KarlRhodesKarlRhodes Member Posts: 37
edited 2012-08-20 in NAV Three Tier
Hi All.

I'm new here so go easy on me!

I'm also fairly new to Navision and have been dropped in the deep and told I need to create a .Net schedule control for use in the RTC. I've managed to find out how to create an addin and have successfully got it loaded in a page. I can even use it in the RTC if I run the page. Amazing!

However, it needs to be scaled to fill the whole screen. Currently it's static at about 900pixels wide and around 300ish high. obviously, if a user resizes the page, or for users on different resolution screens, the size of the control needs to adjust depending on the page size. In winforms, there is a property called "Dock" that can force a control to fill all of the space available to it. Unfortunately, because my control is a custom usercontrol, this option isn't available to me, and I'm not sure it would be relevant anyway. This setting, or one similar would need to be in Navision surely?

So, to my actual question...

How do I force an addin control to populate the entire page (or container) is resides in, and have it rescale when the page size changes?

Many thanks,
Karl

Comments

  • SavatageSavatage Member Posts: 7,142
    Have you played with the Anchor property?
    in the properties pane, change the Anchor property to Top, Bottom, Left, Right. This is a bit like setting Horizontal Glue and Vertical Glue properties in C/SIDE to both so that the control will resize when the form is resized.
  • deV.chdeV.ch Member Posts: 543
    Well actually, Dock is what you need and it has the expected effect.

    Just dock.Fill the control you pass back on the CreateControl Method!
  • KarlRhodesKarlRhodes Member Posts: 37
    deV.ch wrote:
    Well actually, Dock is what you need and it has the expected effect.

    Just dock.Fill the control you pass back on the CreateControl Method!

    Yep, this worked! I was looking in the wrong place for the Dock feature. Thanks for putting me right.


    However, now my custom control seems to be too big for the page?

    While I can resize the RTC window and the control resizes within it, it seems to be that the control is around 100 pixels wider and taller than the page displaying it? Do you have any idea whay this would be? Currently, to get it to fit "properly", I'm having to expand the design of the user control background Panel by approximately 100 pixels to the right and the same to the bottom so the bottom left of the RTC page shows the bottom left of the control?
  • kinekine Member Posts: 12,562
    May be there are some margins in your object. Just set them to 0.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • KarlRhodesKarlRhodes Member Posts: 37
    Fixed it.

    The problem was down to the .Net control having an "AutoScaleMode" set to "Font".

    I changed this to "Inherit" and now my control is the correct size on all platforms.
Sign In or Register to comment.