Exemple #1
0
        public FloatingToolBox(Form owner)
        {
            _owner = owner;
            // Initializing
            _fWindow = new FloatingWindow();
            float deg = (float)(Math.Asin(15d / 25d) * 180 / Math.PI);

            _iconRect = new Rectangle(0, -10, 50, 50);
            _toolTip  = new Ai.Control.ToolTip();
            _items    = new ToolBoxItemCollection(this);
            _sf       = new StringFormat();
            _hosts    = new List <ItemHost>();
            // Setting up floating window.
            _fWindow.Height        = 45;
            _fWindow.ShowInTaskbar = false;
            _fWindow.Active        = false;
            _fWindow.Modal         = false;
            _fWindow.Selectable    = false;
            _fWindow.Owner         = _owner;
            _fWindow.Paint        += _Paint;
            _fWindow.MouseMove    += _MouseMove;
            _fWindow.MouseDown    += _MouseDown;
            _fWindow.MouseUp      += _MouseUp;
            _fWindow.MouseLeave   += _MouseLeave;
            _fWindow.MouseEnter   += _MouseEnter;
            _fWindow.KeyDown      += _KeyDown;
            // Setting up tooltip
            _toolTip.AnimationSpeed = 20;
            _toolTip.Draw          += tooltip_Draw;
            _toolTip.Popup         += tooltip_Popup;
            // Setting up string format.
            _sf.Alignment     = StringAlignment.Center;
            _sf.LineAlignment = StringAlignment.Center;
            // Setting up items.
            _items.AfterClear  += _items_AfterClear;
            _items.AfterInsert += _items_AfterInsert;
            _items.AfterRemove += _items_AfterRemove;
            measureWindow();
        }
Exemple #2
0
 public FloatingForm(FloatingWindow owner)
 {
     _owner          = owner;
     FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     StartPosition   = FormStartPosition.Manual;
     if (_owner._owner != null)
     {
         Owner = _owner._owner;
     }
     if (!_owner._selectable)
     {
         this.SetStyle(ControlStyles.Selectable, false);
     }
     this.KeyPreview    = true;
     this.Width         = _owner._size.Width;
     this.Height        = _owner._size.Height;
     this.ShowInTaskbar = _owner._showInTaskbar;
     this.MouseMove    += _MouseMove;
     this.MouseDown    += _MouseDown;
     this.MouseLeave   += _MouseLeave;
     this.MouseEnter   += _MouseEnter;
     this.MouseUp      += _MouseUp;
     this.Resize       += _Resize;
     this.Left          = _owner._location.X;
     this.Top           = _owner._location.Y;
     _bmp = new Bitmap(this.Width, this.Height);
     redrawWindow();
     if (!_owner._active)
     {
         Win32API.ShowWindow(this.Handle, (int)Win32API.SW_SHOWNA);
         Win32API.SetWindowPos(this.Handle, Win32API.HWND_TOPMOST, this.Left, this.Top, this.Width, this.Height,
                               (int)(Win32API.SWP_NOSIZE | Win32API.SWP_NOMOVE | Win32API.SWP_NOACTIVATE));
     }
     else
     {
         Win32API.ShowWindow(this.Handle, (int)Win32API.SW_SHOWNORMAL);
     }
 }