コード例 #1
0
 public MyToolButtonViewInfo(MyToolButton button)
 {
     this.button   = button;
     imageBounds   = Rectangle.Empty;
     captionBounds = Rectangle.Empty;
     bounds        = Rectangle.Empty;
 }
        public virtual void HitTest(Point pt)
        {
            if (focusedButton != null)
            {
                if (focusedButton.ViewInfo.Bounds.Contains(pt))
                {
                    return;
                }
                focusedButton.ViewInfo.UnderCursor = false;
                InvalidateButton(focusedButton);
                focusedButton = null;
            }


            MyToolButton btn;

            for (int i = 0; i < Buttons.Count; i++)
            {
                btn = Buttons[i];
                if (btn.ViewInfo.Bounds.Contains(pt))
                {
                    btn.ViewInfo.UnderCursor = true;
                    focusedButton            = btn;
                    InvalidateButton(focusedButton);
                    break;
                }
            }
        }
コード例 #3
0
 public void Remove(MyToolButton btn)
 {
     if (btn == null)
     {
         return;
     }
     buttonList.Remove(btn);
 }
コード例 #4
0
 public void Add(MyToolButton btn)
 {
     if (btn == null || buttonList.Contains(btn))
     {
         return;
     }
     buttonList.Add(btn);
 }
 protected virtual void UpdateButtons()
 {
     focusedButton = null;
     Buttons.Clear();
     if (!IsPosted)
     {
         Buttons.Add(new MyToolButton(MyButtonType.Cancel));
         Buttons.Add(new MyToolButton(MyButtonType.Commit));
     }
     else
     {
         Buttons.Add(new MyToolButton(MyButtonType.Link));
     }
 }
 protected virtual void InvalidateButton(MyToolButton btn)
 {
     TreeList.Invalidate(btn.ViewInfo.Bounds);
 }