Author Topic: gdiPImageCtx and DDT  (Read 2102 times)

0 Members and 1 Guest are viewing this topic.

Offline Frank Applin

  • Newbie
  • *
  • Posts: 3
gdiPImageCtx and DDT
« on: March 23, 2011, 03:42:51 PM »
I'm not having any luck getting the ImageCtx working in my PB program using DDT. Do you think you could please tell me what I'm doing wrong? I'm trying to base it on the example posted on this site (it was using SDK).

Code: [Select]
#COMPILE EXE
#DIM ALL
#DEBUG ERROR ON

#INCLUDE "GdipImageCtx.inc"

#RESOURCE "EX_GdipImageCtxDemo_02.pbr"

%IMAGE_01 = 1001

GLOBAL hDlg AS DWORD
' *********************************************************************************************
' Main dialog callback
' *********************************************************************************************
CALLBACK FUNCTION MainDlgCallback()
        LOCAL PS AS paintstruct

        SELECT CASE CBMSG
             CASE %WM_DESTROY
                  PostQuitMessage 0

             CASE %WM_COMMAND
                  SELECT CASE CBCTL
                        CASE %IDCANCEL
                             IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                                  DIALOG END CBHNDL, 0
                             END IF
                  END SELECT
            CASE %WM_PAINT
                  'beginpaint(hDlg, PS)
                  'endpaint hDlg, PS
        END SELECT

END FUNCTION

' *********************************************************************************************
' Creating the main dialog
' *********************************************************************************************
SUB MainDialog()
    LOCAL lError AS LONG
    LOCAL hCtl AS DWORD

     ' // Initialize the control
     InitGdipImageCtx

     DIALOG NEW PIXELS, 0, "Testing GDIpImageCTX",,, 1522, 831, %WS_OVERLAPPEDWINDOW, 0 TO hDlg
     CONTROL ADD FRAME, hDlg, 9999, "", 1, 1, 500, 500, ,
     CONTROL ADD "GDIPIMAGECTX", hDlg, %IMAGE_01, "", 1, 1, 500, 500, , ,

 
    CONTROL HANDLE hDlg, %IMAGE_01 TO hCtl

    GdipImageCtx_LoadImageFromResource(hCtl, 0, "PngResource")
    CONTROL REDRAW hDlg, %IMAGE_01
END SUB



' *********************************************************************************************
'                                  M A I N     P R O G R A M
' *********************************************************************************************
FUNCTION PBMAIN
LOCAL hr AS DWORD

      MainDialog()
      DIALOG SHOW MODAL hDlg, CALL MainDlgCallback TO hr

END FUNCTION
' *********************************************************************************************
« Last Edit: October 14, 2016, 06:03:55 PM by José Roca »

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 3126
  • Gender: Male
    • José Roca Software
Re: gdiPImageCtx and DDT
« Reply #1 on: March 23, 2011, 09:22:29 PM »
 
Code: [Select]
CONTROL ADD "GDIPIMAGECTX", hDlg, %IMAGE_01, "", 1, 1, 500, 500, , ,

must be

Code: [Select]
CONTROL ADD "GDIPIMAGECTX", hDlg, %IMAGE_01, "", 1, 1, 500, 500, %WS_CHILD OR %WS_VISIBLE

Offline Frank Applin

  • Newbie
  • *
  • Posts: 3
Re: gdiPImageCtx and DDT
« Reply #2 on: March 23, 2011, 09:24:50 PM »
Thank you. That works perfectly.