06-18-2008, 5:36
|
Gunasekaran

Joined on 05-07-2008
Chennai,India
Posts 171
|
how to display measurement unit programmatically
|
 
 
|
|
|
Hello, I am using Leadtool V.15 and medicalviewer demo as my sample....I would like get the measurement unit programmatically.. Dim x1 as integer Dim x2as integer Dim y1 as integer Dim y2 as integer
Step1: In mousedown event I stored X1=e.X and Y1 =e.Y Step2: In mouseup event I stored X2=e.X and Y2 =e.Y Step3: Formula for converting Pixel to Cm is LengthCM =
LenghtPixels * 2.54 / DPI I have calculated LenghtPixels =Abs(X2-X1)*Abs(Y2-Y1) and for DPI I have used R_Viewer.ImageDpiX value .... is it correct?????
My code for calculating CM ....
Private Sub _medicalViewer_CustomPaint(ByVal sender As Object, ByVal e As MedicalViewerPaintEventArgs) e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias e.Graphics.DrawLine(Pens.Red, x1, y1, x2, y2) _image = _medicalViewer.Cells(0).Image Dim pixel As Integer = Abs(x2 - x1) * Abs(y2 - y1) Dim image1 As RasterImage = _medicalViewer.Cells(0).Image R_Viewer.Image = image1 Dim LengthCM As Integer = CType(((CType(pixel, Single) * 2.54) / CType(R_Viewer.ImageDpiX, Single)), Integer) MsgBox("LengthCM=" & (LengthCM / 10)) _medicalViewer.Invalidate() End Sub
Problem : 1cm value is showing wrongly . 2.While I draw the next Line ,the first line which was drawn already disappears why? what should i add for consecutive drawing line one after another...
Please solve this probs... Thanks in advance Sakthi
Thanks and Regards Guna
|
|
|
|
|
Report
|
|
|
|