From WikiChip
mirc/picture windows
< mirc
Revision as of 13:03, 10 January 2014 by Ouims (talk | contribs)

Template:mIRC Guide Picture Windows in mIRC are a special type of custom windows that is used as a drawing canvas. mIRC provides a set of commands, identifiers, and events for manipulating them. Picture windows provide an alternative mean of creating a graphical user interface.

Creating a window

Picture windows can be created via the /window command in combination with the -p switch.

Note: -p only creates the canvas, the size used in /window will by default set the window's size, to sets the size of the canvas, you need to use the -f switch, which will automatically resize the size of the window for you.

Note 1: The only way to get a window canvas/size bigger than your actual maximum screen resolution is to open the window once using the switches +Lt and then call /window -f again with the actual width and height.

A simple example:

//window -dep @example -1 -1 500 400
will create a desktop picture window named @example with an editbox and a size of 500x400, the actual size of the canvas is not 500*400, it will be close, you can check its size with:
//echo -a $window(@example).bw $window(@example).bh

A better example would be:

//window -dfep @example -1 -1 500 400

Now the canvas has the desired size.

There are 11 commands to draw to a picture window, all of them support the -n switch, which prevents mIRC from painting the change you just made to that window, this allows you to make smooth draws: if you make several draws at the same time or periodically without using the -n switch, you'll see a flicker between the draw, using -n on all your draws and then allowing mIRC to paint the changes 'merged' once will get rid of these flickers, it is not faster to draw with -n and vice versa.

Once you have made all your draws and are ready to paint the changes, any call to one of these /draw commands without the -n switch will do it (makes sense when we know not using the -n switch always paint the changes, causing flickers). You naturally want to use the simple /drawdot @mywin for that.

/drawdot can be used to draw dots at specific coordinates with a specific size and color.

/drawline can be used to draw lines at specific coordinates with a specific size and color, if more than four points are given, the next line is drawn from the end of the last line to that point, chaining lines.

/drawrect can be used to draw rectangle or ellipses at specific coordinates with a specific size and color, you can specify more than one set of 'x y w h' parameters and they are drawn seperately.