C# Windows Form

Is there a way to create a control that has tabs that appear to extend beyond the boundaries of the control?
tsmolskowAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
What about using TabControl?
madprCommented:
Try placing a Panel container on the form with AutoScroll set to true - this will give you scrollbars if a child extends
beyond the size of the panel. Next add a child TabPanel to it and set whatever with and height you need it to be.
shtsonCommented:
What you should actually do
is make ur comtrol bigger
and override the OnPaint method
and paint the tabs urself
that way - you can get transparency on the top of the control (where it collides with the background form)
and you can turn it on / off by simply not painting anything there.

Cheers,
Shai
tsmolskowAuthor Commented:
Sounds cool, can you give me a code example for the override on Paint method?
shtsonCommented:
Ok, but its a very simple

A. Create a new windows form project
B. Add a UserControl file
C. Add a button to the user control
D. Add the following code to the user control:
            protected override void OnPaint(PaintEventArgs e)
            {
                  base.OnPaint (e);

                  if( m_DrawBox )
                  {
                        using( Brush fill = new SolidBrush(Color.Gray) )
                        {
                              e.Graphics.FillRectangle(fill, 5, 5, 100, 100);
                        }

                        using( Pen border = new Pen(Color.Black) )
                        {
                              e.Graphics.DrawRectangle( border, 5, 5, 100, 100 );
                        }
                  }
            }

            private void button1_Click(object sender, System.EventArgs e)
            {
                  m_DrawBox = !m_DrawBox;
                  this.Invalidate( true );
            }
E. Set the buttons Click event to point to the function
F. Build the project
G. Add the control to your form
H. Run!

Have fun
Cheers,
Shai

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.