I want to learn how to draw shapes with wxWidgets. Where do I start? In case there are multiple ways, I prefer ease of use over cross-platform compatibility. I’m a Windows user.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
This is done by creating a wxPanel, connecting to the paint event, and using the DC provided in that paint event to draw various things.
The DC has a number of drawing related functions. This will probably be using Windows GDI or something similar, which means performance probably won’t be fantastic, but it should work for simple purposes. You can find a tutorial with sample code on the Wiki. Look for the documentation for the wxDC class to see a list of drawing functions you can use.
If you need something with more performance, look into the wxGLCanvas which renders a hardware accelerated OpenGL canvas.