[VB6]i need some advices;)
i have some properties for change the colision rectangule dimensons. these properties are working fine. but the problem is that my UC scalemode can be diferent from parent(a container) scalemode(these scalemode isn't knowed).
how can i convert the my UC(that's in pixel mode) for the parent scalemode?
thanks
Re: [VB6]i need some advices;)
Try using ScaleX & ScaleY. If x is in usercontrol scalemode....
myLeft = ScaleX(X, Usercontrol.ScaleMode, vbContainerPosition)
:: vbContainerSize is used when measuring dimensions/sizes
:: vbContainerPosition is used when converting X,Y coordinates
Edited: Keep in mind that scalemode can be different for every control. If your uc is in a picbox (uc container) and that picbox is in another picbox that is on the form, both picboxes can have different scalemodes as well as the form.
Re: [VB6]i need some advices;)
Quote:
Originally Posted by
LaVolpe
Try using ScaleX & ScaleY. If x is in usercontrol scalemode....
myLeft = ScaleX(X, Usercontrol.ScaleMode, vbContainerPosition)
:: vbContainerSize is used when measuring dimensions/sizes
:: vbContainerPosition is used when converting X,Y coordinates
Edited: Keep in mind that scalemode can be different for every control. If your uc is in a picbox (uc container) and that picbox is in another picbox that is on the form, both picboxes can have different scalemodes as well as the form.
see these code:
Code:
L1 = Extender.Left + Col.Left
T1 = Extender.Top + Col.Top
W1 = Col.width
H1 = Col.height
the Col.... are in pixel(it's our UC).
Code:
L2 = ctlTemp.Left + Parent.Controls(i).LimColLeft
T2 = ctlTemp.Top + Parent.Controls(i).LimColTop
W2 = ctlTemp.LimColWidth
H2 = ctlTemp.LimColHeight
the LimCol..... are another instance in same container(i don't know the scalemode).
these is why that i ask. the UC is in pixel, but the container can have a diferent scalemode.
i belive that my math isn't correct, unless the container is in pixel too;)
Re: [VB6]i need some advices;)
then i belive, like you said, that i need convert the col values(without change them).
tell me how can i convert pixels to container scalemode. is pixels*screen.twips or pixels\screen.twips?
thanks
Re: [VB6]i need some advices;)
ScaleX and ScaleY as I suggested in post #2.
Re: [VB6]i need some advices;)
i continue not reciving the right values:(
Code:
If Col.Activate = True Then
L1 = Extender.Left + ScaleX(Col.Left, UserControl.ScaleMode, vbContainerPosition)
T1 = Extender.Top + ScaleY(Col.Top, UserControl.ScaleMode, vbContainerPosition)
W1 = ScaleX(Col.width, UserControl.ScaleMode, vbContainerSize)
H1 = ScaleY(Col.height, UserControl.ScaleMode, vbContainerSize)
Else
Code:
If ctlTemp.LimColActivate = True Then
L2 = ctlTemp.Left + ScaleX(ctlTemp.LimColLeft, UserControl.ScaleMode, vbContainerPosition)
T2 = ctlTemp.Top + ScaleY(ctlTemp.LimColTop, UserControl.ScaleMode, vbContainerPosition)
W2 = ScaleX(ctlTemp.LimColWidth, UserControl.ScaleMode, vbContainerSize)
H2 = ScaleY(ctlTemp.LimColHeight, UserControl.ScaleMode, vbContainerSize)
Else
thanks