PictureBox at Palette: Enable clear control

Started by PrWork1, March 09, 2010, 01:03:47 AM

Previous topic - Next topic

PrWork1

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?





Fred Tomke

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
Code (autolisp) Select
(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:

Code (autolisp) Select

;;;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 StoreImage method and please give it a try and let me know.

Regards,
Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

PrWork1

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