Hiding a ColumnHeader...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alan Seunarayan

    Hiding a ColumnHeader...

    Hello,
    I have a number of ColumnHeaders that are 'hidden' (width
    set to zero). However, it is still possible to size
    them. The reason why they are hidden is to give the
    illusion that they do not exist. Is there a way to stop
    the user from being able to resize column headers that I
    have set their width to zero?

    Many thanks,

    Alan
  • Roy Osherove

    #2
    Re: Hiding a ColumnHeader...

    The only way to make the cols disappear completely is to make the
    underlying data columns invisible. If I'm not mistaken, there's a
    "visible" property on a DAtaCOlumn object.
    Set this to false and your problem is solved.

    ---
    Regards,

    Roy Osherove


    On Fri, 7 Nov 2003 08:48:36 -0800, "Alan Seunarayan"
    <soonaz@ntlw0rl d.c0m> wrote:
    [color=blue]
    >Hello,
    > I have a number of ColumnHeaders that are 'hidden' (width
    >set to zero). However, it is still possible to size
    >them. The reason why they are hidden is to give the
    >illusion that they do not exist. Is there a way to stop
    >the user from being able to resize column headers that I
    >have set their width to zero?
    >
    >Many thanks,
    >
    >Alan[/color]

    Comment

    • Guest's Avatar

      #3
      Re: Hiding a ColumnHeader...

      Sorry,
      I am actually using a ListView control.

      Alan
      [color=blue]
      >-----Original Message-----
      >The only way to make the cols disappear completely is to[/color]
      make the[color=blue]
      >underlying data columns invisible. If I'm not mistaken,[/color]
      there's a[color=blue]
      >"visible" property on a DAtaCOlumn object.
      >Set this to false and your problem is solved.
      >
      >---
      >Regards,
      >
      >Roy Osherove
      >www.iserializable.com
      >
      >On Fri, 7 Nov 2003 08:48:36 -0800, "Alan Seunarayan"
      ><soonaz@ntlw0r ld.c0m> wrote:
      >[color=green]
      >>Hello,
      >> I have a number of ColumnHeaders that are 'hidden'[/color][/color]
      (width[color=blue][color=green]
      >>set to zero). However, it is still possible to size
      >>them. The reason why they are hidden is to give the
      >>illusion that they do not exist. Is there a way to stop
      >>the user from being able to resize column headers that I
      >>have set their width to zero?
      >>
      >>Many thanks,
      >>
      >>Alan[/color]
      >
      >.
      >[/color]

      Comment

      • Roy Osherove

        #4
        Re: Hiding a ColumnHeader...

        On Sun, 9 Nov 2003 13:55:36 -0800, <soonaz@ntlworl d.com> wrote:
        [color=blue]
        > Sorry,
        > I am actually using a ListView control.
        >
        > Alan
        >[color=green]
        >> [2 quoted lines suppressed][/color]
        > make the[color=green]
        >> [1 quoted line suppressed][/color]
        > there's a[color=green]
        >> [14 quoted lines suppressed][/color]
        > (width[color=green]
        >> [12 quoted lines suppressed][/color][/color]

        Hmm. IN that case I don't think there's a way
        --
        Roy Osherove
        weblog: http://www.iserializable.com

        Comment

        • Eric-Paul

          #5
          Re: Hiding a ColumnHeader...

          Well there is a way and it is quite simple.

          The columns are stored in the ListView.Column s collection, so you can remove
          and add columns as you like.
          Only those in the collection will be shown.

          E.g.
          System.Windows. Forms.ColumnHea der headerToShowHid e = new
          System.Windows. Forms.ColumnHea der();

          private void ToggleColumn()
          {
          if (this.myListVie w.Columns.Conta ins(headerToSho wHide))
          {
          this.myListView .Columns.Remove (headerToShowHi de);
          headerToShowHid e.Text = "Now I am hidden";
          }
          else
          {
          headerToShowHid e.Text = "See me now?";
          this.myListView .Columns.Insert (1, headerToShowHid e);
          }
          }

          Just remove it when you want to hide it.
          Insert it at the desired position and you see it again.

          Eric-Paul Jansen
          Inforay International B.V. (http://www.inforay.com)
          The Netherlands

          "Roy Osherove" <royo@iserializ able.com> wrote in message
          news:1d8ccegtun f1n.1t780s5jcy6 xt$.dlg@40tude. net...[color=blue]
          > On Sun, 9 Nov 2003 13:55:36 -0800, <soonaz@ntlworl d.com> wrote:
          >[color=green]
          > > Sorry,
          > > I am actually using a ListView control.
          > >
          > > Alan
          > >[color=darkred]
          > >> [2 quoted lines suppressed][/color]
          > > make the[color=darkred]
          > >> [1 quoted line suppressed][/color]
          > > there's a[color=darkred]
          > >> [14 quoted lines suppressed][/color]
          > > (width[color=darkred]
          > >> [12 quoted lines suppressed][/color][/color]
          >
          > Hmm. IN that case I don't think there's a way
          > --
          > Roy Osherove
          > weblog: http://www.iserializable.com[/color]


          Comment

          Working...