Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8972477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:13:38+00:00 2026-06-15T18:13:38+00:00

I have used the PAINT event to draw a wave on a Panel in

  • 0

I have used the PAINT event to draw a wave on a Panel in Winows Form Application. But when using it WPF, I didn’t find any such element equivalent to a Panel which has a Paint Event. Googled a lot too but no great use.

Well, I need to draw a waveform in WPF so suggest appropriate solutions wrt PaintArgsEvent or a new solution altogether.

Thank You!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:13:39+00:00Added an answer on June 15, 2026 at 6:13 pm

    You are looking for the DrawingVisual Class

    From first Link:

    The DrawingVisual is a lightweight drawing class that is used to render shapes, images, or text. This class is considered lightweight because it does not provide layout or event handling, which improves its performance. For this reason, drawings are ideal for backgrounds and clip art.


    You also have access to a PolyLine Class that you can add a point Collection to. This example is a modified MSDN Forum example

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
    
            float x0 = 100f;
            float y0 = 100f;
            Polyline myPoly = new Polyline();
            PointCollection polyPoints = myPoly.Points;
            Point[] points = new Point[200];
    
            for (int j = 0; j < 200; j++)
            {
                points[j] = new Point();
                points[j].X = x0 + j;
                points[j].Y = y0 -
                (float)(Math.Sin((2 * Math.PI * j) / 200) * (200 / (2 * Math.PI)));
            }
    
            for (int i = 0; i < points.Length ; i++)
            {
                polyPoints.Add(points[i]);
            }
    
            myPoly.Stroke = Brushes.Green;
            myPoly.StrokeThickness = 5;
            StackPanel mainPanel = new StackPanel();
            mainPanel.Children.Add(myPoly);
            this.Content = mainPanel;
    
        }
    }
    

    And a Modified MSDN example:

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
    
            float x0 = 100f;
            float y0 = 100f;
            Point[] points = new Point[200];
    
            for (int j = 0; j < 200; j++)
            {
                points[j] = new Point();
                points[j].X = x0 + j;
                points[j].Y = y0 -
                (float)(Math.Sin((2 * Math.PI * j) / 200) * (200 / (2 * Math.PI)));
            }
    
            DrawingBrush db = new DrawingBrush(CreateDrawingVisualRectangle(points).Drawing);
            StackPanel mainPanel = new StackPanel();
            mainPanel.Background = db;
            this.Content = mainPanel;
    
        }
    
        private DrawingVisual CreateDrawingVisualRectangle( Point[] pointarray)
        {
            DrawingVisual drawingVisual = new DrawingVisual();
    
            // Retrieve the DrawingContext in order to create new drawing content.
            DrawingContext drawingContext = drawingVisual.RenderOpen();
    
           // Create a rectangle and draw it in the DrawingContext.
           for (int i = 0; i < pointarray.Length-1; i++)
           {
               drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Blue), 2), pointarray[i], pointarray[i + 1]);
           }
    
           // Persist the drawing content.
           drawingContext.Close();
    
           return drawingVisual;
         }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used the silverlight control in CRM 2011.It also published on form but
I have used to draw pie chart using canvas.. There are approximately 10 arcs
I am making a paint project like photoshop using c#. I have used GDI+
Up to this point, I have used the following code to restrict the application
I have used a plugin that uses prototype js, it's working fine but the
I have used NSSets many times in my apps, but I have never created
I have a library that draw on to given HDC using GDI+ apis. I
I have drawn Image on a custom control. But whenever I draw another Image
I have an application in which the user can draw some points with the
I have written an event handler method and attached it to the Paint event

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.