Results 1 to 3 of 3

Thread: How to draw a rectangle on a control

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Posts
    105

    How to draw a rectangle on a control

    Hi everyone

    I want to draw a rounded rectangle on a TabControl page. I've tried using .CreateGraphics method but nothing happens. (I also need to draw a line)

    I can draw on the form ok but i can't draw on the tabpage, I tried using paint events(base OnPaint) but there's no paint event for the TabControl so does anyone know how this can be done?

    I also want to draw a line across a listview but like the TabControl this doesn't work either.

    Can anyone help?

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Posts
    105
    Ignore this, I just called the OnPaint event again and it now draws the rounded rectangle and line ok.

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Every control that inherits Control class has Graphics object associated with it . It's called CreateGraphics that acts like a graphics object which is used for drawing different shapes . It has also ready to used methods (Draw... , Fill.....) .

    You can do this for example :

    VB Code:
    1. Label.CreateGraphics().DrawLine(..........) .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width