Hi.
There is a dialog box with brush. I need to select a certain rectangle on this window and save it to a file as a bitmap. How to do it ?
Hi.
There is a dialog box with brush. I need to select a certain rectangle on this window and save it to a file as a bitmap. How to do it ?
#include "FiveWin.ch"
function Main()
local oDlg, oGrp
DEFINE DIALOG oDlg
@ 1, 2 GROUP oGrp TO 6, 12 OF oDlg
oGrp:bRClicked = { | nRow, nCol | ShowPopup( nRow, nCol, oGrp )}
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oGrp:lDrag := .T., oGrp:CheckDots(), .T. )
return nil
function ShowPopup( nRow, nCol, oGrp )
local oPopup
MENU oPopup POPUP
MENUITEM "Save as BMP" ACTION MsgInfo( "ok" )
ENDMENU
ACTIVATE POPUP oPopup WINDOW oGrp AT nRow, nCol
return nil#include "FiveWin.ch"
function Main()
local oDlg, oGrp, oBrush
DEFINE BRUSH oBrush FILENAME "c:\fwh\bitmaps\olga1.jpg"
DEFINE DIALOG oDlg BRUSH oBrush SIZE 380, 400
@ 1, 2 GROUP oGrp TO 6, 12 OF oDlg TRANSPARENT
oGrp:bRClicked = { | nRow, nCol | ShowPopup( nRow, nCol, oGrp )}
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oGrp:lDrag := .T., oGrp:CheckDots(), .T. )
return nil
function ShowPopup( nRow, nCol, oGrp )
local oPopup
MENU oPopup POPUP
MENUITEM "Save as BMP" ACTION oGrp:SaveToBmp( "test.bmp" )
ENDMENU
ACTIVATE POPUP oPopup WINDOW oGrp AT nRow, nCol
return nilThank you, Antonio ! So I can use this solution not only for Group, but also for an arbitrary-form rectangle ?
Yes, it works for all kind of controls ![]()
oDlg:SaveAsImage( cImageFile, aRect )Rao, thank you for the clarification !
Will this scheme work if the dialog is larger than the monitor screen and, accordingly, the allocated rectangle is also larger than the monitor screen ?
Yes, it should work the same
Thank you, Antonio, this is what you need !
but containing only the part of the control visible on the screen,.
And how can I get a picture of the entire control surface ?
oControl:SaveToBmp("test.bmp")
Enviado desde mi SM-M325FV mediante Tapatalk
Same result