Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ex: I have a series of PictureBoxes (10 rows x 6 columns) internal to a panel, I do not use datagrdiview.

I have to understand when the PicureBox I drag arrives at row 6, to increase the VertScrollBar.Value, to display the next line

with MouseHover and MouseMove I can get to know the potion of each PictureBox, I have to 

during Drag&Drop does not trigger the MouseMove event.

There is no DragMove event


What I have tried:

pictBox[i].MouseHover += new EventHandler(picHover_Click);
                pictBox[i].MouseLeave += new EventHandler(picLeave_Click);
                pictBox[i].MouseDown += picture_MouseDown;
                pictBox[i].MouseMove += picture_MouseMove;
                pictBox[i].AllowDrop = true;


private void picture_MouseMove(object sender, MouseEventArgs e)
        {
            lblMesg.Visible = true;
            lblMesg.Text = pnlCatalogo.VerticalScroll.Value.ToString() + " - " + ThumbActive.ToString();
        }
Posted
Updated 28-Nov-20 21:56pm
Comments
BillWoodruff 28-Nov-20 23:55pm    
WinForms ?

Since a Panel has no row/column/grid structure, you need to explain what those terms mean.

Is this question about design-time drag-drop ? If it is about run-time drag-drop, then: where does the PictureBox you drag come FROM ... you create a new one in code ?

Is it possible all you really want to do is MOVE the PictureBox, and make it "snap" to some location ?
Member 13174280 29-Nov-20 3:52am    
just know the position of the cursor while dragging.
I am trying the solution by dragleave event

Put a transparent panel over your 10 x 6 picture boxes, and wire up your events to that. Convert the mouse coordinates to a "row and column" (math).
 
Share this answer
 
This a possible solution

//Yposition = mouse position to verify

private void pict_DragLeave(object sender, EventArgs e)
{
  if (Control.MousePosition.Y > Yposition)
  {
     pnlCatalogo.VerticalScroll.Value = pnlCatalogo.VerticalScroll.Value + 200;
  }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900