当前位置: 首页>>代码示例>>C#>>正文


C# IntPtr.DefSubclassProc方法代码示例

本文整理汇总了C#中System.IntPtr.DefSubclassProc方法的典型用法代码示例。如果您正苦于以下问题:C# IntPtr.DefSubclassProc方法的具体用法?C# IntPtr.DefSubclassProc怎么用?C# IntPtr.DefSubclassProc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IntPtr的用法示例。


在下文中一共展示了IntPtr.DefSubclassProc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: switch

    private int OpenFileSubClass
    (
        IntPtr hWnd,
        uint uMsg,
        IntPtr wParam,
        IntPtr lParam,
        IntPtr uIdSubclass,
        uint dwRefData
    )
    {
      switch (uMsg)
      {
        case InteropUtil.WM_PARENTNOTIFY:
          {
            unchecked
            {
              var id = lParam.GetDlgCtrlID();

              if (LOW((uint)wParam) == InteropUtil.WM_CREATE && (id == InteropUtil.ID_FileList || id == 0))
              {
                lParam.SetWindowSubclass(m_defViewSubClassDelegate, 0, 0);
              }
            }
            break;
          }
      }
      return hWnd.DefSubclassProc(uMsg, wParam, lParam);
    }
开发者ID:cornelius90,项目名称:InnovatorAdmin,代码行数:28,代码来源:OpenFileOrFolderDialog.cs

示例2: typeof

    private int DefViewSubClass
    (
        IntPtr hWnd,
        uint uMsg,
        IntPtr wParam,
        IntPtr lParam,
        IntPtr uIdSubclass,
        uint dwRefData
    )
    {
      if (uMsg == InteropUtil.WM_NOTIFY)
      {
        var header = (InteropUtil.NMHDR)Marshal.PtrToStructure(lParam, typeof(InteropUtil.NMHDR));
        if (header.code == InteropUtil.LVN_ITEMCHANGED && header.hwndFrom != IntPtr.Zero && header.idFrom == 1)
        {
          var nmListView = (InteropUtil.NMLISTVIEW)Marshal.PtrToStructure(lParam, typeof(InteropUtil.NMLISTVIEW));
          var oldSelected = (nmListView.uOldState & InteropUtil.LVIS_SELECTED) != 0;
          var newSelected = (nmListView.uNewState & InteropUtil.LVIS_SELECTED) != 0;
          if (!oldSelected && newSelected)
          {
            if (!m_suppressSelectionChange)
            {
              //the item went from not selected to being selected    
              //so we want to look and see if the selected item is a folder, and if so
              //change the text of the item box to be the item on the folder. But, before we do that
              //we want to make sure that the box isn't currently focused.
              var hParent = hWnd.GetParent();
              var hFNCombo = hParent.GetDlgItem(InteropUtil.ID_FileNameCombo);
              var hFNEditBox = hParent.GetDlgItem(InteropUtil.ID_FileNameTextBox);
              var hFocus = InteropUtil.GetFocus();

              if
              (
                  (hFNCombo == IntPtr.Zero || hFNCombo != hFocus) &&
                  (hFNEditBox == IntPtr.Zero || hFNEditBox != hFocus)
              )
              {
                SetFileNameToSelectedItem(header.hwndFrom, hFNCombo, nmListView.iItem);
              }
            }
            m_suppressSelectionChange = false;
          }
        }
      }
      return hWnd.DefSubclassProc(uMsg, wParam, lParam);
    }
开发者ID:cornelius90,项目名称:InnovatorAdmin,代码行数:46,代码来源:OpenFileOrFolderDialog.cs


注:本文中的System.IntPtr.DefSubclassProc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。