Announcement

Collapse
No announcement yet.

Resize Bitmap with API code?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resize Bitmap with API code?

    Hi,

    This is the code I now have to use in place of ADD GRAPHIC CONTROL. This allows a button to be placed over label bitmap and execute with a hot key. Problem is it does not resize bitmap like GRAPHIC RENDER does. Is there API code to resize bitmaps?

    Code:
          '-----------------------------------------
          CONTROL ADD LABEL, hDlg43, %IDG_BMPLABEL, "", 0, 0, 660, 700,  %SS_BITMAP
          PicTMap = LoadImage(%Null,"PICT\BaloonBorder2.bmp"  , %IMAGE_BITMAP,0,0, %LR_LOADFROMFILE)
          CONTROL SEND hDlg43, %IDG_BMPLABEL, %STM_SETIMAGE, %IMAGE_BITMAP, PicTMap
          CONTROL ADD TEXTBOX, hDlg43, %IDS_TEXT, "",      45,45,570,622, _
            %WS_CHILD OR %WS_VISIBLE OR %ES_MULTILINE OR %ES_AUTOVSCROLL _
             OR %ES_READONLY OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE ' These styles allow mousewheel
          CONTROL ADD BUTTON, hDlg43, %IDS_BUT, "&Stop", 300,675,80,20
          '--------------------------------------------------------------------------------
        CALLBACK FUNCTION BirthAnnivCALLBACK()
        '------------------------------------------------------------------
        LOCAL fBmp AS LONG
          SELECT CASE CBMSG
          CASE %WM_INITDIALOG                         ' <- sent right before the dialog is displayed.
            ' set up subclass proc & record old proc add in %IDS_TEXT userdata. (TT Colin Schmidt)
            ' Hides vertical scrollbar, but still allows mousewheel to move cursor up or down
            Setwindowlong Getdlgitem(CBHNDL, %IDS_Text), %GWL_USERDATA, _
            SetWindowLong(GetDlgItem(CBHNDL, %IDS_Text), %GWL_WNDPROC, CODEPTR(TextBoxProc))
            fBmp = LoadImage(%Null, "PICT\BaloonBorder2.bmp", %IMAGE_BITMAP,0,0, %LR_LOADFROMFILE)
            CONTROL SEND CBHNDL, %IDS_BUT, %STM_SETIMAGE, %IMAGE_BITMAP, fBmp
    
            CONTROL SET FOCUS CBHNDL, %IDOK '%IDS_BUT ' Added 10-10-2007 or button didn't work?
              CASE %WM_COMMAND                        ' <- a control is calling
                SELECT CASE CBCTL                     ' <- look at control's id
                   CASE %IDCANCEL
                      IF CBCTLMSG = %BN_CLICKED THEN  ' end prog on Esc
                       DIALOG END CBHNDL, 0           ' Means go back to SUB BirthAnniv
                      END IF
                   CASE %IDS_BUT  '%IDOK '%IDS_BUT    ' end prog on Stop [Stop]
                      IF CBCTLMSG = %BN_CLICKED THEN
                       SLEEP 500
                       DIALOG END CBHNDL, 1           ' Means go back to SUB BirthAnniv
                      END IF
                END SELECT
          END SELECT
        END FUNCTION
    Was using:
    Code:
          CONTROL ADD GRAPHIC, hDlg43, %ID_FRAM, "",        0, 0, 660, 700, %SS_NOTIFY  '660,670
          GRAPHIC ATTACH hDlg43, %ID_FRAM
          GRAPHIC RENDER "PICT\BaloonBorder2.bmp", (0, 0)-(660,700) '700)'670
    Need to resize bitmap according to dialog size with API code?

  • #2
    Start with StretchBlt Win API function:
    The StretchBlt function copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      See "Problems with New Developement, Maybe?". Figured out how to
      use "CONTROL ADD GRAPHIC" , so no need for API stretch at this time.

      Comment

      Working...
      X