This commit is contained in:
@@ -56,6 +56,7 @@ namespace AyaNovaQBI
|
||||
{
|
||||
Initialize();
|
||||
gridAya.ClearSelection();
|
||||
gridQB.ClearSelection();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -392,6 +393,171 @@ namespace AyaNovaQBI
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region Drag n drop
|
||||
public class QBNameID
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string ID { get; set; }
|
||||
}
|
||||
|
||||
List<QBNameID> SelectedQBItems = new List<QBNameID>();
|
||||
|
||||
public class AyaNameID
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public long ID { get; set; }
|
||||
}
|
||||
List<AyaNameID> SelectedAyaItems = new List<AyaNameID>();
|
||||
|
||||
|
||||
|
||||
private bool m_dragging = false;
|
||||
Rectangle dragBoxFromMouseDown;
|
||||
int rowIndexFromMouseDown;
|
||||
int rowIndexOfItemUnderMouseToDrop;
|
||||
|
||||
#region AyaGrid
|
||||
private void gridAya_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Left)
|
||||
return;
|
||||
|
||||
|
||||
//Only do this if the user is positioned over a row
|
||||
rowIndexFromMouseDown = gridAya.HitTest(e.X, e.Y).RowIndex;
|
||||
if ((rowIndexFromMouseDown != -1))
|
||||
{
|
||||
SelectedAyaItems.Clear();
|
||||
if (gridAya.SelectedRows.Count > 0 && !gridAya.SelectedRows[0].IsNewRow)
|
||||
{
|
||||
foreach (DataGridViewRow r in gridAya.SelectedRows)
|
||||
{
|
||||
SelectedAyaItems.Add(new AyaNameID { Name = (string)r.Cells[0].Value, ID = (long)r.Cells[1].Value });
|
||||
}
|
||||
//Size dragSize = SystemInformation.DragSize;
|
||||
//dragBoxFromMouseDown = new Rectangle(new Point(e.X - (dragSize.Width / 2), e.Y - (dragSize.Height / 2)), dragSize);
|
||||
m_dragging = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// dragBoxFromMouseDown = Rectangle.Empty;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void gridAya_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
m_dragging = false;
|
||||
}
|
||||
|
||||
private void gridAya_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left
|
||||
&& m_dragging
|
||||
&& SelectedAyaItems.Count > 0)
|
||||
{
|
||||
|
||||
gridAya.DoDragDrop(null, DragDropEffects.Link);
|
||||
}
|
||||
|
||||
//if (((e.Button == MouseButtons.Left)))
|
||||
//{
|
||||
// if (((dragBoxFromMouseDown != Rectangle.Empty)
|
||||
// && !dragBoxFromMouseDown.Contains(e.X, e.Y)))
|
||||
// {
|
||||
// DragDropEffects dropEffect = gridAya.DoDragDrop(gridAya.Rows[rowIndexFromMouseDown], DragDropEffects.Move);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
private void gridAya_DragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
// e.Effect = DragDropEffects.Move;
|
||||
}
|
||||
|
||||
private void gridAya_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (SelectedQBItems.Count > 0)
|
||||
{
|
||||
|
||||
e.Effect = DragDropEffects.Link;
|
||||
}
|
||||
else
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void gridAya_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
MessageBox.Show("STUB: aya drop data happened");
|
||||
//Point clientPoint = gridAya.PointToClient(new Point(e.X, e.Y));
|
||||
//rowIndexOfItemUnderMouseToDrop = gridAya.HitTest(clientPoint.X, clientPoint.Y).RowIndex;
|
||||
//if ((e.Effect == DragDropEffects.Move))
|
||||
//{
|
||||
// DataGridViewRow rowToMove = (DataGridViewRow)e.Data.GetData(typeof(DataGridViewRow));
|
||||
// object[] celldata = new object[gridAya.ColumnCount];
|
||||
// for (int col = 0; (col
|
||||
// <= (rowToMove.Cells.Count - 1)); col++)
|
||||
// {
|
||||
// celldata[col] = rowToMove.Cells[col].Value;
|
||||
// }
|
||||
|
||||
// //DataRow row = bsPeople.NewRow();
|
||||
// //row.ItemArray = celldata;
|
||||
// //bsPeople.Rows.InsertAt(row, rowIndexOfItemUnderMouseToDrop);
|
||||
// //rowToMove.DataGridView.Rows.Remove(rowToMove);
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
private void gridAya_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion ayagrid
|
||||
|
||||
#region QBGrid
|
||||
|
||||
private void gridQB_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void gridQB_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void gridQB_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void gridQB_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void gridQB_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void gridQB_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion qbgrid
|
||||
|
||||
|
||||
#endregion drag and drop
|
||||
|
||||
/*
|
||||
* Simplified, no drag and drop just pick and choose with clicks
|
||||
* A menu to select the ayanova object type which then populates the ayanova items grid of that type showing:
|
||||
|
||||
Reference in New Issue
Block a user