From WikiChip
Difference between revisions of "mirc/picture windows"
< mirc

m (Bot: Fixing links)
(Creating a window)
Line 26: Line 26:
  
 
Now the canvas has the desired size.
 
Now the canvas has the desired size.
 +
 +
== Drawing ==
  
 
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.
 
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.
Line 31: Line 33:
 
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.
 
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.
+
'''Note''': this section won't give full details about the commands, click on a command to see more informations about that command.
 +
 
 +
'''{{mIRC|/drawdot}}''' can be used to draw dots at specific coordinates with a specific size and color.
 +
 
 +
'''{{mIRC|/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.
 +
 
 +
'''{{mIRC|/drawrect}}''' can be used to draw rectangles or ellipses at specific coordinates with a specific size and color, you can specify more than one set of coordinate and size parameters and they are drawn seperately.
 +
 
 +
'''{{mIRC|/drawfill}}''' can be used to fill an area with the specified color starting at a specific coordinate, you can either use this to keep filling as long as the color is the one you specified (surface fill) or to keep filling as long as the color is not the one you specified (border fill).
 +
 
 +
'''{{mIRC|/drawtext}}''' can be used to draw text at the specified coordinate, using the specified font name and font size, it supports basic formating via switches.
 +
 
 +
'''{{mIRC|/drawsave}}''' which actually can't be used to draw to a canvas, is used to save an area to a .bmp or .jpg file.
 +
 
 +
'''{{mIRC|/drawscroll}}''' can be used to scroll an area inside rectangles by specific distances, you can specify more than one set of scrolling area and distances.
 +
 
 +
'''{{mIRC|/drawcopy}}''' can be used to copy an area to a specific coordinate from a window to another (can be the same window).
 +
 
 +
'''{{mIRC|/drawpic}}''' can be used to load and draw a picture file at a specific coordinates, the file can be an icon from an ico/exe/dll file.
 +
 
 +
'''{{mIRC|/drawrot}}''' can be used to rotate an area by a specific angle.
 +
 
 +
'''{{mIRC|/drawreplace}}''' can be used to replace a color with another in a specific area
 +
 
 +
== Mouse Events ==
  
'''/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.
+
Mouse events can be defined in a {{mIRC|Custom Window's Menu|script menu definition}}, a picture window support the following mouse events:
  
'''/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.
+
* '''mouse''' - the mouse moved at a new coordinate, you can check {{mIRC|$mouse|$mouse.x}} and {{mIRC|$mouse|$mouse.y}} to get the new coordinate of the mouse.
 +
* '''sclick'''
  
 
[[Category:mIRC]]
 
[[Category:mIRC]]

Revision as of 08:45, 2 August 2014

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.

Drawing

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.

Note: this section won't give full details about the commands, click on a command to see more informations about that command.

/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 rectangles or ellipses at specific coordinates with a specific size and color, you can specify more than one set of coordinate and size parameters and they are drawn seperately.

/drawfill can be used to fill an area with the specified color starting at a specific coordinate, you can either use this to keep filling as long as the color is the one you specified (surface fill) or to keep filling as long as the color is not the one you specified (border fill).

/drawtext can be used to draw text at the specified coordinate, using the specified font name and font size, it supports basic formating via switches.

/drawsave which actually can't be used to draw to a canvas, is used to save an area to a .bmp or .jpg file.

/drawscroll can be used to scroll an area inside rectangles by specific distances, you can specify more than one set of scrolling area and distances.

/drawcopy can be used to copy an area to a specific coordinate from a window to another (can be the same window).

/drawpic can be used to load and draw a picture file at a specific coordinates, the file can be an icon from an ico/exe/dll file.

/drawrot can be used to rotate an area by a specific angle.

/drawreplace can be used to replace a color with another in a specific area

Mouse Events

Mouse events can be defined in a script menu definition, a picture window support the following mouse events:

  • mouse - the mouse moved at a new coordinate, you can check $mouse.x and $mouse.y to get the new coordinate of the mouse.
  • sclick