Exemplo n.º 1
0
        public TitleBar()
        {
            InitializeComponent();

            TabStop = true;

            btnArrow.Image = global::Landriesnidis.LCL_Controls.Properties.Resources.MiniImageButton_Arrow;
            btnClose.Image = global::Landriesnidis.LCL_Controls.Properties.Resources.MiniImageButton_Close;

            BackColorChanged += (s, e) =>
            {
                if (labTitle.BackColor != this.BackColor)
                {
                    labTitle.BackColor = this.BackColor;
                }
            };
            ForeColorChanged += (s, e) =>
            {
                if (labTitle.ForeColor != this.ForeColor)
                {
                    labTitle.ForeColor = this.ForeColor;
                }
            };

            labTitle.BackColorChanged += (s, e) =>
            {
                if (this.BackColor != labTitle.BackColor)
                {
                    this.BackColor = labTitle.BackColor;
                }
            };
            labTitle.ForeColorChanged += (s, e) =>
            {
                if (this.ForeColor != labTitle.ForeColor)
                {
                    this.ForeColor = labTitle.ForeColor;
                }
            };

            FocusListener = new FocusListener(this);
            FocusListener.ParentControl      = this;
            FocusListener.AllowUseClickEvent = true;

            FocusListener.GotFocus  += FocusListener_GotFocus;
            FocusListener.LostFocus += FocusListener_LostFocus;

            labTitle.MouseMove         += All_MouseMove;
            labTitle.MouseLeave        += All_MouseLeave;
            flowLayoutPanel.MouseMove  += All_MouseMove;
            flowLayoutPanel.MouseLeave += All_MouseLeave;

            /*
             * backColorSupport = new BackColorSupport(this);
             * backColorSupport.RespondMouseLeaveEvent = true;
             * backColorSupport.RespondMouseMoveEvent = true;
             * backColorSupport.StateColorSet = this.stateColorSet;
             * backColorSupport.TargetTypes = new Type[] { typeof(TitleBar), typeof(Label) };
             * backColorSupport.ParentControl = this;
             */
        }
Exemplo n.º 2
0
 /// <summary>
 /// Adds the specified focus listener to receive focus events from
 /// this component when this component gains input focus.
 /// </summary>
 public void addFocusListener(FocusListener @l)
 {
 }
Exemplo n.º 3
0
 /// <summary>
 /// Removes the specified focus listener so that it no longer
 /// receives focus events from this component.
 /// </summary>
 public void removeFocusListener(FocusListener @l)
 {
 }
Exemplo n.º 4
0
 /// <summary>
 /// Removes the old focus-listener from focus-listener-l and
 /// returns the resulting multicast listener. </summary>
 /// <param name="l"> focus-listener-l </param>
 /// <param name="oldl"> the focus-listener being removed </param>
 public static FocusListener Remove(FocusListener l, FocusListener oldl)
 {
     return((FocusListener)RemoveInternal(l, oldl));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds focus-listener-a with focus-listener-b and
 /// returns the resulting multicast listener. </summary>
 /// <param name="a"> focus-listener-a </param>
 /// <param name="b"> focus-listener-b </param>
 public static FocusListener Add(FocusListener a, FocusListener b)
 {
     return((FocusListener)AddInternal(a, b));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Adds the specified focus listener to receive focus events from
 /// this component when this component gains input focus.
 /// </summary>
 public void addFocusListener(FocusListener @l)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Removes the specified focus listener so that it no longer
 /// receives focus events from this component.
 /// </summary>
 public void removeFocusListener(FocusListener @l)
 {
 }
Exemplo n.º 8
0
        public LCLTabControl()
        {
            InitializeComponent();

            Pages = new TabPageCollection(this, panelTitle, panelMain);

            btnMorePage.Image = global::Landriesnidis.LCL_Controls.Properties.Resources.MiniImageButton_Arrow;

            //backColorSupport = new BackColorSupport(this);
            focusListener = new FocusListener(this);

            /*
             * //
             * // backColorSupport
             * //
             * this.backColorSupport.ParentControl = this.panelTitle;
             * this.backColorSupport.RespondGotFocusEvent = false;
             * this.backColorSupport.RespondLostFocusEvent = false;
             * this.backColorSupport.RespondMouseDownEvent = false;
             * this.backColorSupport.RespondMouseLeaveEvent = true;
             * this.backColorSupport.RespondMouseMoveEvent = true;
             * this.backColorSupport.StateColorSet = this.stateColorSet;
             * this.backColorSupport.TargetTypes = null;
             * //
             * // focusListener
             * //
             * this.focusListener.AllowUseClickEvent = true;
             * this.focusListener.ParentControl = this.panelTitle;
             *
             * backColorSupport.TargetTypes = new Type[] { typeof(TitleBar),typeof(Label) };
             *
             * PageAdded += (s, e)=>{
             *  backColorSupport.AddChildControl(e.TabPage.TitleBar);
             *  RefreshPagesMenu();
             * };
             * PageRemoved += (s, e) => {
             *  backColorSupport.RemoveChildControl(e.TabPage.TitleBar);
             *  RefreshPagesMenu();
             * };
             */

            // 为箭头按钮添加快捷菜单
            btnMorePage.Click += (s, e) =>
            {
                cmsPagesMenu.Show(btnMorePage, btnMorePage.Width - cmsPagesMenu.Width, cmsPagesMenu.Height);
            };

            cmsPagesMenu.Opening += (s, e) =>
            {
                cmsPagesMenu.Items.Clear();

                foreach (Control c in panelTitle.Controls)
                {
                    TitleBar tb = (TitleBar)c;
                    if (c.Top != 1)
                    {
                        var item = new ToolStripButton();
                        item.Text = tb.Title;
                        cmsPagesMenu.Items.Add(item);
                    }
                }
            };
        }