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 string GetSelectedCarValue(string sGetType, ThreeStateTreeView tvThreeState)
        {
            string sCarValues = "";
            foreach (ThreeStateTreeNode node in tvThreeState.SelectedNodes)
            {
                TreeNode item = node;
                bool flag = false;
                while (item.Parent != null)
                {
                    item = item.Parent;
                    if (tvThreeState.SelectedNodes.Contains(item))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    continue;
                }
                if (!node.Tag.Equals("CAR"))
                {
                    this.GetChildValue(sGetType, node, ref sCarValues);
                    continue;
                }
                string str2 = "";
                string str3 = sGetType;
                if (str3 != null)
                {
                    if (!(str3 == "CarNum"))
                    {
                        if (str3 == "CarId")
                        {
                            str2 = node.CarId + ",";
                        }
                        if (str3 == "SimNum")
                        {
                            str2 = node.SimNum + ",";
                        }
                    }
                    else
                    {
                        str2 = node.CarNum + ",";
                    }
                }
                sCarValues = sCarValues + str2;
                continue;

            }
            return sCarValues.Trim(new char[] { ',' });
        }