Example #1
0
        /// <summary>
        /// Set the indentation using the level of this item
        /// </summary>
        /// <returns>True if successfull, false otherwise</returns>
        public bool SetIndentation()
        {
            if (!IsInATreeListView)
            {
                return(false);
            }
            bool res = true;

            APIsStructs.LV_ITEM lvi = new APIsStructs.LV_ITEM();
            lvi.iItem   = Index;
            lvi.iIndent = Level;
            if (TreeListView.ShowPlusMinus)
            {
                lvi.iIndent++;
            }
            lvi.mask = APIsEnums.ListViewItemFlags.INDENT;
            try
            {
                APIsUser32.SendMessage(
                    ListView.Handle,
                    APIsEnums.ListViewMessages.SETITEM,
                    0,
                    ref lvi);
            }
            catch
            {
                res = false;
            }
            return(res);
        }
Example #2
0
        public void ShowNoActivate()
        {
            int screenWidth  = Screen.PrimaryScreen.WorkingArea.Width;
            int screenHeight = Screen.PrimaryScreen.WorkingArea.Height;

            this.Left = screenWidth - this.Width;
            this.Top  = screenHeight - this.Height;

            Configuration c;

            c = ConfigurationHelper.GetConfiguration(ConfigurationKey.PlaySoundOnReminder);
            if (Convert.ToInt32(c.Value) == 1)
            {
                System.Media.SystemSounds.Asterisk.Play();
            }

            this.timer.Start();

            //// Show the window without activating it.
            APIsUser32.ShowWindow(this.Handle, APIsEnums.ShowWindowStyles.SHOWNOACTIVATE);

            //// Equivalent to setting TopMost = true, except don't activate the window.
            APIsUser32.SetWindowPos(this.Handle, HWND_TOPMOST, Left, Top, Width, Height, 10);
            //SetWindowPos((int)this.Handle, 0, Left, Top, Width, Height, System.Convert.ToUInt16(SWP.FRAMECHANGED | SWP.NOACTIVATE | SWP.NOCOPYBITS | SWP.NOMOVE | SWP.NOOWNERZORDER | SWP.NOSENDCHANGING | SWP.NOSIZE | SWP.NOZORDER));
        }
Example #3
0
        public Rectangle GetItemRect(int itemIndex)
        {
            const int HDM_FIRST       = 0x1200;
            const int HDM_GETITEMRECT = HDM_FIRST + 7;

            APIsStructs.RECT r = new APIsStructs.RECT();
            var err            = APIsUser32.SendMessageRECT(Handle, HDM_GETITEMRECT, itemIndex, ref r);

            return(Rectangle.FromLTRB(r.left, r.top, r.right, r.bottom));
        }
Example #4
0
 protected override void SetVisibleCore(bool value)
 {
     if (value)
     {
         APIsUser32.ShowWindow(this.Handle, APIsEnums.ShowWindowStyles.SHOWNOACTIVATE);
     }
     else
     {
         base.SetVisibleCore(value);
     }
 }
Example #5
0
 /// <summary>
 /// Asks the associated TreeListView control to redraw this item
 /// </summary>
 public void Redraw()
 {
     if (ListView == null || !Visible)
     {
         return;
     }
     try
     {
         APIsUser32.SendMessage(
             ListView.Handle,
             (int)APIsEnums.ListViewMessages.REDRAWITEMS,
             Index, Index);
     }
     catch { }
 }
Example #6
0
 /// <summary>
 /// Asks the associated TreeListView control to redraw this item
 /// </summary>
 public void Redraw()
 {
     if (ListView == null || !Visible)
     {
         return;
     }
     try
     {
         APIsUser32.SendMessage(
             new HandleRef(this, ListView.Handle),
             (int)APIsEnums.ListViewMessages.REDRAWITEMS,
             (IntPtr)Index, (IntPtr)Index);
     }
     catch {}
 }
Example #7
0
 static private void KillMxDrawProc()
 {
     while (true)
     {
         Thread.Sleep(10);
         foreach (string key in _KilledWindowCollection.Keys)
         {
             string winText = _KilledWindowCollection[key];
             IntPtr p       = APIsWndProc.FindWindow(key, winText);
             if (p.ToInt32() > 0)
             {
                 APIsUser32.SendMessage(p, 16, 0, 0);
             }
         }
         if (_StopKillWindowThread)
         {
             _KillWindowThreadIsRun = false;
             break;
         }
     }
 }
 private bool OnKillFocus(Message m)
 {
     // If the control is a combobox don't end edit if the handle is a handle
     // of one of the sub controls of the combobox
     if (!(_control is ComboBox))
     {
         return(true);
     }
     APIsStructs.PCOMBOBOXINFO info = new APIsStructs.PCOMBOBOXINFO();
     info.cbSize = (uint)Marshal.SizeOf(typeof(APIsStructs.PCOMBOBOXINFO));
     if (!APIsUser32.GetComboBoxInfo(_control.Handle, ref info))
     {
         return(true);
     }
     if (m.WParam == info.hwndCombo || m.WParam == info.hwndItem || m.WParam == info.hwndList)
     {
         ReleaseHandle();
         AssignHandle(m.WParam);
         return(false);
     }
     return(true);
 }
Example #9
0
 private void Test()
 {
     APIsUser32.SetWindowText(this.Handle, "wjw api test");
 }
Example #10
0
 public HeaderControl(TreeListView olv)
 {
     ListView = olv;
     AssignHandle(APIsUser32.GetHeaderControl(ListView));
 }
Example #11
0
 public void Invalidate()
 {
     APIsUser32.InvalidateRect(this.Handle, 0, true);
 }