コード例 #1
0
        public void AddText(string text)
        {
            mLastTextAdded = text;

            // the text needs to be broken up into lines
            text = TextManager.InsertNewLines(text, GuiManager.TextSpacing, mListBox.TextScaleX * 2, TextManager.DefaultFont);
            string[] lines = text.Split('\n');

            foreach (string s in lines)
            {
                mListBox.AddItem(s);
            }

            mListBox.HighlightItem(mListBox.Items[mListBox.mItems.Count - 1], false);
            mListBox.HighlightItem((CollapseItem)null, false);

            if (TextAdded != null)
            {
                TextAdded(this);
            }
        }
コード例 #2
0
ファイル: ComboBox.cs プロジェクト: profexorgeek/FlatRedBall
        /// <summary>
        /// Event clicked when the dropDownButton is clicked.  If the ListBox is not visible
        /// it will appear.
        /// </summary>
        /// <param name="callingWindow"></param>
        void OnDropDownButtonClick(Window callingWindow)
        {
            if (mListBox.Visible)
            {
                return;
            }

            // The ListBox is not visible, so "expand" it.

            GuiManager.AddPerishableWindow(mListBox);
            mListBox.Visible = true;

            if (mListBox.SpriteFrame != null)
            {
                SpriteManager.AddSpriteFrame(mListBox.SpriteFrame);
            }

//                listBox.SetPositionTL(ScaleX, ScaleY + 4);
            mListBox.SetScaleToContents(ScaleX);
            mListBox.SetPositionTL(ScaleX, ScaleY + mListBox.ScaleY + 1);

            mListBox.HighlightOnRollOver = true;

            mListBox.UpdateDependencies();


            float maximumScale = GuiManager.YEdge - (MenuStrip.MenuStripHeight / 2.0f);

            if (mListBox.ScaleY > maximumScale)
            {
                mListBox.ScrollBarVisible = true;
                mListBox.ScaleY           = maximumScale;
            }

            if (mListBox.WorldUnitY - mListBox.ScaleY < -GuiManager.Camera.YEdge)
            {
                mListBox.Y -= -GuiManager.Camera.YEdge - (mListBox.WorldUnitY - mListBox.ScaleY);
            }

            if (mListBox.WorldUnitX + mListBox.ScaleX > GuiManager.Camera.XEdge)
            {
                mListBox.X -= (mListBox.WorldUnitX + mListBox.ScaleX) - GuiManager.Camera.XEdge;
            }

            if (mListBox.WorldUnitX - mListBox.ScaleX < -GuiManager.Camera.XEdge)
            {
                mListBox.X += -GuiManager.Camera.XEdge - (mListBox.WorldUnitX - mListBox.ScaleX);
            }

            mListBox.HighlightItem(mSelectionDisplay.Text);
        }