Image Get and Set Properties

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Image Get and Set Properties

Post 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,
Last edited by Pablo César on Mon Feb 27, 2017 3:08 pm, edited 9 times in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Image Get and Set Properties

Post by srvet_claudio »

I will check.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Image Get and Set Properties

Post by Pablo César »

Claudio, have you seen this my question ?
Screen103.png
Screen103.png (68.47 KiB) Viewed 2764 times
In the attached executable file you can see image increading size.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Image Get and Set Properties

Post 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. )
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Image Get and Set Properties

Post by Pablo César »

Ohhh, is it normal...

Thank you for your valious tip.

I will do that.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply