Page 1 of 1

Image Get and Set Properties

Posted: Sat Sep 24, 2016 1:04 am
by Pablo César
Hi Claudio,

I'm sorry to distrubing again. But now after my last experience in sources of my "What displays when no image available?" topic and I've to appoint this observation:

When we use SET CONTROL <Image_Control_Name> OF <Form_Name> CLIENTEDGE, image control size (width and height) is increasing due edge's size. is it normal ?
I test with all internal function to get image's size and figures returns wrong by the reason of image's container are bigger... :o

I've tried with these 4 options:

BT_BitmapWidth (hBitmap)/BT_BitmapHeight (hBitmap)
  • GetProperty(cForm,cControl,"Width")/GetProperty(cForm,cControl,"Height")
  • GetWindowWidth()/GetWindowHeight()
  • _HMG_SYSDATA [ 31 ]/_HMG_SYSDATA [ 32 ]
These all options returns width and height sizes which should be mostly same size for the respective image control. But disappointingly this not happen, always size is wrongly increasing. If you cut of CLIENTEDGE of control, then works ok.

IMHO this EDGE's size should it be not be considered as part of control's size.

In short:
  1. Is it normal to increase the image size when EDGE style is choosen ?
  2. Is it possible the EDGE's properties not being part as control's size and not interering int width/height of image control ? (not increasing)
Here's for your testing:
Claudio.rar
Sources and executable files (for Claudio test)
(1.46 MiB) Downloaded 214 times
Waiting for your comments.

Best regards,

Re: Image Get and Set Properties

Posted: Sat Sep 24, 2016 4:46 am
by srvet_claudio
I will check.

Image Get and Set Properties

Posted: Mon Feb 27, 2017 3:03 pm
by Pablo César
Claudio, have you seen this my question ?
Screen103.png
Screen103.png (68.47 KiB) Viewed 2768 times
In the attached executable file you can see image increading size.

Re: Image Get and Set Properties

Posted: Mon Feb 27, 2017 5:22 pm
by srvet_claudio
Yes is normal that the size increase. You need make the following step:

// nOldStyle := HMG_ChangeWindowStyle ( hWnd, [ nAddStyle ], [ nRemoveStyle ], [ lExStyle ], [ lRedrawWindow ] )

1) remove edge style if exist
old := HMG_ChangeWindowStyle ( hwnd, NIL, HB_bitOR (WS_EX_CLIENTEDGE, WS_EX_STATICEDGE, WS_EX_WINDOWEDGE), .T. )

2) get the image size

3) restore the old style
HMG_ChangeWindowStyle ( hwnd, old, NIL, .T. )

Image Get and Set Properties

Posted: Mon Feb 27, 2017 10:37 pm
by Pablo César
Ohhh, is it normal...

Thank you for your valious tip.

I will do that.