Menu

#86 Option for sized backgroud bitmap on window main.

v1.0_(example)
open
nobody
None
1
2025-03-07
2025-02-27
No

Hi!
It would be nice to have this option!
Adjust the size of the bmp image in the background.

#xcommand INIT WINDOW <oWnd>                ;
             [ MAIN ]                       ;
             [<lMdi: MDI>]                  ;
             [ APPNAME <appname> ]          ;
             [ TITLE <cTitle> ]             ;
             [ AT <x>, <y> ]                ;
             [ SIZE <width>, <height> ]     ;
             [ ICON <ico> ]                 ;
             [ SYSCOLOR <clr> ]             ;
             [ <bclr: BACKCOLOR, COLOR> <bcolor> ] ;
             [ BACKGROUND BITMAP <oBmp> ]   ; //here BACKGROUND BITMAP <oBmp> SIZE <width>, <height> ]
...

Best regards,
Itamar M. LIns Jr.

Discussion

  • Wilfried Brunken

    Hello Itamar,
    i think, this modification in the HWGUI code is not necessary.
    because HBitmap():AddFile() resizes a bitmap image.

    See sample program
    samples\stretch.prg

    I have done some modifications,
    added a hexdump of "hwgui.bmp" and
    some more comments.

    First the bitmap object is created with the desired size:

    Free this (line 44)
    Bmp := HBitmap():AddFile(cImageMain,,.F.,hwg_Getdesktopwidth(),hwg_Getdesktopheight()-21)
    and comment out:
    // oBmp := HBitmap():AddFile( cImageMain,, .F., 301, 160 )

    Call the sample without any command line options
    and the following command is called:
    INIT WINDOW oFormMain MAIN AT 0,0 SIZE nPosX , nPosY

    call program with
    stretch.exe X (LINUX: ./stretch X)
    and the command is called with BACKGROUND BITMAP option:
    INIT WINDOW oFormMain APPNAME "Agenda Hwgui" MAIN AT 0,0 SIZE nPosX,nPosY BACKGROUND BITMAP oBmp

    There are bugs in methods AddFile()
    and AddString() of HBitmap class,
    need to be fixed.
    Only Addfile() on WinAPI stretches the bitmap
    correct.

    Please be patient. I'll look for the code.

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • Wilfried Brunken

    Hello Itamar,
    with commit r3539 i added the size parameters for
    AddFile() method. Please check.
    Now it is the same as WinAPI.

    Now i will search a solution for AddString(),
    for GTK i found a solution, need to search same for WinAPI.

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • Wilfried Brunken

    Hello Itamar,
    with commit r3540 i added the size parameters for
    AddString() method of HBitmap class for GTK. Please check.
    I think, for a LINUX user it is OK.

    Need to continue with AddString() for WinAPI.
    Please give feedback for closing this ticket.

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • Wilfried Brunken

    Hello Itamar,
    now after some days of programming i present the
    solution for WinAPI.
    Committed with r3541

    See sample program
    samples\stretch.prg
    for new details.

    The new main resizing funktion is
    hwg_Stretch_BMP_i(cbmp, clocname, nWidth, nHeight )
    and could also be used for other purposes.
    But need to port it for LINUX for multi platform usage,
    that i will do it during the next few days.

    Start program with
    stretch.exe X (LINUX: ./stretch X)
    and the command is called with BACKGROUND BITMAP option:
    INIT WINDOW oFormMain APPNAME "Agenda Hwgui" MAIN AT 0,0 SIZE nPosX,nPosY BACKGROUND BITMAP oBmp

    I added some helpful debugging functions and
    also upated the HWGUI class and function documentation.

    I will test in the WinPRN sample to
    stretch the QR code in the printout.

    Please check the code and give feedback,
    if the ticket can be closed.

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.