Exemplo n.º 1
0
        private void InternalSetTriState(TriState state)
        {
            ThreeStateTreeView treeView = base.TreeView as ThreeStateTreeView;

            if (treeView != null)
            {
                WinFormsUI.Controls.NativeMethods.TVITEM lParam = new WinFormsUI.Controls.NativeMethods.TVITEM {
                    mask      = 24,
                    hItem     = base.Handle,
                    stateMask = 61440
                };
                switch (state)
                {
                case TriState.Unchecked:
                    lParam.state |= 4096;
                    break;

                case TriState.Checked:
                    lParam.state |= 8192;
                    break;

                case TriState.Indeterminate:
                    lParam.state |= 12288;
                    break;

                default:
                    throw new ArgumentOutOfRangeException("state");
                }
                WinFormsUI.Controls.NativeMethods.SendMessage(new HandleRef(base.TreeView, base.TreeView.Handle), 4365, 0, ref lParam);
                treeView.TreeViewAfterTriStateUpdate(this);
            }
        }
Exemplo n.º 2
0
        public void SetNodeText(string sNodeText)
        {
            ThreeStateTreeView treeView = base.TreeView as ThreeStateTreeView;

            if (treeView != null)
            {
                WinFormsUI.Controls.NativeMethods.TVITEM lParam = new WinFormsUI.Controls.NativeMethods.TVITEM {
                    mask    = 17,
                    hItem   = base.Handle,
                    pszText = Marshal.StringToHGlobalAnsi(sNodeText)
                };
                WinFormsUI.Controls.NativeMethods.SendMessage(new HandleRef(base.TreeView, base.TreeView.Handle), 4365, 0, ref lParam);
                treeView.TreeViewAfterTriStateUpdate(this);
            }
        }
Exemplo n.º 3
0
        private void InternalSetTriState(TriState state)
        {
            ThreeStateTreeView treeView = base.TreeView as ThreeStateTreeView;
            if (treeView != null)
            {
                WinFormsUI.Controls.NativeMethods.TVITEM lParam = new WinFormsUI.Controls.NativeMethods.TVITEM {
                    mask = 24,
                    hItem = base.Handle,
                    stateMask = 61440
                };
                switch (state)
                {
                    case TriState.Unchecked:
                        lParam.state |= 4096;
                        break;

                    case TriState.Checked:
                        lParam.state |= 8192;
                        break;

                    case TriState.Indeterminate:
                        lParam.state |= 12288;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException("state");
                }
                WinFormsUI.Controls.NativeMethods.SendMessage(new HandleRef(base.TreeView, base.TreeView.Handle), 4365, 0, ref lParam);
                treeView.TreeViewAfterTriStateUpdate(this);
            }
        }
Exemplo n.º 4
0
 public void SetNodeText(string sNodeText)
 {
     ThreeStateTreeView treeView = base.TreeView as ThreeStateTreeView;
     if (treeView != null)
     {
         WinFormsUI.Controls.NativeMethods.TVITEM lParam = new WinFormsUI.Controls.NativeMethods.TVITEM {
             mask = 17,
             hItem = base.Handle,
             pszText = Marshal.StringToHGlobalAnsi(sNodeText)
         };
         WinFormsUI.Controls.NativeMethods.SendMessage(new HandleRef(base.TreeView, base.TreeView.Handle), 4365, 0, ref lParam);
         treeView.TreeViewAfterTriStateUpdate(this);
     }
 }