Hello long time reader first time poster. (Long time VB6 user newb at C#)

I wish to hold the mouse down and slide over cells in a data view control. As the mouse if moved from cell to cell a tool tip is displayed. (The info will be pulled off a server during the mousedown/mousemove event. I don't want the info stored within the cells tool tip)


My question:
During a CellMouseMove or a CellMouseEnter event is there an easy way (built in functionality) to figure out whether a mouse button is up or down? ... Or do you need to create a variable at the form scope and trap the state during a mousedown/mouseup event?

Thanks in advance..
Tom

I have not used DataGrid (is that sane as DataGridView ?) for decades.
I use the free SGrid2
It has a Button parameter/argument, in the _MouseMove event.
If your's is similar, you could test for -
if button = vbLeftButton
within the _MouseMove event.

If that does not work for you, there are API's that can be called to tell the state of the Mouse Buttons.
HTH,
Rob

I sort of got what I was looking for by doing this:

private void DataGrid1_MouseDown(object sender, MouseEventArgs e)
        {
            isgridmousedown =true;
        }

        private void DataGrid1_MouseUp(object sender, MouseEventArgs e)
        {
             isgridmousedown =false;
        }

        private void DataGrid1_CellEnter(object sender, DataGridViewCellEventArgs e)
        {

            if (isgridmousedown == true)
            {
                Rectangle rec = DataGrid1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);
                Point p = rec.Location;
                p.Offset(0, -(20));

                //tooltip1.Show(DataGrid1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), panel1,p, 1000);
                tooltip1.Show("Insert what you want to show up here", panel1, p, 1000);
            }
            else
                tooltip1.Hide(panel1);

        }

The thing that has me befuddled at the moment is why this should only work with the left mouse button.... At first glance it seems that it should work any mouse click.

OOPs,
Thought this was a VB6 thread.
Ignore my ramblings above, and I will bow out.
Rob

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.