Hello
Is there a way to use the function dcl_PictureBox_DrawLine on initialize.
This function works fine well called from a button but returns nil when used on initialize.
How could I do ?
Thanks for your help
copter
I'm not familiar with drawing vectors on PictureBoxes but did you save the image within OnInitialize using StoreImage (http://www.opendcl.com/HelpFiles/index.php?page=Reference/Method/PictureBox/StoreImage.htm)?
(dcl_PictureBox_StoreImage Unbenannt_Dialog1_Bild1)
Fred
I tried. Same thing.
I attached an example.
Copter
Hi
Call dcl_PictureBox_DrawLine inside the property of OnPaint.
(defun c:Project1_Form1_PictureBox1_OnPaint (nHasFocus /)
(dcl_PictureBox_DrawLine.....
)
Attention this should be out of OnInitialize.
I tried Onpaint (Sample is attached) but without success.
Try now.
You should have removed -> [Boolean] of the function OnPaint.
Stop using dcl_PictureBox_DrawLine in OnInitialize.
Why you this using vl-doc-ref?
(dcl_project_load "d:/test")
;;;(defun c:Test_Form1_OnInitialize (/)
;;; (dcl_PictureBox_DrawLine (vl-doc-ref 'test_Form1_PictureBox1) '((10 10 230 10 248)))
;;;)
(defun c:test_Form1_TextButton1_OnClicked (/)
(dcl_PictureBox_DrawLine (vl-doc-ref 'test_Form1_PictureBox1) '((10 10 230 10 248)))
)
(defun c:test_Form1_PictureBox1_OnPaint (HasFocus /)
(dcl_PictureBox_DrawLine (vl-doc-ref 'test_Form1_PictureBox1) '((10 10 230 10 248)))
)
(dcl_form_show (vl-doc-ref 'test_Form1))
Quote from: velasquez on April 29, 2009, 03:30:05 PM
< .. >
Why you this using vl-doc-ref?
< .. >
he's likely to be compiling a separate-namespace VLX ...
This issue is due to the fact that the picture box Draw methods paint directly to the screen, so they do not work unless the picture box is visible. During OnInitialize, the controls are created, but not yet visible, so any direct painting fails. The suggested solution to use OnPaint is probably the best approach.
Thanks everybody !
It works now !
The reason for vl-doc-ref is that I always compile in separate namespace my vlx files.
Copter.