mIRC Homepage
Posted By: Solo1 /drawpic middle of pindow - 16/06/08 08:51 AM
Greetings
I would like to use /drawpic. How would i get it into the exact centre of the pic window?

Thanks in advance
Posted By: Thrull Re: /drawpic middle of pindow - 16/06/08 09:54 AM
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.
Posted By: Solo1 Re: /drawpic middle of pindow - 16/06/08 11:45 AM
I dont know the size of the window. It would be for windows of many diff sizes.
Posted By: Riamus2 Re: /drawpic middle of pindow - 16/06/08 01:26 PM
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.
Posted By: starbucks_mafia Re: /drawpic middle of pindow - 16/06/08 02:14 PM
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.
Posted By: Solo1 Re: /drawpic middle of pindow - 16/06/08 03:04 PM
thank you starbucks_mafia you truly are a star!
© mIRC Discussion Forums