Esempio n. 1
0
        /// <summary>
        /// Sets current cursor displayed an icon of the currenly selected <see cref="ToolboxItem"/> over the design surface.
        /// </summary>
        /// <returns><b>true</b> if the <see cref="ToolboxItem"/> is selected and cursor is set; otherwise <b>false</b>.</returns>
        public virtual bool SetCursor()
        {
            ToolboxItem selectedItem = this.GetSelectedToolboxItem();

            if (selectedItem != null)
            {
                ToolCursor cursor = null;
                if (!this._cursors.TryGetValue(selectedItem, out cursor))
                {
                    try {
                        cursor = new ToolCursor(selectedItem);
                        this._cursors.Add(selectedItem, cursor);
                    } catch (Exception) {}
                }
                if (cursor != null)
                {
                    Cursor.Current = cursor.Cursor;
                }
                else
                {
                    Cursor.Current = Cursors.Cross;
                }
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
 /// <summary>
 /// Sets current cursor displayed an icon of the currenly selected <see cref="ToolboxItem"/> over the design surface.
 /// </summary>
 /// <returns><b>true</b> if the <see cref="ToolboxItem"/> is selected and cursor is set; otherwise <b>false</b>.</returns>
 public virtual bool SetCursor()
 {
     ToolboxItem selectedItem = this.GetSelectedToolboxItem();
     if (selectedItem != null) {
         ToolCursor cursor = null;
         if (!this._cursors.TryGetValue(selectedItem, out cursor)) {
             try {
                 cursor = new ToolCursor(selectedItem);
                 this._cursors.Add(selectedItem, cursor);
             } catch (Exception) {}
         }
         if (cursor != null) {
             Cursor.Current = cursor.Cursor;
         } else {
             Cursor.Current = Cursors.Cross;
         }
         return true;
     }
     return false;
 }