In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Select a part of image
Select a part of image
Hello, someone can give me some help?
I have an image loaded into a TBevel, how do I bring up a box that allows you to select a part of the image to obtain the coordinates (Left, Top, Right, Bottom) and then save the selected area in a file.bmp
I tried TCaptureBitmap developed by the excellent JLalin. I do not know if you can do this
I have an image loaded into a TBevel, how do I bring up a box that allows you to select a part of the image to obtain the coordinates (Left, Top, Right, Bottom) and then save the selected area in a file.bmp
I tried TCaptureBitmap developed by the excellent JLalin. I do not know if you can do this
Select a part of image
Franco,
Add this datas to the form declaration:
DATA nX INIT -1
DATA nY INIT -1
DATA aSelect INIT { 0, 0, 0, 0 }
Select the TBevel and put this code in OnLButtonDown:
METHOD TBevel1LButtonDown( oSender, nKeyFlags, nPosX, nPosY ) CLASS ...
IF ::nX == -1
::nX := nPosX
::nY := nPosY
::aSelect[1] := nPosX
::aSelect[2] := nPosY
ELSE
::nX := -1
ENDIF
RETURN Nil
This code in OnMouseMove event:
METHOD TBevel1MouseMove( oSender, nKeyFlags, nPosX, nPosY ) CLASS ...
LOCAL hDC
IF ::nX != -1
::oBevel1:Redraw()
hDC := GetDC( ::oBevel1:Handle )
DrawFocusRect( hDC, { ::nX, ::nY, nPosX, nPosY } )
ReleaseDC( ::oBevel1:Handle, hDC )
::aSelect[3] := nPosX
::aSelect[4] := nPosY
ENDIF
RETURN Nil
Now to save it with TCaptureBitmap:
METHOD Button1Click( oSender ) CLASS ...
::aSelect[1] += ::oBevel1:nLeft
::aSelect[2] += ::oBevel1:nTop
::aSelect[3] += ::oBevel1:nLeft
::aSelect[4] += ::oBevel1:nTop
WITH OBJECT TCaptureBitmap():New
:Capture( ::Handle, { ::aSelect[1], ::aSelect[2], ::aSelect[3],
::aSelect[4] } )
:Save( "c:testscapture.bmp" )
//ShellExecute( , "open", "c:testscapture.bmp" )
END
RETURN Nil
And you are done.
Regards,
José Lalín
Add this datas to the form declaration:
DATA nX INIT -1
DATA nY INIT -1
DATA aSelect INIT { 0, 0, 0, 0 }
Select the TBevel and put this code in OnLButtonDown:
METHOD TBevel1LButtonDown( oSender, nKeyFlags, nPosX, nPosY ) CLASS ...
IF ::nX == -1
::nX := nPosX
::nY := nPosY
::aSelect[1] := nPosX
::aSelect[2] := nPosY
ELSE
::nX := -1
ENDIF
RETURN Nil
This code in OnMouseMove event:
METHOD TBevel1MouseMove( oSender, nKeyFlags, nPosX, nPosY ) CLASS ...
LOCAL hDC
IF ::nX != -1
::oBevel1:Redraw()
hDC := GetDC( ::oBevel1:Handle )
DrawFocusRect( hDC, { ::nX, ::nY, nPosX, nPosY } )
ReleaseDC( ::oBevel1:Handle, hDC )
::aSelect[3] := nPosX
::aSelect[4] := nPosY
ENDIF
RETURN Nil
Now to save it with TCaptureBitmap:
METHOD Button1Click( oSender ) CLASS ...
::aSelect[1] += ::oBevel1:nLeft
::aSelect[2] += ::oBevel1:nTop
::aSelect[3] += ::oBevel1:nLeft
::aSelect[4] += ::oBevel1:nTop
WITH OBJECT TCaptureBitmap():New
:Capture( ::Handle, { ::aSelect[1], ::aSelect[2], ::aSelect[3],
::aSelect[4] } )
:Save( "c:testscapture.bmp" )
//ShellExecute( , "open", "c:testscapture.bmp" )
END
RETURN Nil
And you are done.
Regards,
José Lalín
Select a part of image
Josí¨,
your code is very helpful to me.
I only have a small problem with
WITH OBJECT TCaptureBitmap (): New
:Capture (:: Handle, {:: aSelect [1]:: aSelect [2]:: aSelect [3]
:: ASelect [4]})
The selected area is not captured but the whole form/oBevel1 as can be seen from the attached jpg.
Using the method Hardcopy (. T., "bmp captured"), opens with a blank page preview
i'm using Tcapturebitmap version 1.5.0.0 I do not know if it is updated
Regards,
Franco
Attached files
your code is very helpful to me.
I only have a small problem with
WITH OBJECT TCaptureBitmap (): New
:Capture (:: Handle, {:: aSelect [1]:: aSelect [2]:: aSelect [3]
:: ASelect [4]})
The selected area is not captured but the whole form/oBevel1 as can be seen from the attached jpg.
Using the method Hardcopy (. T., "bmp captured"), opens with a blank page preview
i'm using Tcapturebitmap version 1.5.0.0 I do not know if it is updated
Regards,
Franco
Attached files
Select a part of image
Franco,
check with the attached obj.
It it does not work then make a little project to see the problem and
export it (Project->Export with sources only) and send it to the forum so I
can test it.
Regards,
José Lalín
--
check with the attached obj.
It it does not work then make a little project to see the problem and
export it (Project->Export with sources only) and send it to the forum so I
can test it.
Regards,
José Lalín
--
Select a part of image
Josí¨,
I attach a small project as you asked me
Regards,
Franco
Attached files DragDetect-1-0-0-0.zip (8.2 KB)Â
I attach a small project as you asked me
Regards,
Franco
Attached files DragDetect-1-0-0-0.zip (8.2 KB)Â
Select a part of image
Franco,
delete the capturebitmap.lib from the list of project libraries and add
this object file to the test. With it the test works nicely.
Regards,
José Lalín
--
Attached files CapBitmap.zip (2.7 KB)Â
delete the capturebitmap.lib from the list of project libraries and add
this object file to the test. With it the test works nicely.
Regards,
José Lalín
--
Attached files CapBitmap.zip (2.7 KB)Â
Select a part of image
Josí¨ the best!
Thanks so much
Regards,
Franco
Thanks so much
Regards,
Franco
Select a part of image
Franco,
you're welcome!
Regards,
José Lalín
you're welcome!

Regards,
José Lalín
Select a part of image
Hello, JLalin
I wish I could move or resize TLabel, inserted at runtime into a TBevel, but I do not know how to identify the component.
Can you give me a little help?
Regards,
Frank
P.S. EXAMPLE ENCLOSE
Attached files DragDetect-1-0-0-0.zip (28.4 KB)Â
I wish I could move or resize TLabel, inserted at runtime into a TBevel, but I do not know how to identify the component.
Can you give me a little help?
Regards,
Frank
P.S. EXAMPLE ENCLOSE
Attached files DragDetect-1-0-0-0.zip (28.4 KB)Â
Select a part of image
Franco,
I just modified it to show you how to detect the label.
Regards,
José Lalín
--
Attached files Drag.zip (2.2 KB)Â
I just modified it to show you how to detect the label.
Regards,
José Lalín
--
Attached files Drag.zip (2.2 KB)Â
Select a part of image
Hi Josí¨,
thank you for your helpful suggestions
I changed code as attached, but I still have problems with positioning and sizing especially by moving the mouse quickly.
I do not know if I have taken the right path.
Thanks again for your time
Regards,
Frank
Attached files DragDetect-1-0-0-0.zip (29.4 KB)Â
thank you for your helpful suggestions
I changed code as attached, but I still have problems with positioning and sizing especially by moving the mouse quickly.
I do not know if I have taken the right path.
Thanks again for your time
Regards,
Frank
Attached files DragDetect-1-0-0-0.zip (29.4 KB)Â
Select a part of image
Franco,
sorry, never did something like that and can't figure a way to do it.
Try adding a SetCapture( oSender:Handle ) in OnRDown and ReleaseCapture()
in OnRUp() or even in the OnMouseMove methods but don't know if it will work.
Regards,
José Lalín
sorry, never did something like that and can't figure a way to do it.
Try adding a SetCapture( oSender:Handle ) in OnRDown and ReleaseCapture()
in OnRUp() or even in the OnMouseMove methods but don't know if it will work.
Regards,
José Lalín
Select a part of image
Hello Jose,
If you are interested and can be helpful, here is how I solved.
I enclose small example
Regards
Franco
Attached files MoveResize-1-0-0-0.zip (2.7 KB)Â
If you are interested and can be helpful, here is how I solved.
I enclose small example
Regards
Franco
Attached files MoveResize-1-0-0-0.zip (2.7 KB)Â
Select a part of image
Franco,
good job! Congrats!
Regards,
José Lalín
good job! Congrats!
Regards,
José Lalín