0
부모 노드의 체크 박스를 숨기고 자식 노드 만 남겨둔 채 잘라낸 것으로 표시되기 때문에 확인란이있는 TreeView
과 함께 도움이 필요합니다. 트 리뷰는 다음과 같습니다TreeView 체크 박스가 올바르게 표시되지 않습니다.
private const int TVIF_STATE = 0x8;
private const int TVIS_STATEIMAGEMASK = 0xF000;
private const int TV_FIRST = 0x1100;
private const int TVM_SETITEM = TV_FIRST + 63;
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Auto)]
private struct TVITEM
{
public int mask;
public IntPtr hItem;
public int state;
public int stateMask;
[MarshalAs(UnmanagedType.LPTStr)]
public string lpszText;
public int cchTextMax;
public int iImage;
public int iSelectedImage;
public int cChildren;
public IntPtr lParam;
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, ref TVITEM lParam);
/// <summary>
/// Hides the checkbox for the specified node on a TreeView control.
/// </summary>
private void HideCheckBox(TreeView tvw, TreeNode node)
{
TVITEM tvi = new TVITEM();
tvi.hItem = node.Handle;
tvi.mask = TVIF_STATE;
tvi.stateMask = TVIS_STATEIMAGEMASK;
tvi.state = 0;
SendMessage(tvw.Handle, TVM_SETITEM, IntPtr.Zero, ref tvi);
}
void sharedFolders_DrawNode(object sender, DrawTreeNodeEventArgs e)
{
if (e.Node.Level == 1 || e.Node.Level == 0)
HideCheckBox(sharedFolders, e.Node);
e.DrawDefault = true;
}
이 사람이 날 전체 체크 박스를 표시 도울 수 : 이
내가 부모 노드의 체크 박스를 숨기기 위해 사용하고 코드이 무엇입니까?
대단히 감사합니다! 그 트릭을 :) – chrisszz