/// ------------------------------------------------------------------------------------ /// <summary> /// Called when the user clicks on an item /// </summary> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ protected override void OnClick(EventArgs e) { base.OnClick(e); #if !__MonoCS__ TV_HITTESTINFO hitTestInfo = new TV_HITTESTINFO(); hitTestInfo.pt = PointToClient(Control.MousePosition); SendMessage(Handle, TreeViewMessages.TVM_HITTEST, 0, ref hitTestInfo); if ((hitTestInfo.flags & TVHit.OnItemIcon) == TVHit.OnItemIcon) { TreeNode node = GetNodeAt(hitTestInfo.pt); if (node != null) { ChangeNodeState(node); } } #else // The SendMessage determines whether we've hit the node proper or the // +/- box to expand or collapse. We'll try to check this by looking // at the X location ourselves. (See FWNX-468.) Point pt = PointToClient(Control.MousePosition); TreeNode node = GetNodeAt(pt); // This uses only the Y location. if (node != null) { var bounds = node.Bounds; // This gives the text area of the node. if (pt.X >= bounds.X - 20 && pt.X < bounds.X) { ChangeNodeState(node); } } #endif }
protected override void OnClick(EventArgs e) { base.OnClick(e); TV_HITTESTINFO lParam = new TV_HITTESTINFO { pt = base.PointToClient(Control.MousePosition) }; SendMessage(base.Handle, TreeViewMessages.TVM_HITTEST, 0, ref lParam); if ((lParam.flags & TVHit.OnItemIcon) == TVHit.OnItemIcon) { TreeNode nodeAt = base.GetNodeAt(lParam.pt); if (nodeAt != null) { this.ChangeNodeState(nodeAt); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Called when the user clicks on an item /// </summary> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ protected override void OnClick(EventArgs e) { base.OnClick(e); TV_HITTESTINFO hitTestInfo = new TV_HITTESTINFO(); hitTestInfo.pt = PointToClient(Control.MousePosition); SendMessage(Handle, TreeViewMessages.TVM_HITTEST, 0, ref hitTestInfo); if ((hitTestInfo.flags & TVHit.OnItemIcon) == TVHit.OnItemIcon) { TreeNode node = GetNodeAt(hitTestInfo.pt); if (node != null) { ChangeNodeState(node); } } }
public static extern int SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TV_HITTESTINFO lParam);
/// ------------------------------------------------------------------------------------ /// <summary> /// Called when the user clicks on an item /// </summary> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ protected override void OnClick(EventArgs e) { base.OnClick (e); #if !__MonoCS__ TV_HITTESTINFO hitTestInfo = new TV_HITTESTINFO(); hitTestInfo.pt = PointToClient(Control.MousePosition); SendMessage(Handle, TreeViewMessages.TVM_HITTEST, 0, ref hitTestInfo); if ((hitTestInfo.flags & TVHit.OnItemIcon) == TVHit.OnItemIcon) { TreeNode node = GetNodeAt(hitTestInfo.pt); if (node != null) ChangeNodeState(node); } #else // The SendMessage determines whether we've hit the node proper or the // +/- box to expand or collapse. We'll try to check this by looking // at the X location ourselves. (See FWNX-468.) Point pt = PointToClient(Control.MousePosition); TreeNode node = GetNodeAt(pt); // This uses only the Y location. if (node != null) { var bounds = node.Bounds; // This gives the text area of the node. if (pt.X >= bounds.X - 20 && pt.X < bounds.X) ChangeNodeState(node); } #endif }
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, [In][Out] TV_HITTESTINFO lParam);
/// ------------------------------------------------------------------------------------ /// <summary> /// Called when the user clicks on an item /// </summary> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ protected override void OnClick(EventArgs e) { base.OnClick (e); TV_HITTESTINFO hitTestInfo = new TV_HITTESTINFO(); hitTestInfo.pt = PointToClient(Control.MousePosition); SendMessage(Handle, TreeViewMessages.TVM_HITTEST, 0, ref hitTestInfo); if ((hitTestInfo.flags & TVHit.OnItemIcon) == TVHit.OnItemIcon) { TreeNode node = GetNodeAt(hitTestInfo.pt); if (node != null) ChangeNodeState(node); } }
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, TV_HITTESTINFO lParam);
/// ------------------------------------------------------------------------------------ /// <summary> /// Called when the user clicks on an item /// </summary> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ protected override void OnClick(EventArgs e) { base.OnClick(e); TV_HITTESTINFO hitTestInfo = new TV_HITTESTINFO(); hitTestInfo.pt = PointToClient(Control.MousePosition); SendMessage(Handle, TreeViewMessages.TVM_HITTEST, 0, ref hitTestInfo); if ((hitTestInfo.flags & TVHit.OnItemIcon) == TVHit.OnItemIcon) { TreeNode node = GetNodeAt(hitTestInfo.pt); if (node != null && rootFeature.Items != null && CheckIfNodeIsChangeable(node)) { foreach (object o in this.rootFeature.Items) { string fullpathname = rootFeature.name; if (o.GetType() == typeof(FeatureType)) { fullpathname = string.Format("{0}\\{1}", fullpathname, ((FeatureType)o).name); if (fullpathname == node.FullPath) { if (node.ImageIndex == (int)CheckState.Unchecked) { ((FeatureType)o).configuration = ConfigType.Unspecified; } else if (node.ImageIndex == (int)CheckState.Checked) { ((FeatureType)o).configuration = ConfigType.Excluded; UnSelectChildNodesInObjectModelRecursive((FeatureType)o); UnSelectChildNodesInTreeViewRecursive(node); } else if (node.ImageIndex == (int)CheckState.QuestionMark) { ((FeatureType)o).configuration = ConfigType.Included; } else { ((FeatureType)o).configuration = ConfigType.Excluded; } break; } else { if (((FeatureType)o).Items != null) { if (((FeatureType)o).Items.Length > 0) { GetSubFeaturesOfObjectModelRecursive(o, fullpathname, node); } } } } else if (o.GetType() == typeof(FeatureSetType)) { fullpathname = string.Format("{0}\\FeatureSet [{1}...{2}]", fullpathname, ((FeatureSetType)o).min, ((FeatureSetType)o).max); if (((FeatureSetType)o).Feature.Length > 0) { GetSubFeaturesOfObjectModelRecursive(o, fullpathname, node); } } } ChangeNodeState(node); } } ArrayList errorArray = featureModel.CheckConfiguredModel(); string[] array = (string[])errorArray.ToArray(typeof(string)); //this.statusTextBox.Lines = array; }