Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. TabPages Disabling

TabPages Disabling

Scheduled Pinned Locked Moved Visual Basic
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    advansis
    wrote on last edited by
    #1

    Hi, I need to disable a tabpage in a tabcontrol. I 've tried to set the property "Enabled" to FALSE, but it doesn't shadow the text. So I tried to set the forecolor property of the tabpage, but it doesn't work. Finally I tried to draw each item by code as Microsoft suggests(through the drawitem event), but the result is really ugly (it losts the visual effects and the text doesn't fit in the bounds). I cannot remove and re-add the pages for 2 reasons: 1) Each page could be enabled or disabled depending on several values in the form, so it is difficult to re-add the page in the right place 2) I LIKE the behaviour of old VB6 tabcontrol. Can anyone help me ??? Thanx a lot.

    Peace!

    D A 2 Replies Last reply
    0
    • A advansis

      Hi, I need to disable a tabpage in a tabcontrol. I 've tried to set the property "Enabled" to FALSE, but it doesn't shadow the text. So I tried to set the forecolor property of the tabpage, but it doesn't work. Finally I tried to draw each item by code as Microsoft suggests(through the drawitem event), but the result is really ugly (it losts the visual effects and the text doesn't fit in the bounds). I cannot remove and re-add the pages for 2 reasons: 1) Each page could be enabled or disabled depending on several values in the form, so it is difficult to re-add the page in the right place 2) I LIKE the behaviour of old VB6 tabcontrol. Can anyone help me ??? Thanx a lot.

      Peace!

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You two choices. One is to draw the tabs yourself, fixing your drawing code. I wish I had some examples to give you but I just about never use the TabControl, except in an Options dialog. The other is to find a 3rd party TabControl that supports the visual effects you want. I don't know of any off the top of my head, well, because I just about never use the TabControl. ;)

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      • A advansis

        Hi, I need to disable a tabpage in a tabcontrol. I 've tried to set the property "Enabled" to FALSE, but it doesn't shadow the text. So I tried to set the forecolor property of the tabpage, but it doesn't work. Finally I tried to draw each item by code as Microsoft suggests(through the drawitem event), but the result is really ugly (it losts the visual effects and the text doesn't fit in the bounds). I cannot remove and re-add the pages for 2 reasons: 1) Each page could be enabled or disabled depending on several values in the form, so it is difficult to re-add the page in the right place 2) I LIKE the behaviour of old VB6 tabcontrol. Can anyone help me ??? Thanx a lot.

        Peace!

        A Offline
        A Offline
        Ali 110
        wrote on last edited by
        #3

        Hello :) Try this that at the event of paint event of your tab page set its focus to some other or next object. Example: Private Sub tabpage1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles tabpage1.Paint tabpage2.Selected = True End Sub Regards Ali Raza

        A 1 Reply Last reply
        0
        • A Ali 110

          Hello :) Try this that at the event of paint event of your tab page set its focus to some other or next object. Example: Private Sub tabpage1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles tabpage1.Paint tabpage2.Selected = True End Sub Regards Ali Raza

          A Offline
          A Offline
          advansis
          wrote on last edited by
          #4

          Nice idea, the controls inside the page don't respond anymore. This can be obtained (with grayed controls) also by setting the property enabled of the tabpage... But doesn't resolve the problem of graying the tabpage title. Thanks, anyway. For other friends: the command is TabPage2.Select (is a method, not a property). Regards, Advansis

          Peace!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups