Hi All,
I am tying to build a ASP.net 2.0 based web page which displays a Analog
Guage ( 0 to 180 degrees) with an Arrow in the middle.
The application accepts the Percentage as input from a text box and then
generates an image which shows a Arrow pointer dipicting that percentage on
the Arc (or guage).
I am dynamically generating the arcs and the pointer using Draw Pie ( and
Fill pie) and DrawLine methods of the Graphics Class.
But the problem is though the logic is correct, but the drawline is not i
the correct angle. Can you please help my find out where i have gone wrong. I
hae pasted the code, you can run and check how it is working.
Code Below:
*************** *************** *************** ************
Dim iPercentage As New Integer
iPercentage = Integer.Parse(T extBox1.Text)
Dim arrowAngle As New Integer
'o% is 0 Degrees and 100% is 180 degrees
arrowAngle = Integer.Parse(i Percentage * 1.8)
'for drawing the arcs , using the drw pie method
'************** *************** *************** *************** *****
Dim objBitmap As New Bitmap(200, 200)
Dim objGraphic As Graphics = Graphics.FromIm age(objBitmap)
Dim blackPen As New Pen(Color.Black , 5)
Dim whiteBrush As New SolidBrush(Colo r.White)
objGraphic.Fill Rectangle(white Brush, 0, 0, 200, 200)
Dim rect As New RectangleF(0, 0, 200, 200)
objGraphic.Draw Pie(Pens.Black, rect, 0, -180)
Dim rect1 As New Rectangle(0, 0, 200, 200)
objGraphic.Fill Pie(Brushes.Blu e, rect1, 0, -180)
rect = New RectangleF(10, 10, 180, 180)
objGraphic.Draw Pie(Pens.Black, rect, 0, -180)
rect1 = New Rectangle(10, 10, 180, 180)
objGraphic.Fill Pie(Brushes.Whi te, rect1, 0, -180)
'to display the arrow with in the Pie Drawn which gives the Guage
Look and feel
' i am getting the Coordinated for the angle found so that the line drawn
is at an angle.
'************** *************** *************** ****
Dim mcos As Integer
Dim msin As Integer
mcos = Math.Cos(arrowA ngle) * 100
msin = Math.Sin(arrowA ngle) * 100
objGraphic.Draw Line(Pens.Blue, 100, 100, mcos, msin)
Response.Conten tType = "image/gif"
objBitmap.Save( Response.Output Stream, ImageFormat.Gif )
objGraphic.Disp ose()
*************** *************** *************** ************
Please Help me out in this.
Regards
Sura 0 1757 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Baro |
last post by:
I wish to draw a line say 10px wide at a 45 degree angle (or any other
angle) and have it shaded say from gray to red to gray again (or any other
color).
I can get the line by using a GraphicsPath object but cannot work out the
shading part.
Is this also possible for say a circle with an outside line width of 10px to
be shaded from red to gray from the inside out around the circumference of
the circle.
|
by: Peter Proost |
last post by:
Hi group,
I got the following piece of code which draws a square with stars round it,
now I want the stars to rotate round the square, I can do this with the
mx.rotate and a timer and an angle, but this rotates the whole drawing of
the stars but what I realy want is for the stars to rotate round it's center
point, is this possible? I hope I was clear enough in my explanation.
Thanks in advance
|
by: The Mess |
last post by:
I am using VB5.
I wish I had a function to draw a line, giving the angle and length but I do
not have the math skills involved to do this. Does anyone have a function
that they care to share that does this?
I was thinking something like:
Public Sub DrawLine(X1 as single, Y1 as single, Len as single, Angle as
single, byref X2 as single, byref Y2 as single)
and have X2 and Y2 assigned in the Sub (rather than just a line drawn -
because I...
|
by: Hugh Janus |
last post by:
I am trying to draw a compass on a form but my maths is not up to
scratch! I have the disc with the bearing markers but have no idea how
to calculate the needle line based on the desired degree.
Does anyone know what the formula is to create it? If my circle is 50
by 50 I need to plot a line starting in the centre and going out to the
outer circle and touching it at the x degrees mark. Ideas??!
Thanks
|
by: Jem |
last post by:
Hi all
I have the following code which draws a vertical line on a form...
Dim VertCrossHairX1 As Integer = 75
Dim VertCrossHairX2 As Integer = 75
Dim VertCrossHairY1 As Integer = 70
Dim VertCrossHairY2 As Integer = 80
| |
by: sravan_reddy001 |
last post by:
I am creating an analog clock. so i hav to draw the line from center
to a point in the circle. How can i get the co-ordinates of the points
on the circle i fmention the radius and the center of the circle.
|
by: Sinem |
last post by:
Hello
I am making a drawing application where I want the user to be able to draw straight lines (quite similar to the line tool in Flash). I want them to be able to draw these lines at any angle they want but they have to be straight and the lengths can only vary between 4 pixels long and 200 pixels long. (The weight of the lines I want to be 2 pixels).
I would be ever so grateful if you could help me out on this,
I have flash mx...
|
by: Keith Hughitt |
last post by:
Hi all,
I am using someone else's script which expects input in the form of:
./script.py <arg1arg2
I was wondering if the angle-brackets here have a special meaning? It
seems like
they specify an input and output stream to use in place of the
console. I could not
|
by: Gianni Mariani |
last post by:
Do you have a preference on maximum line width for C++ code?
I've seen the craziest debates on this most silly of topic.
I have witnessed engineers spent oodles of time fiddling with line
breaks just to get it right. I find in general a prescriptive rule
makes for markedly less readable code, which unfortunately is a
subjective argument, however, the waste of time modifying code when it
does not need to is not.
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |