Older Newer
Wed, 22 Dec 2021 03:16:49 . . . . SyneRyder [Improved example]


Changes by last author:

Added:
= startSetPixel =

== Syntax ==

void startSetPixel(int ctl)

== Arguments ==

:ctl

::The control number of the Ownerdraw control on which you want to draw.

== Description ==

Call startSetPixel before drawing on an OWNERDRAW control to select which control you will be drawing on. Use setPixel to change individual pixels or any of the Control drawing functions to draw to the control. After finished drawing, you must call endSetPixel to display the drawn control to the screen.

== Example ==

<code>

%fml

ctl(1): OWNERDRAW(drawitem), Pos=(300,50), Size=(100, 100)

OnFilterStart: {

// Maximum X/Y pixel co-ords of ownerdraw

int maxxpixel = HDBUsToPixels(100)-1;

int maxYpixel = VDBUsToPixels(100)-1;

// Start using setPixel drawing on OWNERDRAW control 1

startSetPixel(1);

// Draw rectangle around OWNERDRAW area

setLine(0, 0, maxxpixel, 0, RGB(0,0,0));

setLine(0, 0, 0, maxYpixel, RGB(0,0,0));

setLine(maxxpixel, 0, maxxpixel, maxYpixel, RGB(0,0,0));

setLine(0, maxYpixel, maxxpixel, maxYpixel, RGB(0,0,0));

// Fill a Rectangle in the OWNERDRAW set-pixel area

setRectFill(10, 20, 30, 40, RGB(255, 0, 0));

// Stop using setPixel drawing

endSetPixel(1);

return true;

}

</code>

== See Also ==

endSetPixel, setPixel, setRectFill

== Comments ==

Everyone can add their comments about their experiences with this function here. Tips for using it are welcome, too.