Exemplo n.º 1
0
 public PanelText()
 {
     m_IconPanel = null;//2017/01/09
     m_PanelIcon = null;
     bckgColor   = BackColor;
     MouseLeave += new EventHandler(OnMouseLeave);
     MouseMove  += new MouseEventHandler(OnMouseMove);
 }
Exemplo n.º 2
0
        public void AddIcon(string caption, Image image, EventHandler onClickEvent, int Height, int Placed = 0, int setindex = -1)
        {
            int index = Controls.Count / 2;     // two entries per icon
            int Index;

            if (setindex < 0)//為了日後手動指定做修改 at 2017/09/11
            {
                Index = index;
            }
            else
            {
                Index = setindex;
            }
            PanelIcon panelIcon = null;

            if (Placed == 0)
            {
                panelIcon = new PanelIcon(this, image, Index, index, index * (Height + image.Height));//panelIcon = new PanelIcon(this, image, index, onClickEvent, index * (Height + image.Height));
            }
            else
            {
                panelIcon = new PanelIcon(this, image, Index, index, index * (Height + image.Height), Placed);
            }
            panelIcon.Enabled = false;//2016/01/08
            Controls.Add(panelIcon);

            PanelText label = new PanelText();

            label.Text    = caption;
            label.Visible = true;
            if (Placed == 0)
            {
                label.Location = new Point(0, margin + image.Size.Height + panelIcon.Location.Y);
            }
            else
            {
                Point data = new Point(panelIcon.Location.X, panelIcon.Location.Y - 1); //2016/01/08
                label.Location = data;                                                  //2016/01/08
            }
            label.Size      = new Size(Size.Width, image.Size.Height + 2);              //2016/01/08 +2
            label.TextAlign = ContentAlignment.MiddleCenter;
            label.Click    += onClickEvent;                                             //實際項目事件
            label.Tag       = panelIcon;
            Controls.Add(label);
            m_ArrayList.Add(label);

            panelIcon.m_Label = label;
            label.m_PanelIcon = panelIcon;
            label.m_IconPanel = this;
        }