private void MENU_LISTESI() { using (SqlConnection conn = new SqlConnection(_GLOBAL_PARAMETERS._CONNECTIONSTRING_MDB.ToString())) { DataSet ds = new DataSet(); string query = " SELECT ID ,PARENTID, BASLIK, SUB_IDX,NAME,GUI FROM dbo.ADM_MENU order by PARENTID,SUB_IDX "; SqlDataAdapter adapter = new SqlDataAdapter() { SelectCommand = new SqlCommand(query, conn) }; adapter.Fill(ds, "ADM_MENU"); DataViewManager dvManager = new DataViewManager(ds); DataView dvLIST_KIRILIMLAR = dvManager.CreateDataView(ds.Tables[0]); TreeView_Sabitler.BeginUpdate(); TreeView_Sabitler.Nodes.Clear(); PopulateTreeView(TreeView_Sabitler.Nodes, 0, ds.Tables[0]); TreeView_Sabitler.Select(); TreeView_Sabitler.EndUpdate(); } TreeView_Sabitler.ExpandAll(); }
private void TreeView_Sabitler_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = TreeView_Sabitler.PointToClient(new Point(e.X, e.Y)); TreeNode hedefDugum = TreeView_Sabitler.GetNodeAt(pt); TreeNode yeniDugum = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); if (hedefDugum != null) { if (!hedefDugum.Equals(yeniDugum)) { //Taşınan TreeNode kontrolü yeni yerine ekleniyor. hedefDugum.Nodes.Add((TreeNode)yeniDugum.Clone()); hedefDugum.Expand(); //Taşınan TreeNode kontrolü eski yerinden siliniyor. yeniDugum.Remove(); } } KIRILIMLI_RAPOR_SAVE_UPDATA(TreeView_Sabitler); } }