示例#1
0
 public (bool visible, bool dead) IsVisible()
 {
     ALastError.Clear();
     if (!w.IsVisible)
     {
         return(false, ALastError.Code != 0);
     }
     return(!w.IsMinimized && !w.IsCloaked, false);
     //speed: IsCloaked now on Win10 quite fast, faster than GetRect
 }
示例#2
0
 public (bool visible, bool dead) IsVisible(bool parentVisible = true)
 {
     if (!c.Is0)
     {
         ALastError.Clear();
         if (!c.IsVisible)
         {
             return(false, ALastError.Code != 0);
         }
         if (!parentVisible || c.IsMinimized)
         {
             return(default);                                                    //never mind: ancestors controls may be minimized
示例#3
0
        /// <summary>
        /// Copies the added data to the clipboard.
        /// </summary>
        /// <param name="renderLater">Call API <msdn>SetClipboardData</msdn>(format, default). When/if some app will try to get clipboard data, the first time your clipboard owner window will receive <msdn>WM_RENDERFORMAT</msdn> message and should call <c>SetOpenClipboard(false);</c>.</param>
        /// <param name="format">Copy data only of this format. If 0 (default), of all formats.</param>
        /// <exception cref="OutOfMemoryException">Failed to allocate memory for clipboard data.</exception>
        /// <exception cref="AuException">Failed to set clipboard data.</exception>
        /// <remarks>
        /// This function is similar to <see cref="SetClipboard"/>. It calls API <msdn>SetClipboardData</msdn> and does not call <b>OpenClipboard</b>, <b>EmptyClipboard</b>, <b>CloseClipboard</b>. The clipboard must be open and owned by a window of this thread.
        /// </remarks>
        public void SetOpenClipboard(bool renderLater = false, int format = 0)
        {
            for (int i = 0; i < _a.Count; i++)
            {
                var v = _a[i];
                if (format != 0 && v.format != format)
                {
                    continue;
                }
                if (renderLater)
                {
                    ALastError.Clear();
                    Api.SetClipboardData(v.format, default);
                    int ec = ALastError.Code; if (ec != 0)
                    {
                        throw new AuException(ec, "*set clipboard data");
                    }
                }
                else
                {
                    _SetClipboard(v.format, v.data);
                }
            }
#if SUPPORT_RAW_HANDLE
            //remove caller-added handles, to avoid using the same handle twice
            if (renderLater)
            {
                return;
            }
            for (int i = _a.Count - 1; i >= 0; i--)
            {
                var v = _a[i];
                if (format != 0 && v.format != format)
                {
                    continue;
                }
                if (v.data is IntPtr)
                {
                    _a.RemoveAt(i);
                }
            }
#endif
        }