PictureBox at Palette: Enable clear control

Started by PrWork1 · 2010-03-09 09:03 UTC · 2 replies · SMF topic #1198

I am having trouble writing the code for the following situation:
I have paintBox on Palette

;;;1st paint box
(dcl_PictureBox_DrawSolidRect UI02_dclToolBox_pbMatColor (List (list 0 0 50 50 2)  )))
;;; 2nd enabe control
(dcl_Control_SetEnabled 02_dclToolBox_pbMatColor T)

When I enable control, my solidrect clear.
When I comment line  (dcl_Control_SetEnabled 02_dclToolBox_pbMatColor T) all OK/

Why?




Hi, PrWork1,

I do not know much about the events and your code at all.
I recommend you to enable the picturebox's OnPaint event. Then write the line
(dcl_PictureBox_DrawSolidRect UI02_dclToolBox_pbMatColor (List (list 0 0 50 50 2)  )))
into this event.

In some situations a picture box gets repainted. So you have to make sure that you either redraw the picturebox's content after repainting (using the OnPaint event) OR (and now I hope Owen will have a look at my post to correct me) you do not activate OnPaint event but you will store the image. But I do not have any experience in that:


;;;1st paint box
(dcl_PictureBox_DrawSolidRect UI02_dclToolBox_pbMatColor (List (list 0 0 50 50 2)  )))
;;; 2nd store the content
(dcl_PictureBox_StoreImage UI02_dclToolBox_pbMatColor)
;;; 3rd enable control
(dcl_Control_SetEnabled 02_dclToolBox_pbMatColor T)


Have a look at {2} method and please give it a try and let me know.

Regards,
Fred
Many thanks to rapid and complete answer.
I call the SaveImage Method, all OK!