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(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles ZoomIn.Click
Dim intWidthAnterio r As Integer, intWidthPosteri or As Integer
Dim intHeightAnteri or As Integer, intHeightPoster ior As Integer
Dim sngDpiX As Single, sngDpiY As Single
Dim g As Graphics = picDraw.CreateG raphics
sngDpiX = g.DpiX
sngDpiY = g.DpiY
intWidthAnterio r = picDraw.Width
intHeightAnteri or = 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
intWidthPosteri or = picDraw.Width
intHeightPoster ior = picDraw.Height
MainDrawPics.Re definePontosAdi cao(intWidthAnt erior,
intHeightAnteri or, intWidthPosteri or, intHeightPoster ior, picDraw, sngDpiX,
sngDpiY)
picDraw.Refresh ()
End Sub
'And this function is used to reposition the dots (point) on the screen
Friend Overloads Sub RedefinePontosA dicao(ByVal intWidthPicture BoxAnterior
As Integer, ByVal intHeightPictur eBoxAnterior As Integer, _
ByVal
intWidthPicture BoxPosterior As Integer, ByVal intHeightPictur eBoxPosterior As
Integer, _
ByVal picDesenho As
System.Windows. Forms.PictureBo x, 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(ArrayPon tos) - 1
intResultado = CInt(ArrayPonto s(intContador). lngValorX *
sngFactor)
ArrayPontos(int Contador).lngVa lorX = intResultado
intResultado = CInt(ArrayPonto s(intContador). lngValorY *
sngFactor)
ArrayPontos(int Contador).lngVa lorY = intResultado
Next
End Sub
I'm really desperate!
My thanks in advanced 1 1675
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 RedefinePontosA dicao(
<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(ArrayPon tos) - 1
Surely that should be UBound(ArrayPon tos) 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: davide rocchelli |
last post by:
I have found a probable bug when you draw with GDI.
Look this simple code
Private Sub Form1_Paint(ByVal sender As Object, ByVal e
As System.Windows.Forms.PaintEventArgs) Handles
MyBase.Paint
Const Zoom As Single = 0.001
Dim p As Pen
|
by: Mo Ade via .NET 247 |
last post by:
How do I write code to include a zoom feature in my project so that when my Vb Form loads an image I can click in my main menu zoom in or zoom out?
--------------------------------
From: Mo Ade
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>6aW7IUJA+0CCEGJ4S8DRuA==</Id>
|
by: Boni |
last post by:
Dear all,
I need a picturebox on which I can with GDI+ draw rectangles. The scroll and
zoom should be supported. Do I have to manually resize rectangles,when zoom
button clicked and change position when scroll done and redraw with new
coordinates? Is there some standard procedure for that? Any link or advice
is greatly appreciated.
Thanks,
Boni
|
by: DMCD |
last post by:
I want to allow my program users to:
1. Open a jpg inside of a panel control
(PictureBox control inside Panel control ... PictureBox picture set to
user's jpg file selection);
2. Zoom in and out on the jpg
(change the picturebox size mode to zoom and scale the photo);
3. Move the jpg up, down, left right within a container control
(using the MouseDown and MouseMove events, I change the location
of the jpg);
4. Save the visible...
|
by: Yoshitha |
last post by:
I'm developing windows application using c#.net (vs 2003), i've placed
several images (picture boxes) in panel control and i want to zoom the
panel control so that the images and text which contained in the panel
control has to be zoomed and i want to work on that zoomed portion like we
work in photo shop by zooming the image.
can anybody tell me how to do this one using gdi+, or suggest me with some
articles which suies my...
| |
by: wasishincar |
last post by:
I'm trying to read a bitmap and zoom in/out it on screen.
I wrote some code but it did not perform as I expect. The bitmap shift
1 pixel to the upper-left coner when zooming in/out button was clicked.
Please kindly help me to check if anything wrong with my code. Many
many thanks.
using System.Drawing;
using System.Drawing.Drawing2D;
// Click Browse to open bitmap file
|
by: murry19830507 |
last post by:
i want creat an web application(c#.net),which contains an image and one radiobutton list with 3 radiobuttons(zoom in ,zoom out ,zoom window)
when user checked on zoom in
imge has to be zoom
inthe similar manner when zoom window is checked,it allow to create a rectangle window by using mouse pressed and released.and particular area of the map/image must be zoomed
or my source code writen bellow.
using System;
using System.Data;
|
by: alarock |
last post by:
HI
THIS IS MY CODE..I WANT TO ZOOM THE BITMAP..HOW IT IS POSSIBLE???
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |