We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to identify if a column is partially visible...

Thread ID:

Created:

Updated:

Platform:

Replies:

117586 Nov 12,2014 10:20 AM UTC Nov 26,2014 06:34 PM UTC Windows Forms 5
loading
Tags: GridControl
Deepu A M
Asked On November 12, 2014 10:20 AM UTC

Hi,

I am using a GridControl, which has several columns. At any point of time, all columns are not visible to the user. User needs to scroll to see the hidden columns.

How do i find if a particular column is partially hidden on mouse hover ? 

regards,
Deepu 


Muthukumar Kalyanasundaram [Syncfusion]
Replied On November 15, 2014 01:54 PM UTC

Hi Deepu,

 

If you want to identify the partial column is visible or not in a grid, you can use “HasPartialVisibleCols” property. Please refer the below code,

 

Code:

 

if (e.Index > this.gridControl1.ColCount-1)

  {

    if (gridControl1.ViewLayout.HasPartialVisibleCols)

     {

int viewLayout = this.gridControl1.ViewLayout.VisibleCols + (gridControl1.ViewLayout.HasPartialVisibleCols ? -1 : 0); // visible column count

MessageBox.Show("Partial Visible Column");

    }

   else

    {

      MessageBox.Show("Visible Column");

    }

}

 

Please let us know if I misunderstood you query.

 

Regards,

Muthukumar K


Deepu A M
Replied On November 17, 2014 06:28 AM UTC

Hi Muthukumar, 

Thank you for your reply. 

But i think i was not clear enough regarding my query. 

In my application, there are a few partially hidden columns. it could on the right side (normally) or on the left side (if we have scrolled to the right). 
When a column is partially hidden, i need to show its content as tool tip.

So in order to show the tool tip i need to know if the column on which i am hovering is partially hidden or not. 

The code you gave me will only tell me if there are any partially hidden columns in the grid, but what i need to know is if the column on which i am hovering currently is partially hidden or not.


Thank You, 
Deepu A M

Muthukumar Kalyanasundaram [Syncfusion]
Replied On November 18, 2014 12:21 PM UTC

Hi Deepu,

 

Thanks for the update.

 

If you want to show the tooltip in a grid which is partially visible column or not, you can use “QueryCellInfo” event. Please refer the below code,

 

Code:

void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

        {

            if (flag)

            {               

                if (e.ColIndex < viewLayout && e.RowIndex > 0)

                {

                    toolTip = this.gridControl1.ColStyles[viewLayout].CellValue.ToString();

                    e.Style.CellTipText = "visible";                  

                }

                else

                {                   

                     e.Style.CellTipText = "Partially visible";

                }              

            }

        }

 

void Model_QueryColWidth(object sender, Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs e)

        {       

            if (e.Index > this.gridControl1.ColCount-1)

            {

                if (gridControl1.ViewLayout.HasPartialVisibleCols)

                {

                    viewLayout = this.gridControl1.ViewLayout.LastVisibleCol;                

                  

                }

                e.Handled = true;

            }

        }

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: GC__VIsibleColumn_57e71de3.zip

Deepu A M
Replied On November 24, 2014 04:55 AM UTC

Hi Muthu,

I am still not able to resolve the issue. 

As you can see in the attached image, I have two panels on both sides and the grid control in between. 
The grid has 4 columns - name, age, address and phone number.

The name column and the address column are partially hideen (name to the left and address to the right).
the phone number column is completely hidden. 

Now i want a tool tip to appear when the mouse hovers over the first name column and the address column.
But no tool tip on age, as it is fully visible. 

Attachment: my_application_with_grid_control_d08cb204.zip

Muthukumar Kalyanasundaram [Syncfusion]
Replied On November 26, 2014 06:34 PM UTC

Hi Deepu,

 

If you want to show the tooltip text  when you hover the partially hidden column, you can use the “CellMouseHoverEnter” event and “QueryCellInfo” event . By using CellMouseHoverEnter event, you can set the “HasPartialVisibleCols” property to identify the partial hidden column in a grid. Please refer the below code and attached sample.

 

Code:

 

tooltip1.InitialDelay = 100000;

this.gridControl1.QueryCellInfo += new GridQueryCellInfoEventHandler(gridControl1_QueryCellInfo);

this.gridControl1.CellMouseHoverEnter += new GridCellMouseEventHandler(gridControl1_CellMouseHoverEnter);

 

string cellValue; 

bool flag = false;

int viewLayout;

 

void gridControl1_CellMouseHoverEnter(object sender, GridCellMouseEventArgs e)

  {           

     if (gridControl1.ViewLayout.HasPartialVisibleCols)

        {

          viewLayout = this.gridControl1.ViewLayout.LastVisibleCol;

          flag = true;

        }

     else

        {

          // MessageBox.Show("Visible Column");

         }           

  }

 

void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

   {

    if (flag)

      {               

        if (e.ColIndex == viewLayout && e.RowIndex > 0)

          {

              cellValue = this.gridControl1.ColStyles[viewLayout].CellValue.ToString();

              e.Style.CellTipText = "Partially visible" + tooltip1.InitialDelay;                

          }

        else

          {

              e.Style.CellTipText = string.Empty;

          }              

      }

   }

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: GC__HiddenColumn_d0f46bae.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;