コード例 #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (m_Words == null)
            {
                return;
            }
            if (m_Layout == null)
            {
                return;
            }

            IEnumerable <LayoutItem> wordsToRedraw = m_Layout.GetWordsInArea(e.ClipRectangle.ToPortable());

            using (Graphics graphics = e.Graphics)
                using (IGraphicEngine graphicEngine =
                           new GdiGraphicEngine(graphics, this.Font.FontFamily, FontStyle.Regular, m_Palette, MinFontSize, MaxFontSize, m_MinWordWeight, m_MaxWordWeight))
                {
                    foreach (LayoutItem currentItem in wordsToRedraw)
                    {
                        if (ItemUnderMouse == currentItem)
                        {
                            graphicEngine.DrawEmphasized(currentItem);
                        }
                        else
                        {
                            graphicEngine.Draw(currentItem);
                        }
                    }
                }
        }
コード例 #2
0
        private void BuildLayout()
        {
            if (m_Words == null)
            {
                return;
            }

            using (Graphics graphics = this.CreateGraphics())
            {
                IGraphicEngine graphicEngine =
                    new GdiGraphicEngine(graphics, this.Font.FontFamily, FontStyle.Regular, m_Palette, MinFontSize, MaxFontSize, m_MinWordWeight, m_MaxWordWeight);
                m_Layout = LayoutFactory.CrateLayout(m_LayoutType, this.Size);
                m_Layout.Arrange(m_Words, graphicEngine);
            }
        }
コード例 #3
0
        public void BuildLayout()
        {
            m_Layout   = LayoutFactory.CrateLayout(m_LayoutType, this.Size);
            ItemsCount = 0;
            if (m_Words == null || m_Words.Count == 0)
            {
                return;
            }

            CaclulateMinMaxWordWeights();

            using (Graphics graphics = this.CreateGraphics())
            {
                IGraphicEngine graphicEngine =
                    new GdiGraphicEngine(graphics, this.Font.FontFamily, FontStyle.Regular, m_Palette, MinFontSize, MaxFontSize, m_MinWordWeight, m_MaxWordWeight);
                ItemsCount = m_Layout.Arrange(this.m_Words, graphicEngine);
            }
        }