Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to draw shapes on a tab control

Posted on 2009-04-04
1
Medium Priority
?
1,212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

650 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