AustrianOak Posted June 4, 2008 Posted June 4, 2008 how can i center my label text on my picture? my label sizes may vary so i was wondering if there was some function for it?... probably a long shot question
Moderators SmOke_N Posted June 4, 2008 Moderators Posted June 4, 2008 (edited) how can i center my label text on my picture? my label sizes may vary so i was wondering if there was some function for it?...probably a long shot questionLook in your help file under GUI Styles ... Search for Center Edit:I am hoping that was the simple way for you above....However, if you're trying to center your "label to the picture", then something like:ConrolGetPos() to get the left/top/right/bottom positions, then some simple math would help you out there. Edited June 4, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
AustrianOak Posted June 4, 2008 Author Posted June 4, 2008 thanks SmOke_N, I'll go with the second way as it seems a bit easier (for me at least).
AustrianOak Posted June 4, 2008 Author Posted June 4, 2008 i seem to be having a huge amount of trouble figuring out this damn math i want to position my text (label) in the center of my picture so i did half the pictures width and then i did half of the text label and im confusing myself so bad. can somone one help me with some logic. my goal: centering my label in on my picture. sorry if im too vague, ill be glad to be more detailed if needed.
SxyfrG Posted June 4, 2008 Posted June 4, 2008 For your math ... Assuming you know the x,y pos and the width and height of the picture control and the width and height of the label ... GUICtrlCreateLabel('This is a test label', $imageXpos+($imagewidth/2)-($Labelwidth/2), $imageYpos+($imageheight/2)-($Labelheight/2), $Labelwidth, $Labelheight) Hopefully that makes sense, each of the values that should be assigned to the variables should be self-explanatory My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website
AustrianOak Posted June 5, 2008 Author Posted June 5, 2008 As strange it may sound my label actually started on the left side of the picture instead of center. heres what i did: $imageXpos = 27 $imagewidth = 78 $Labelwidth = $leng[0] $newlabel = GUICtrlCreateLabel($datalabel, $imageXpos+($imagewidth/2)-($Labelwidth/2), 455, $leng[0], 20)
LarryDalooza Posted June 5, 2008 Posted June 5, 2008 If you set $SS_CENTER as the style for the label, then the label just need be as wide as the picture. Lar. AutoIt has helped make me wealthy
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now