mIRC Home    About    Download    Register    News    Help

Print Thread
#200985 16/06/08 08:51 AM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Greetings
I would like to use /drawpic. How would i get it into the exact centre of the pic window?

Thanks in advance

Joined: Aug 2006
Posts: 183
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2006
Posts: 183
Assuming you know the size of the window, it would be half the height and half the width. So, the middle of a pic window that's 100 by 150 would be the point at 50,75.


Yar
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
I dont know the size of the window. It would be for windows of many diff sizes.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
The size is $window(@window) and use the .x .y .dx .dy properties depending on what you need. Divide by half. Then, for text, subtact half the $width() of the font/text/size so that you are centered. For a picture, subtract half the width of the picture. For height, do the same thing as width. Use $height() for the font/text/size.


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Code:
var %window = WINDOW_NAME
var %image = $qt(IMAGE_FILENAME)
var %x = $calc(($window(%window).dw - $pic(%image).width) / 2)
var %y = $calc(($window(%window).dh - $pic(%image).height) / 2)
drawpic %window %x %y %image


Obviously you need to replace WINDOW_NAME with the picture window you're drawing to and IMAGE_FILENAME with the filename of the image.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
thank you starbucks_mafia you truly are a star!


Link Copied to Clipboard