-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: surajmsn
Message 1 in Discussion

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(TextBox1.Text)         
        Dim arrowAngle As New Integer 
     
 'o% is 0 Degrees and 100% is 180 degrees
        arrowAngle = Integer.Parse(iPercentage * 1.8) 
        'for drawing the arcs , using the drw pie method
        '****************************************************************
        Dim objBitmap As New Bitmap(200, 200)           Dim objGraphic As 
Graphics = Graphics.FromImage(objBitmap)
        Dim blackPen As New Pen(Color.Black, 5)         Dim whiteBrush As New 
SolidBrush(Color.White)
        objGraphic.FillRectangle(whiteBrush, 0, 0, 200, 200) 
        Dim rect As New RectangleF(0, 0, 200, 200)         
objGraphic.DrawPie(Pens.Black, rect, 0, -180)
        Dim rect1 As New Rectangle(0, 0, 200, 200)
        objGraphic.FillPie(Brushes.Blue, rect1, 0, -180)         rect = New 
RectangleF(10, 10, 180, 180)         objGraphic.DrawPie(Pens.Black, rect, 0, 
-180)
        rect1 = New Rectangle(10, 10, 180, 180)         
objGraphic.FillPie(Brushes.White, 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(arrowAngle) * 100
        msin = Math.Sin(arrowAngle) * 100 
        objGraphic.DrawLine(Pens.Blue, 100, 100, mcos, msin)         
Response.ContentType = "image/gif"
        objBitmap.Save(Response.OutputStream, ImageFormat.Gif) 
        objGraphic.Dispose() 
*********************************************************   Please Help me out 
in this.   Regards Sura

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to