Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Background Image

derek35derek35 Member Posts: 10
I have put an image on the background of my main form, what I want to know is if I can keep the image and all of the controls centered when the form is resized or maximized.
Can somebody please help?

Comments

  • bgibbybgibby Member Posts: 251
    : I have put an image on the background of my main form, what I want to know is if I can keep the image and all of the controls centered when the form is resized or maximized.
    : Can somebody please help?
    :

    I don't think you can if you set the background of the form with your picture, but... if you create a picturebox, put your pic in there, then create a FRAME and put your controls in there, then resizing is just a matter of centering just two controls!

    Hope this helps!
    Bradley q:)
  • GenjuroGenjuro Member Posts: 913
    : : I have put an image on the background of my main form, what I want to know is if I can keep the image and all of the controls centered when the form is resized or maximized.
    : : Can somebody please help?
    : :
    :
    : I don't think you can if you set the background of the form with your picture, but... if you create a picturebox, put your pic in there, then create a FRAME and put your controls in there, then resizing is just a matter of centering just two controls!
    :
    : Hope this helps!
    : Bradley q:)
    :

    If you feel like not wasting memory, there's a slightly more complicated method: load the picture into a StdPicture object, then PaintPicture it into the Form.
  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : : : I have put an image on the background of my main form, what I want to know is if I can keep the image and all of the controls centered when the form is resized or maximized.
    : : : Can somebody please help?
    : : :
    : :
    : : I don't think you can if you set the background of the form with your picture, but... if you create a picturebox, put your pic in there, then create a FRAME and put your controls in there, then resizing is just a matter of centering just two controls!
    : :
    : : Hope this helps!
    : : Bradley q:)
    : :
    :
    : If you feel like not wasting memory, there's a slightly more complicated method: load the picture into a StdPicture object, then PaintPicture it into the Form.
    :

    Or waste slightly more than stdPicture (or less?) but nowhere near as much as a picbox: Load the picture into an image control and set stretch to True.

    For your controls (including the above image control), use the Form_Resize event and calculate the new positions of your controls and move them accordingly. Keep in mind that you will need error trapping just in case any values get too small...
  • GenjuroGenjuro Member Posts: 913
    : : : : I have put an image on the background of my main form, what I want to know is if I can keep the image and all of the controls centered when the form is resized or maximized.
    : : : : Can somebody please help?
    : : : :
    : : :
    : : : I don't think you can if you set the background of the form with your picture, but... if you create a picturebox, put your pic in there, then create a FRAME and put your controls in there, then resizing is just a matter of centering just two controls!
    : : :
    : : : Hope this helps!
    : : : Bradley q:)
    : : :
    : :
    : : If you feel like not wasting memory, there's a slightly more complicated method: load the picture into a StdPicture object, then PaintPicture it into the Form.
    : :
    :
    : Or waste slightly more than stdPicture (or less?) but nowhere near as much as a picbox: Load the picture into an image control and set stretch to True.
    :
    : For your controls (including the above image control), use the Form_Resize event and calculate the new positions of your controls and move them accordingly. Keep in mind that you will need error trapping just in case any values get too small...
    :

    Slightly more: an Image control has a Picture property, which evaluates to a StdPicture object, so I can't see *how* an Image control with one StdPicture inside it could be lighter than a StdPicture alone *LOL*
  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : Slightly more: an Image control has a Picture property, which evaluates to a StdPicture object, so I can't see *how* an Image control with one StdPicture inside it could be lighter than a StdPicture alone *LOL*
    :

    I agree, but I don't know for sure. Anyone get a copy of VB's source code?
  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    ______ | http://forcoder.org | free video tutorials and ebooks about / C#, PL/SQL, Visual Basic, Go, Swift, Delphi, MATLAB, Python, C, C++, R, Scratch, PHP, Visual Basic .NET, Perl, Java, Objective-C, Assembly, JavaScript, Ruby Prolog, Lua, COBOL, D, Erlang, Transact-SQL, Hack, Ada, VBScript, Kotlin, Rust, Bash, Apex, Logo, ML, LabVIEW, Fortran, ABAP, Lisp, Clojure, Dart, SAS, F#, Scala, Julia, Scheme, Awk, Crystal, FoxPro, Alice / _________

Sign In or Register to comment.