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. zoom in and out the tabcontrol and its contents

zoom in and out the tabcontrol and its contents

Scheduled Pinned Locked Moved Visual Basic
help
4 Posts 2 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.
  • E Offline
    E Offline
    eyes2007
    wrote on last edited by
    #1

    hi all i am working on a project that uses a tab control having three tabs, now i need to add a zoom feature on the form that will allow the tab control to zoom in and zoom out with every control on it as well. if some one has any idea about it then please let me know. thanks in advance. help everyone

    A 1 Reply Last reply
    0
    • E eyes2007

      hi all i am working on a project that uses a tab control having three tabs, now i need to add a zoom feature on the form that will allow the tab control to zoom in and zoom out with every control on it as well. if some one has any idea about it then please let me know. thanks in advance. help everyone

      A Offline
      A Offline
      Ajay k_Singh
      wrote on last edited by
      #2

      One way to achieve Zoom effect with TabControl is to increase or decrease size of tab control and all of its pages including its contents according to the Zoom factor which is required. I tried to implement this functionality with a tab control and following code should give you the desired result- ---------------------Code Start-------------------------------------------------------- Code to ZoomIn- ---------------------------- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnZoomIn.Click Dim ZoomFactor As Integer = 25 'In percent For Each tbpg As TabPage In Me.TabControl1.TabPages For Each cntrl As Control In tbpg.Controls cntrl.Width += cntrl.Width * ZoomFactor / 100 cntrl.Height += cntrl.Height * ZoomFactor / 100 cntrl.Left += cntrl.Left * ZoomFactor / 100 cntrl.Top += cntrl.Top * ZoomFactor / 100 cntrl.Refresh() Next Next Me.TabControl1.Width += Me.TabControl1.Width * ZoomFactor / 100 Me.TabControl1.Height += Me.TabControl1.Height * ZoomFactor / 100 Me.TabControl1.Refresh() End Sub --------------------------------- Code to ZoomOut – --------------------------------- Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnZoomOut.Click Dim ZoomFactor As Integer = 25 'In percent For Each tbpg As TabPage In Me.TabControl1.TabPages For Each cntrl As Control In tbpg.Controls cntrl.Width -= cntrl.Width * ZoomFactor / 100 cntrl.Height -= cntrl.Height * ZoomFactor / 100 cntrl.Left -= cntrl.Left * ZoomFactor / 100 cntrl.Top -= cntrl.Top * ZoomFactor / 100 cntrl.Refresh() Next Next Me.TabControl1.Width -= Me.TabControl1.Width * ZoomFactor / 100 Me.TabControl1.Height -= Me.TabControl1.Height * ZoomFactor / 100 Me.TabControl1.Refresh() End Sub ----------------------Code End--------------------- I hope this helps:). -Dave.

      Dave Traister, ComponentOne LLC. www.componentone.com

      E 1 Reply Last reply
      0
      • A Ajay k_Singh

        One way to achieve Zoom effect with TabControl is to increase or decrease size of tab control and all of its pages including its contents according to the Zoom factor which is required. I tried to implement this functionality with a tab control and following code should give you the desired result- ---------------------Code Start-------------------------------------------------------- Code to ZoomIn- ---------------------------- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnZoomIn.Click Dim ZoomFactor As Integer = 25 'In percent For Each tbpg As TabPage In Me.TabControl1.TabPages For Each cntrl As Control In tbpg.Controls cntrl.Width += cntrl.Width * ZoomFactor / 100 cntrl.Height += cntrl.Height * ZoomFactor / 100 cntrl.Left += cntrl.Left * ZoomFactor / 100 cntrl.Top += cntrl.Top * ZoomFactor / 100 cntrl.Refresh() Next Next Me.TabControl1.Width += Me.TabControl1.Width * ZoomFactor / 100 Me.TabControl1.Height += Me.TabControl1.Height * ZoomFactor / 100 Me.TabControl1.Refresh() End Sub --------------------------------- Code to ZoomOut – --------------------------------- Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnZoomOut.Click Dim ZoomFactor As Integer = 25 'In percent For Each tbpg As TabPage In Me.TabControl1.TabPages For Each cntrl As Control In tbpg.Controls cntrl.Width -= cntrl.Width * ZoomFactor / 100 cntrl.Height -= cntrl.Height * ZoomFactor / 100 cntrl.Left -= cntrl.Left * ZoomFactor / 100 cntrl.Top -= cntrl.Top * ZoomFactor / 100 cntrl.Refresh() Next Next Me.TabControl1.Width -= Me.TabControl1.Width * ZoomFactor / 100 Me.TabControl1.Height -= Me.TabControl1.Height * ZoomFactor / 100 Me.TabControl1.Refresh() End Sub ----------------------Code End--------------------- I hope this helps:). -Dave.

        Dave Traister, ComponentOne LLC. www.componentone.com

        E Offline
        E Offline
        eyes2007
        wrote on last edited by
        #3

        thank you verry much for your kind help, but i need to enlarge the font size of each control and also control the anchoring of each control. i think the reason behind the unusual behavior of the tab control is that i set the location of the tab control on form's load event. let me tell you what i did i take a panel, place the tab control on that panel so that the panel become the parent of the tab control, now i set the auto scroll property of panel to true, set the dock property of panel to fill. this will zoom the tab control, the other control on each tab but the font size remains same. what else i can do to work it properly. i more thing i have one more tab control on the first tab page of the main tab control. the things goes complicated now with this second tab control. thanks in advance help everyone -- modified at 6:50 Wednesday 24th October, 2007

        A 1 Reply Last reply
        0
        • E eyes2007

          thank you verry much for your kind help, but i need to enlarge the font size of each control and also control the anchoring of each control. i think the reason behind the unusual behavior of the tab control is that i set the location of the tab control on form's load event. let me tell you what i did i take a panel, place the tab control on that panel so that the panel become the parent of the tab control, now i set the auto scroll property of panel to true, set the dock property of panel to fill. this will zoom the tab control, the other control on each tab but the font size remains same. what else i can do to work it properly. i more thing i have one more tab control on the first tab page of the main tab control. the things goes complicated now with this second tab control. thanks in advance help everyone -- modified at 6:50 Wednesday 24th October, 2007

          A Offline
          A Offline
          Ajay k_Singh
          wrote on last edited by
          #4

          Font can be resized using code like this- cntrl.Font = New Font(cntrl.Font.Name, cntrl.Font.Size + cntrl.Font.Size * ZoomFactor / 100, cntrl.Font.Style, GraphicsUnit.Pixel) -Dave.

          Dave Traister, ComponentOne LLC. www.componentone.com

          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