示例#1
0
        private void onClickClosedList(AControl control, int x, int y, MouseButton button)
        {
            if (Items.Count > 0)
            {
                m_IsListOpen                     = true;
                m_openResizePic                  = new ResizePic(Parent, X, Y, 3000, m_Width, m_Font.Height * m_visibleItems + 8);
                m_openResizePic.GumpLocalID      = GumpLocalID;
                m_openResizePic.MouseClickEvent += onClickOpenList;
                m_openResizePic.MouseOverEvent  += onMouseOverOpenList;
                m_openResizePic.MouseOutEvent   += onMouseOutOpenList;
                ((Gump)Parent).AddControl(m_openResizePic, Page);

                if (m_visibleItems > Items.Count)
                {
                    m_visibleItems = Items.Count;
                }

                // only show the scrollbar if we need to scroll
                if (m_visibleItems < Items.Count)
                {
                    m_openScrollBar = new ScrollBar(Parent, X + m_Width - 20, Y + 4, m_Font.Height * m_visibleItems, (m_CanBeNull ? -1 : 0), Items.Count - m_visibleItems, Index);
                    ((Gump)Parent).AddControl(m_openScrollBar, Page);
                }
                m_openLabels = new TextLabelAscii[m_visibleItems];
                for (int i = 0; i < m_visibleItems; i++)
                {
                    m_openLabels[i] = new TextLabelAscii(Parent, X + 4, Y + 5 + m_Font.Height * i, 1, 1106, string.Empty);
                    ((Gump)Parent).AddControl(m_openLabels[i], Page);
                }
            }
        }
示例#2
0
        void BuildGumpling(int x, int y, int width, string[] items, int itemsVisible, int index, bool canBeNull)
        {
            Position       = new Point(x, y);
            m_items        = new List <string>(items);
            m_width        = width;
            Index          = index;
            m_visibleItems = itemsVisible;
            m_canBeNull    = canBeNull;

            m_resize = (ResizePic)AddControl(new ResizePic(this, 0, 0, 3000, m_width, m_Font.Height + 8), 0);
            m_resize.MouseClickEvent += onClickClosedList;
            m_resize.MouseOverEvent  += onMouseOverClosedList;
            m_resize.MouseOutEvent   += onMouseOutClosedList;
            m_label = (TextLabelAscii)AddControl(new TextLabelAscii(this, 4, 5, 1, hue_Text, string.Empty), 0);
            AddControl(new GumpPic(this, width - 22, 5, 2086, 0), 0);
        }
示例#3
0
        public void CreateVisual()
        {
            if (m_ResizePic != null || m_label != null || ScrollButton != null)
            {
                return;
            }

            m_ResizePic                  = (ResizePic)AddControl(new ResizePic(this, 0, 0, 3000, m_Width, m_Font.Height + 8), 0);
            m_ResizePic.GumpLocalID      = GumpLocalID;
            m_ResizePic.MouseClickEvent += onClickClosedList;
            m_ResizePic.MouseOverEvent  += onMouseOverClosedList;
            m_ResizePic.MouseOutEvent   += onMouseOutClosedList;
            m_ResizePic.IsEnabled        = false;
            m_label             = (TextLabelAscii)AddControl(new TextLabelAscii(this, 4, 5, 1, hue_Text, string.Empty), 0);
            m_label.GumpLocalID = GumpLocalID;
            ScrollButton        = (GumpPic)AddControl(new GumpPic(this, m_Width - 22, 5, 2086, 0), 0);

            IsFirstvisible = true;//for invisible create control
        }