Home Image-Pro Automation (Macros, Apps, Reports)

App main form size

I am trying to set the size of the initial form. The following code doesn't work, the size is always 793, 1068 (don't know where this came from).  groupbox4 is made invisible so I know the code is being run. 

Private Sub MyControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyControl.Load

        MyControl.AutoSize = False
        MyControl.Width = 230
        MyControl.Height = 800
        groupBox4.Visible = False
   

        ' Initialization code goes here

    End Sub

Best Answer

  • Answer ✓
    Also, you may want try to "Reset Tools Layout" (View->Workspace->Tools) to restore layout for all panels. This fill help if app shows up big/small.

    Nikita.

Answers

  • Paul --

    I believe I was able to duplicate the issue that you have asked about.

    I put your
        MyControl.AutoSize = False
        MyControl.Width = 230
        MyControl.Height = 800
    STATEMENTS into one of my projects.

    These STATEMENTS did not seem to control the size of the dialog box when it was DOCKED or UNDOCKED.

    I also put 
        Debug.Print "MyControl.Width"
    Debug.Print MyControl.Width

    Debug.Print "MyControl.Height"
    Debug.Print MyControl.Height
    into a PUBLIC SUBROUTINE that I could trigger manually to check the values in MYCONTROL.WIDTH and MYCONTROL.HEIGHT any time I wanted.

    The MYCONTROL.WIDTH and MYCONTROL.HEIGHT do not seem to be directly connected or updated continuously from APPLICATION FORM in the PREMIER APPLICATION.

    I also tried
        mycontrol.SetBounds(1,1,230,800)
    and was not successful.

    I hope this information is helpful.

    -- Matt
  • I also tried :
    MyControl.Size.Width = 230
    MyControl.Size.Height = 230
    Even if I resize the window in 'designer' it always changes back to a large window when I run the app. I would be happy just to set it in design mode but I can't.

  • Paul --

    Can you provide SCREEN CAPTURES that illustrate the results you are getting and the results that you desire?

    Thanks.

    -- Matt
  • Paul,

    I agree with Matt, it would be helpful to see what you are trying. Just to clarify, I understand that you are creating a new form in the Project Workbench (not an App), can you share the code used to bring up the form? In my own testing the form size can be set using the designer. I then bring it up using this code and the form uses the dimensions set in the designer:
        Sub TestForm
            Dim f As New Form1
            f.Form.Show
        End Sub
    
    Pierre
  • If I understand correctly, the idea is to have the app's form in the designer as big as you need, but resize it before showing. I'm using this in several apps. Try this:
        Public Sub New()
            MyControl.Width = 220
        End Sub
    The issue, you cannot use "New" in the compiled mode.

    Thanks,
    Nikita.
  • NikitaRG said:
    Also, you may want try to "Reset Tools Layout" (View->Workspace->Tools) to restore layout for all panels. This fill help if app shows up big/small.

    Nikita.

  • Yes this worked - now it remembers the size when I set it interactively.
  • NikitaRG said:
    If I understand correctly, the idea is to have the app's form in the designer as big as you need, but resize it before showing. I'm using this in several apps. Try this:
        Public Sub New()
            MyControl.Width = 220
        End Sub
    The issue, you cannot use "New" in the compiled mode.

    Thanks,
    Nikita.

  • couldn't make this work but it now remembers the size when I set it interactively so all is well.  Thanks.
  • PierreD said:
    Paul,

    I agree with Matt, it would be helpful to see what you are trying. Just to clarify, I understand that you are creating a new form in the Project Workbench (not an App), can you share the code used to bring up the form? In my own testing the form size can be set using the designer. I then bring it up using this code and the form uses the dimensions set in the designer:
        Sub TestForm
            Dim f As New Form1
            f.Form.Show
        End Sub
    
    Pierre

  • Yes I am creating an app but I'm new to this. Here is my code. I see that it says ' Initialization code goes here' so I try to change the form size - I guess that 'MyControl' is not the name of the form.

    In this example  
    groupBox4.Visible = False works but changing the form size does not. 

    Perhaps it is easier just to pose the question - 'how do I set the size of the app form when it is started?'

    Thanks for your help. 

    Imports MediaCy.Addins.Measurements
    Imports MediaCy.Addins.ThresholdTool
    Public Class psapp1
    
        Private Sub MyControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyControl.Load
    
            MyControl.AutoSize = False
            MyControl.Size.Width = 230
            MyControl.Size.Height = 230
    
            groupBox4.Visible = False
            
    
            ' Initialization code goes here
    
        End Sub
    





Sign In or Register to comment.