Solved

How to draw shapes on a tab control

Posted on 2009-04-04
1
1,204 Views
Last Modified: 2013-12-17
Hi,

I have a polygon displayed on the main form in C# using gdi+. This displays fine, but I now need to have more than one polygon displayed, so I need to have each one on a different tab so the user can swap between each one easily. But I have not been able to display gdi graphics on a tab control in C# 2008.

Anyone know more about this? Help much appreciated.
0
Comment
Question by:dg_dibs
1 Comment
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 24068272
Just handle the Paint() event for each TabPage...
    public partial class Form1 : Form

    {
 

        private Point[] poly1 = new Point[] {new Point(50,50), new Point(250,50), new Point(175, 250)};

        private Point[] poly2 = new Point[] { new Point(50, 250), new Point(175, 50), new Point(250, 250) };
 

        private void tabPage1_Paint(object sender, PaintEventArgs e)

        {

            e.Graphics.DrawPolygon(Pens.Black, poly1);

        }
 

        private void tabPage2_Paint(object sender, PaintEventArgs e)

        {

            e.Graphics.DrawPolygon(Pens.Black, poly2);

        }

    }

Open in new window

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now