none
Images resize RRS feed

  • Question

  • Hey guys.

    I am using a higher resolution than what I coded at.  It stretches the content.  Can I set my buttons, pictureboxes to not adjust in anyway other than coding a calculating of each element and resizing based on screen size?  I don't usually change the anchor settings.  Is that necessary to keep them from adjusting?


    • Edited by -tE Sunday, March 5, 2017 11:17 AM
    Sunday, March 5, 2017 11:07 AM

All replies

  • No, there is no way to show a window which is not according to the (pixel) format of that screen. 

    In other words you cannot create a window on which you lay a physical picture on a photo sheet and see that then exactly the same on all kind of screens. (For instance on a smartphone only see a part of the image while on a 50" TV only a little thing.)


    Success
    Cor

    Sunday, March 5, 2017 12:10 PM
  • tE,

    You will need to describe exactly what you mean. Do you want your app to remain a constant size in pixels? And when you say higher resolution what do you mean? Larger screen size in pixels or windows scaling set to 125 percent, 150 percent etc.

    Show a picture of what the problem is now with your project and what you want it to look like.

    We cant suggest exactly how to change it unless we know exactly what it is now and what to change it to.

    Sunday, March 5, 2017 12:32 PM
  • Core and Tommy,

        I believe the resolution of the screen that is adjusting is 1920X1000.  My laptop is 1366x768.    The larger screen is stretching the graphics of all my components.  I have a minimum size set and the autoSizeMode is set to GrowOnly which is preset.  I am not really able to get a screen shot off the other screen.  I have a graphics program on my laptop,  but not the other machine.

    I just discovered that on my laptop,  when I adjust the resolution to say 1280X600,  it simply makes the program scrollable vertically.  Does not resize.  I am using the Windows video driver.  Maybe this is the trouble?  We think I may need a stronger power supply to run the nVidia drivers meant for the video card so I can't test it.



     


    • Edited by -tE Sunday, March 5, 2017 8:41 PM
    Sunday, March 5, 2017 7:56 PM
  • Core and Tommy,

        I believe the resolution of the screen that is adjusting is 1920X1000.  My laptop is 1366x768.    The larger screen is stretching the graphics of all my components.  I have a minimum size set and the autoSizeMode is set to GrowOnly which is preset.  I am not really able to get a screen shot off the other screen.  I have a graphics program on my laptop,  but not the other machine.

    I just discovered that on my laptop,  when I adjust the resolution to say 1280X600,  it simply makes the program scrollable vertically.  Does not resize.  I am using the Windows video driver.  Maybe this is the trouble?  We think I may need a stronger power supply to run the nVidia drivers meant for the video card so I can't test it.



     


    What you describe is the behavior of the autosize property of a form. If you dont want the form to grow beyond the minimum size then set autosize = false.

    For example add a label to an empty form and put a long text string in the label. When autosize is true the form with grow to surround the label.

    The Dock and Anchor properties also affect how a control is sized.

    Finally the windows scaling setting in control panel affects how big fonts and images appear on the form.

    Dpi aware apps.



    Sunday, March 5, 2017 10:54 PM
  • Core and Tommy,

        I believe the resolution of the screen that is adjusting is 1920X1000.  My laptop is 1366x768.    The larger screen is stretching the graphics of all my components.  I have a minimum size set and the autoSizeMode is set to GrowOnly which is preset.  I am not really able to get a screen shot off the other screen.  I have a graphics program on my laptop,  but not the other machine.

    I just discovered that on my laptop,  when I adjust the resolution to say 1280X600,  it simply makes the program scrollable vertically.  Does not resize.  I am using the Windows video driver.  Maybe this is the trouble?  We think I may need a stronger power supply to run the nVidia drivers meant for the video card so I can't test it.



     


    What you describe is the behavior of the autosize property of a form. If you dont want the form to grow beyond the minimum size then set autosize = false.

    For example add a label to an empty form and put a long text string in the label. When autosize is true the form with grow to surround the label.

    The Dock and Anchor properties also affect how a control is sized.

    Finally the windows scaling setting in control panel affects how big fonts and images appear on the form.

    Dpi aware apps.



    The autosize has been already at false.  The graphics aren't resizing.  They are just disproportionate.  For instance,  circles are ovals.  I wondered if the docking and anchoring would help,  but that isn't consistent in my test.  I have a second monitor which is 1280X1020 and it doesn't adjust or resize anything so I wonder if my video card is doing this.  Other softwares don't seem to be though.

    What about setting it to growAndShrink instead of just growOnly?  It isn't making any difference in my laptop view either way.


    Also, the AutoScaleMode is set to font.  Try "None"?

    • Edited by -tE Monday, March 6, 2017 4:41 AM
    Monday, March 6, 2017 4:10 AM

  • The autosize has been already at false.  The graphics aren't resizing.  They are just disproportionate.  For instance,  circles are ovals.  I wondered if the docking and anchoring would help,  but that isn't consistent in my test.  I have a second monitor which is 1280X1020 and it doesn't adjust or resize anything so I wonder if my video card is doing this.  Other softwares don't seem to be though.

    What about setting it to growAndShrink instead of just growOnly?  It isn't making any difference in my laptop view either way.


    Also, the AutoScaleMode is set to font.  Try "None"?

    I dont think its related to your video card.

    It sounds like you want your form graphics to remain a constant size? If the form border is made larger you see more graphics but the size is unchanged. So turn off all autosizing for this.

    I think you want Autosize and AutoScaleMode = false. Autosizemode only works when autosize is true.

    If your circles are drawing as ovals then your graphics drawing must be scaling the graphics surface ie picturebox somehow. And either that must have an error and or your picturebox is changing its size and your graphics code is not dealing with it properly.

    You should make and post a simple one form example of the problem. Just a form with a similar setup and draw the circle the same way as you large project. Then we can see what is happening.You will probably realize what is happening in trying to make the example to reproduce it.

    Or post the relevant code from your graphics drawing that draws the circle you say changes size. You must be using the bounds of the control you draw into in one direction and not the other thus you get the oval circle when the picturebox changes size.

    So you 1. need to figure what changes the picturebox size and 2. why your graphics drawing does not deal with it properly.

    We cant guess what it is from here.

    Monday, March 6, 2017 12:56 PM
  • Tommy and OP.

    The program only recognize the computer it is running on. That is also with autosize. 

    So I'm curious, how would you get a image on screen which is in true dimensions always the same as on other computers. 

    Then you should give the dimensions in real live measurements. I've never seen possibilities around that in a VB program.


    Success
    Cor

    Monday, March 6, 2017 1:31 PM
  • Tommy and OP.

    The program only recognize the computer it is running on. That is also with autosize. 

    So I'm curious, how would you get a image on screen which is in true dimensions always the same as on other computers. 

    Then you should give the dimensions in real live measurements. I've never seen possibilities around that in a VB program.


    Success
    Cor

    Yes that is right Cor. For real life dimensions measured on a monitor with a ruler.

    What I mean by same size is same size in pixels on the same monitor. Same size means as the form is resized the graphics do not change size, in pixels, the controls do not change size in pixels. As compared with when the form is resized and the graphics and controls resize ie get larger or smaller in pixels to fit the size of the form.

    I am just trying to understand tE's question. What does tE want? And what does Te have now?

    Monday, March 6, 2017 1:49 PM
  • PS In this example the top picturebox and graphics is unchanged as the form is resized.

    The bottom picturebox the picturebox changes size to fit the form. The red circle stays the same size. The blue circle changes size and gets oval.

    Public Class Form5
        Private constantSize = 50
        Private Sub Form5_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            'make picturebox1 a square
    
            'make picturebox2 change size as form resized
            PictureBox2.Dock = DockStyle.Bottom
        End Sub
    
        Private Sub Form5_Resize(sender As Object, e As EventArgs) Handles Me.Resize
            PictureBox1.Refresh()
            PictureBox2.Refresh()
        End Sub
    
        Private Sub PictureBox1_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox1.Paint
            e.Graphics.Clear(Color.White)
            e.Graphics.DrawEllipse(Pens.Red, 10, 10, constantSize, constantSize)
        End Sub
    
        Private Sub PictureBox2_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox2.Paint
            e.Graphics.Clear(Color.White)
            e.Graphics.DrawEllipse(Pens.Red, 10, 10, constantSize, constantSize)
            e.Graphics.DrawEllipse(Pens.Blue, 0, 0, PictureBox2.Width, PictureBox2.Height)
    
        End Sub
    End Class

    Monday, March 6, 2017 2:24 PM
  • Hi Tommy, 

    You probably won't believe it, but that was what I first wanted to reply (we have already a decade such a kind of sample on our website).

    However, then I did reread the question and I was not sure anymore about it. Moreover when the OP wrote 

    ----------------------------------------------------------------------------------------------------

    I believe the resolution of the screen that is adjusting is 1920X1000.  My laptop is 1366x768.    The larger screen is stretching the graphics of all my components.  I have a minimum size set and the autoSizeMode is set to GrowOnly which is preset.  I am not really able to get a screen shot off the other screen.  I have a graphics program on my laptop,  but not the other machine.

    I just discovered that on my laptop,  when I adjust the resolution to say 1280X600,  it simply makes the program scrollable vertically.  Does not resize.  I am using the Windows video driver.  Maybe this is the trouble?  We think I may need a stronger power supply to run the nVidia drivers meant for the video card so I can't test it.


    Success
    Cor


    Monday, March 6, 2017 2:29 PM
  • Hi Tommy, 

    You probably won't believe it, but that was what I first wanted to reply (we have already a decade such a kind of sample on our website).

    However, then I did reread the question and I was not sure anymore about it. Moreover when the OP wrote 

    ----------------------------------------------------------------------------------------------------

    I believe the resolution of the screen that is adjusting is 1920X1000.  My laptop is 1366x768.    The larger screen is stretching the graphics of all my components.  I have a minimum size set and the autoSizeMode is set to GrowOnly which is preset.  I am not really able to get a screen shot off the other screen.  I have a graphics program on my laptop,  but not the other machine.

    I just discovered that on my laptop,  when I adjust the resolution to say 1280X600,  it simply makes the program scrollable vertically.  Does not resize.  I am using the Windows video driver.  Maybe this is the trouble?  We think I may need a stronger power supply to run the nVidia drivers meant for the video card so I can't test it.


    Success
    Cor


    Cor,

    I believe you.

    I dont understand the question either. So we play 20 questions as usual.

    Monday, March 6, 2017 2:43 PM
  • Thanks guys,

        My pictureboxes are not stretching or resizing when the form changes size.  The elements (all of them,  ie. buttons,  prictureboxes)  are deformed at that screen resolution. I am not experiencing any of this on my 2 different sized testing monitors.  The form should basically have some left over space below and to the right side,  but it stretches to fill the window.

    I bet it is in the sizing.  It is written to have a size of 1400x780.  So it is stretching the whole form.  If I set the form to the screen ratio of the larger screen,  I will be it will not stretch.  I have trouble setting the screen size bigger than what my development screen size is though sometimes.  It won't let me select a larger size than the screen res is.  The height dimension is restricted to the primary screens height.

       
    • Edited by -tE Monday, March 6, 2017 6:10 PM
    Monday, March 6, 2017 5:58 PM
  • tE,

    For us is the problem what you call resizing. Is that the actual format, or as Tommy it so clear wrote the measurable size with a ruler or that the presentation (aspect) ratio changes. 

    If you can make that clear to us, maybe it is than possible to give an answer. For the later one has Tommy given an nice example in this thread.

    Keep in mind normally your program does not know on what kind of screen the form is presented.  


    Success
    Cor

    Monday, March 6, 2017 6:19 PM
  • Thanks guys,

        My pictureboxes are not stretching or resizing when the form changes size.  The elements (all of them,  ie. buttons,  prictureboxes)  are deformed at that screen resolution. I am not experiencing any of this on my 2 different sized testing monitors.  The form should basically have some left over space below and to the right side,  but it stretches to fill the window.

    I bet it is in the sizing.  It is written to have a size of 1400x780.  So it is stretching the whole form.  If I set the form to the screen ratio of the larger screen,  I will be it will not stretch.  I have trouble setting the screen size bigger than what my development screen size is though sometimes.  It won't let me select a larger size than the screen res is.  The height dimension is restricted to the primary screens height.

       

    We just dont have enough info to say much.

    If its related to the screen size setting for the monitor then you should be able to set the other monitors that are larger to the smaller size and see the same problem.

    Perhaps it is the windows scaling for text as set in the windows control panel, this is windows 7:



    See if the text scaling setting is different between the systems. When set on 125 it will make the text size bigger and fill the buttons so they word wrap and look funny etc.



    Monday, March 6, 2017 6:29 PM
  • Thanks guys,

        My pictureboxes are not stretching or resizing when the form changes size.  The elements (all of them,  ie. buttons,  prictureboxes)  are deformed at that screen resolution. I am not experiencing any of this on my 2 different sized testing monitors.  The form should basically have some left over space below and to the right side,  but it stretches to fill the window.

    I bet it is in the sizing.  It is written to have a size of 1400x780.  So it is stretching the whole form.  If I set the form to the screen ratio of the larger screen,  I will be it will not stretch.  I have trouble setting the screen size bigger than what my development screen size is though sometimes.  It won't let me select a larger size than the screen res is.  The height dimension is restricted to the primary screens height.

       

    We just dont have enough info to say much.

    If its related to the screen size setting for the monitor then you should be able to set the other monitors that are larger to the smaller size and see the same problem.

    Perhaps it is the windows scaling for text as set in the windows control panel, this is windows 7:



    See if the text scaling setting is different between the systems. When set on 125 it will make the text size bigger and fill the buttons so they word wrap and look funny etc.



    I tested it at a larger screen size setting for each form and that didn't do anything.  I also tried changing the display settings and nothing either.  I'm writing on Win 7,  but the other machine is Win 8.1.  I wouldn't think it would be off like that. Everything is just a bit wider than in testing on Win 7. 

    Monday, March 6, 2017 6:54 PM

  • I tested it at a larger screen size setting for each form and that didn't do anything.  I also tried changing the display settings and nothing either.  I'm writing on Win 7,  but the other machine is Win 8.1.  I wouldn't think it would be off like that. Everything is just a bit wider than in testing on Win 7. 

    You just have to monkey with the settings and code until you find it trial and error.

    Its also possible you are getting an error on the problem system for whatever reason and you dont have an error msg for it and you dont know. ie maybe you use arial narrow font and the problem system does not have it.

    Now it gets to debugging methods.

    Make a one form example that reproduces the problem. Start adding to a new form until you get the problem.

    Or make a copy of your project and start removing things until the problem stops.

    Monday, March 6, 2017 7:16 PM
  • You just have to monkey with the settings and code until you find it trial and error.

    Its also possible you are getting an error on the problem system for whatever reason and you dont have an error msg for it and you dont know. ie maybe you use arial narrow font and the problem system does not have it.

    Now it gets to debugging methods.

    Make a one form example that reproduces the problem. Start adding to a new form until you get the problem.

    Or make a copy of your project and start removing things until the problem stops.

    Thanks for trying to give me some ideas. Its like the dimensions are locked somehow and an picturebox say is being elongated.  Therefore all the drawings are wrong. Seems to be a small amount off but it still bugs me. Is it an update to a namespace maybe?  It is fine on all resolution on my Win 7 laptop through 2 different screens with different screen settings.  I tried setting the other machine res to 1280x1024 and it was completely off the screen.  When I have it on my Win 7 machine at that setting it fits.
    Monday, March 6, 2017 10:35 PM
  • You mentioned the problem is on win 8.1. You can see in the first table on the dpi article that Windows 8.1 has Per monitor-DPI aware settings. Which affects whether the control panel scaling setting is used etc. That may be the difference? Towards the bottom of this article it describes the setting for windows 8.1 and shows a screen shot of control panel:

    https://msdn.microsoft.com/library/windows/desktop/dn469266.aspx?f=255&MSPPError=-2147217396

    You can set the way your app treats dpi-ware for the monitor as shown in these:

    https://emoacht.wordpress.com/2013/10/30/per-monitor-dpi-aware-in-windows-forms/

    http://stackoverflow.com/questions/23101791/make-vb-net-application-dpi-aware

    So you add that to your app manifest. I don't think its hard but I have not done app manifest. I dont know if that will change anything or not or if you want to attempt it. Long shot maybe.

    PS first see if you can find the monitor dpi setting on the system. Not the same as the other scaling dpi. Is it on or off? Change it see what happens.


    Monday, March 6, 2017 11:17 PM