コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        public MenRibbonButton()
        {
            this.ContextMenuCollections = new ContextMenu();
            tp = new MenToolTip();

            this.Title             = new Label();
            this.Title.Name        = "ButtonTitle";
            this.Title.TextAlign   = ContentAlignment.MiddleCenter;
            this.Title.AutoSize    = false;
            this.Title.Font        = MenRibbonConstants.TextFont;
            this.Title.MouseEnter += new EventHandler(this.MouseEnter);
            this.Title.MouseLeave += new EventHandler(this.MouseLeave);
            this.Title.Click      += new EventHandler(this.MouseCLick);
            this.Title.MouseDown  += new System.Windows.Forms.MouseEventHandler(this.MouseDown);

            this._primaryImage             = new MenRibbonPictureBox();
            this._primaryImage.Name        = "PrimaryImage";
            this._primaryImage.SizeMode    = PictureBoxSizeMode.CenterImage;
            this._primaryImage.TabStop     = false;
            this._primaryImage.MouseEnter += new EventHandler(this.MouseEnter);
            this._primaryImage.MouseLeave += new EventHandler(this.MouseLeave);
            this._primaryImage.Click      += new EventHandler(this.MouseCLick);
            this._primaryImage.MouseDown  += new System.Windows.Forms.MouseEventHandler(this.MouseDown);

            this._childImage = new MenRibbonPictureBox(MenRibbonConstants.ChildImageSize);



            base.Enabled  = true;
            this._visible = true;
            this.Location = new System.Drawing.Point(MenRibbonConstants.X, MenRibbonConstants.Y);
            this.Name     = "RibbonButton";
            this.Controls.Add(this._primaryImage);
            this.Controls.Add(this.Title);
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 public MenTitlebar()
 {
     InitializeComponent();
     this.minimizeBtn.Visible = _enableMinMax;
     this.maximizeBtn.Visible = _enableMinMax;
     formToolTip         = new MenToolTip();
     CurrentWindowsState = MenWindowsState.Normal;
     ColorInitialize();
 }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        public MenToolStrip()
            : base()
        {
            this.BackColor = MenConstants.Thin;
            this.Renderer  = new Menporul.Windows.Controls.Core.MenToolStripColorRenderer();

            //Tooltips initialization
            ShowItemToolTips = false;
            timer            = new Timer();
            timer.Enabled    = false;
            timer.Interval   = SystemInformation.MouseHoverTime;
            timer.Tick      += new EventHandler(timer_Tick);
            Tooltip          = new MenToolTip();
        }
コード例 #4
0
        /// <summary>
        /// tooltip show based on the timer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void timer_Tick(object sender, EventArgs e)
        {
            timer.Stop();
            try
            {
                Point currentMouseOverPoint;
                if (ToolTipShowUp)
                {
                    currentMouseOverPoint = this.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y - Cursor.Current.Size.Height + Cursor.Current.HotSpot.Y));
                }
                else
                {
                    currentMouseOverPoint = this.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y + Cursor.Current.Size.Height - Cursor.Current.HotSpot.Y));
                }

                if (mouseOverItem == null)
                {
                    if (ToolTipText != null && ToolTipText.Length > 0)
                    {
                        if (Tooltip == null)
                        {
                            Tooltip = new MenToolTip();
                        }
                        Tooltip.Show(ToolTipText, this, currentMouseOverPoint, ToolTipInterval);
                    }
                }
                else if ((!(mouseOverItem is ToolStripDropDownButton) && !(mouseOverItem is ToolStripSplitButton)) ||
                         ((mouseOverItem is ToolStripDropDownButton) && !((ToolStripDropDownButton)mouseOverItem).DropDown.Visible) ||
                         (((mouseOverItem is ToolStripSplitButton) && !((ToolStripSplitButton)mouseOverItem).DropDown.Visible)))
                {
                    if (mouseOverItem.ToolTipText != null && mouseOverItem.ToolTipText.Length > 0 && Tooltip != null)
                    {
                        if (Tooltip == null)
                        {
                            Tooltip = new MenToolTip();
                        }
                        Tooltip.Show(mouseOverItem.ToolTipText, this, currentMouseOverPoint, ToolTipInterval);
                    }
                }
            }
            catch
            { }
        }