コード例 #1
0
        // Fill out the SOFTKEYNOTIFY structure to create the notification soft key type specified
        // within 'data'.
        private void ConfigureSoftKey(ref SOFTKEYNOTIFY softKey, NotificationSoftKey data, uint index)
        {
            if (data != null)
            {
                softKey.pszTitle     = String.IsNullOrEmpty(data.Title) ? " " : data.Title;
                softKey.skc.grfFlags = (uint)data.Type;
            }
            else
            {
                // NULL means an "empty" soft key, the best way
                // to simulate this is to make a soft key which has
                // a blank title (does not render any text) and
                // is disabled (so it doesn't respond to stylus
                // taps).
                softKey.pszTitle     = " ";
                softKey.skc.grfFlags = (uint)SoftKeyType.Disabled;
            }

            // Each softkey must have a unique id for use with WM_COMMAND
            // so fudge the notification id and softkey index into a unique
            // id which we can easily reverse back into it's components.
            softKey.skc.wpCmd = (uint)(m_data.dwID << 8) + index;
        }
コード例 #2
0
    // Fill out the SOFTKEYNOTIFY structure to create the notification soft key type specified
    // within 'data'.
    private void ConfigureSoftKey(ref SOFTKEYNOTIFY softKey, NotificationSoftKey data, uint index)
    {
      if (data != null)
      {
        softKey.pszTitle = String.IsNullOrEmpty(data.Title) ? " " : data.Title;
        softKey.skc.grfFlags = (uint)data.Type;
      }
      else
      {
        // NULL means an "empty" soft key, the best way
        // to simulate this is to make a soft key which has
        // a blank title (does not render any text) and
        // is disabled (so it doesn't respond to stylus
        // taps).
        softKey.pszTitle = " ";
        softKey.skc.grfFlags = (uint)SoftKeyType.Disabled;
      }

      // Each softkey must have a unique id for use with WM_COMMAND
      // so fudge the notification id and softkey index into a unique
      // id which we can easily reverse back into it's components.
      softKey.skc.wpCmd = (uint)(m_data.dwID << 8) + index;
    }