|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Zoom in Cephalometric systemsearch 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 Ricardo Furtado wrote:
> I've been with a problem for about two months and i've bought books If you work in a world-space then the positions of the dots are always the > 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 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 <snip>> screen Friend Overloads Sub RedefinePontosAdicao( > 'I have an array with all the dots that have been marked on the Surely that should be UBound(ArrayPontos) without subtracting 1?> 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 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
check point inside "cirkle" (basketball)
Exposing properties of a class within a class Unresponsive UI during lengthy operation ? extending BackgroundWorker ProgressChangedEventArgs Invoking a PictureBox click ? Count lines in multi-line textbox Can't Figure Out Correct Syntax MethodInfo or MethodBase? ThreadPool.QueueUserWorkItem console.write |
|||||||||||||||||||||||