By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,888 Members | 1,232 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,888 IT Pros & Developers. It's quick & easy.

Zoom in Cephalometric system

P: n/a
I've been with a problem for about two months and i've bought books and
search the internet for an explanation, and haven't found one.
I'm developing a cephalometric software, that needs to capture an image from
the scanner, mark the image with dots in order to find distances and angles.
Everything is ok except when i try to zoom in/zoom out the image. Every
calculated angle and distance becomes variable because when i use the zoom
the dots have to be repositioned on the image, acording to the pacient face
I'm using a "picturebox" and the "Zoom" value in the "SizeMode" property
when i try to zoom in i'm using the following code on the button:

Private Sub ZoomIn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ZoomIn.Click
Dim intWidthAnterior As Integer, intWidthPosterior As Integer
Dim intHeightAnterior As Integer, intHeightPosterior As Integer
Dim sngDpiX As Single, sngDpiY As Single
Dim g As Graphics = picDraw.CreateGraphics
sngDpiX = g.DpiX
sngDpiY = g.DpiY
intWidthAnterior = picDraw.Width
intHeightAnterior = picDraw.Height
picDraw.Width = picDraw.Width * 1.2 'Here i'm making the
picturebox larger
picDraw.Height = picDraw.Height * 1.2 'Here i'm making the
picturebox larger
intWidthPosterior = picDraw.Width
intHeightPosterior = picDraw.Height

MainDrawPics.RedefinePontosAdicao(intWidthAnterior ,
intHeightAnterior, intWidthPosterior, intHeightPosterior, picDraw, sngDpiX,
sngDpiY)
picDraw.Refresh()
End Sub

'And this function is used to reposition the dots (point) on the screen
Friend Overloads Sub RedefinePontosAdicao(ByVal intWidthPictureBoxAnterior
As Integer, ByVal intHeightPictureBoxAnterior As Integer, _
ByVal
intWidthPictureBoxPosterior As Integer, ByVal intHeightPictureBoxPosterior As
Integer, _
ByVal picDesenho As
System.Windows.Forms.PictureBox, ByVal sngDesenhoDpix As Single, _
ByVal sngDesenhoDpiy As Single)

Dim intContador As Integer
Dim intResultado As Integer
Dim sngFactor As Single = 1.2
'I have an array with all the dots that have been marked on the patient
face, and this procedure
'tries to reposition the dots on the screen in order to show the
user the place where he clicked
'but in a larger scale
For intContador = 0 To UBound(ArrayPontos) - 1
intResultado = CInt(ArrayPontos(intContador).lngValorX *
sngFactor)
ArrayPontos(intContador).lngValorX = intResultado
intResultado = CInt(ArrayPontos(intContador).lngValorY *
sngFactor)
ArrayPontos(intContador).lngValorY = intResultado
Next
End Sub

I'm really desperate!
My thanks in advanced
Feb 15 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Ricardo Furtado wrote:
I've been with a problem for about two months and i've bought books
and search the internet for an explanation, and haven't found one.
I'm developing a cephalometric software, that needs to capture an
image from the scanner, mark the image with dots in order to find
distances and angles. Everything is ok except when i try to zoom
in/zoom out the image. Every calculated angle and distance becomes
variable because when i use the zoom the dots have to be repositioned
on the image, acording to the pacient face
If you work in a world-space then the positions of the dots are always the
same.
Transform from world-space to screen-space when you display it, and have a
reverse transformation from screen-space to world-space for identifying
where the user clicked.

'And this function is used to reposition the dots (point) on the
screen Friend Overloads Sub RedefinePontosAdicao( <snip> 'I have an array with all the dots that have been marked on the
patient face, and this procedure
'tries to reposition the dots on the screen in order to show
the
user the place where he clicked
'but in a larger scale
For intContador = 0 To UBound(ArrayPontos) - 1


Surely that should be UBound(ArrayPontos) without subtracting 1?

I suspect you aren't taking into account the origin when you're scaling.

It would be easier if you put screen grabs of what happens and what you want
to happen on a web page somewhere so we can see what's going wrong.

Andrew
Feb 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.