Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Calling a PaintEventArgs in C# web form

  • 25-04-2006 8:13am
    #1
    Closed Accounts Posts: 29


    Hi,

    I am trying something simple, just trying to draw a pie chart on a web form. I wish to call a PaintEventArgs when a button click event is called. Below is my code
    protected void Button1_Click(object sender, EventArgs e)
        {
            //Creating an instance of DrawPieFloat
            this.Paint += new PaintEventHandler(DrawPieFloat);
        }
    
        public void DrawPieFloat( PaintEventArgs e)
        {
             // Create pen.
            Pen blackPen = new Pen(Color.Black, 3);
            // Create location and size of ellipse.
            float x = 0.0F;
            float y = 0.0F;
            float width = 200.0F;
            float height = 100.0F;
            // Create start and sweep angles.
            float startAngle = 0.0F;
            float sweepAngle = 45.0F;
            // Draw pie to screen.
            g.Graphics.DrawPie(blackPen, x, y, width, height, startAngle, sweepAngle);
        }
    

    The error I get is "The type or namespace name "PaintEventArgs" could not be found. I think what I am doing wrong is calling "this.Paint" which is a win form rather than a web form call.

    Any help would be great?


Comments

  • Registered Users, Registered Users 2 Posts: 151 ✭✭sailorfoley


    Hey,

    your right. The paint event does not exist for Web Pages, it exists only in Windows Forms. To further answer your question - the type PaintEventArgs exists only in the System.Windows.Forms namespace.

    Web pages are HTML. What you want to do is when you click a button the chart re-draws? I would make a control that displays the chart on screen and when the button is clicked, change the chart in whatever way you want. The browser will then display the chart on screen with changes.

    Hope this helps


Advertisement