Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a question about image placement and maximize... HELP PLEASE

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
is there any code that i can use to allow an image to be placed in a certain area of the form at any size of the form?? like for example: i want an image to be placed in the top right of the form, no matter what size the form has been resized to. how would i go about doing this?? any comments, sugeestions are appreciated. [sig][/sig]
 
There are 4 properties of the form you can use to do this.

Top = Y Coordinate of the top of the form
Left = X Coordinate of the left edge of the form

These 2 combine to give you the origin of the form (Left, Top)

ScaleWidth = Number of units wide
ScaleHeigth = Number of units tall

So in the form resize event you would need to do something like this
(assumes your picture is in a picture box control called Picture1, picture boxes are easier than image controls because they have scaleheigth and scalewidth properties. I also set the ScaleMode of the form to Inches, the default is Twips. If you leave scalemode as twips, your offsets will be in the thousands rather than the -1 i am using here )

Private Sub Form_Resize()
Picture1.Top = 0
Picture1.Left = Me.ScaleWidth - 1
End Sub

Using this code on a test form i got had a small picture box that always stayed at the top right of the form. Experiment.
Good Luck [sig]<p>Ruairi<br><a href=mailto:ruairi@logsoftware.com>ruairi@logsoftware.com</a><br>Experienced with: <br>
VB6, SQL Server, QBASIC, C(unix), MS Office VBA solutions<br>
ALSO: Machine Control/Automation using GE and Omron PLC's and HMI(human machine interface) for industrial applications[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top