BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
//in formload, subscribe to the events this.gridDataBoundGrid1.MouseDown += new MouseEventHandler(grid_MouseDown); this.gridDataBoundGrid1.MouseMove += new MouseEventHandler(grid_MouseMove); this.gridDataBoundGrid1.MouseUp += new MouseEventHandler(grid_MouseUp); //the handlers private Point mouseDownPoint = Point.Empty; private int mouseDownRow = -1; private int mouseDownCol = -1; private void grid_MouseDown(object sender, MouseEventArgs e) { Point pt = new Point(e.X, e.Y); int rowIndex, colIndex; if(this.gridDataBoundGrid1.PointToRowCol(pt, out rowIndex, out colIndex, -1)) { //check for photo column mousedown if(this.gridDataBoundGrid1[0, colIndex].Text == "Photo" && rowIndex > 0) { mouseDownPoint = new Point(e.X, e.Y); mouseDownRow = rowIndex; mouseDownCol = colIndex; } else { mouseDownPoint = Point.Empty; mouseDownRow = -1; mouseDownCol = -1; } } } private void grid_MouseMove(object sender, MouseEventArgs e) { //check if dragging... if(mouseDownPoint != Point.Empty) { if(Math.Abs(mouseDownPoint.X - e.X) + Math.Abs(mouseDownPoint.Y - e.Y) > 8) { //get the bitmap however??? Byte[] pict = this.gridDataBoundGrid1[mouseDownRow, mouseDownCol].CellValue as Byte[]; if(pict != null) { int PictOffSet = 78; MemoryStream buffer = new MemoryStream(pict, PictOffSet, pict.Length - PictOffSet); Bitmap image = (Bitmap)Bitmap.FromStream(buffer, true); this.DoDragDrop(image, DragDropEffects.All); } mouseDownPoint = Point.Empty; mouseDownRow = -1; mouseDownCol = -1; } } } private void grid_MouseUp(object sender, MouseEventArgs e) { mouseDownPoint = Point.Empty; mouseDownRow = -1; mouseDownCol = -1; }