the following code works well. can drag item listview , drop cell.
private void treeview1_mousemove(object sender, mouseeventargs e) { if (e.button == mousebuttons.left) { if (treeview1.selectednode != null) { treeview1.dodragdrop(dragdata.tostring(), dragdropeffects.copy); } } } my question whether possible can change dragdropeffects, according cell drop.
for example, not allowed drop item cell[a1], hope dragdropeffects can 'none' , including mouse style should disallowed mark when mouse on cell[a1].
hope can find place write following codes.
private void mouse_on(excel.range targetrange){ if(targetrange.address == "a1"){ dragdropeffects.none; }else{ dragdropeffects.copy; } }
vsto (nor excel) doesn't provide that.
you may try use locked property of range class indicates if object locked. property returns true if object locked, false if object can modified when sheet protected, or null if specified range contains both locked , unlocked cells.
the protect method protects worksheet cannot modified.
so, can protect worksheet , set locked property false area can drop data. hope helps.
Comments
Post a Comment