You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Forgive me if this is a simple question, but how do you use create an area on a dialog which can be drawn on like a VB picture box. I need an area which has an hDC property and can draw in pixel units. Can this be done using DDT to create the dialog?
Absolutely! My personal favorite technique is you use a label control as the "container".
1. Add the %WS_CLIPCHILDREN style to your DDT dialog.
2. Create a LABEL control, with the style %SS_GRAYFRAME
3. In the %WM_PAINT event, get the DC of the LABEL control, and draw your graphics.
Here is a snippet from one of my own applications that uses a DDT label control as a container for graphics:
Code:
CALLBACK FUNCTION dlgcallback()
...
IF CBMSG = %WM_PAINT THEN
' Set the client area of the dialog dark for effect
hDC = BeginPaint(CBHNDL, Ps)
GetClientRect CBHNDL, Rct
FillRect hDC, Rct, GetStockObject(%DKGRAY_BRUSH)
EndPaint CBHNDL, Ps
' Get the DC to the label control and draw the graphics
hDC = GetDC(GetDlgItem(CBHNDL, %ID_LABEL))
TextOut hDC, ....more graphics...
ReleaseDC GetDlgItem(CBHNDL, %ID_LABEL), hDC
' signal DDT engine we processed the event ourselves
FUNCTION = 1
EXIT FUNCTION
ELSEIF...
...
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment