コード例 #1
0
ファイル: CloudControl.cs プロジェクト: zhifu10001/YAGP
        private void BuildLayout()
        {
            if (m_Words == null)
            {
                return;
            }

            using (Graphics graphics = CreateGraphics())
                using (GdiGraphicEngine graphicEngine =
                           new GdiGraphicEngine(graphics, m_Palette, m_MinWordWeight, m_MaxWordWeight))
                {
                    graphicEngine.FontFamily  = Font.FontFamily;
                    graphicEngine.FontStyle   = FontStyle.Regular;
                    graphicEngine.MinFontSize = MinFontSize;
                    graphicEngine.MaxFontSize = MaxFontSize;
                    m_Layout = LayoutFactory.CreateLayout(m_LayoutType, Size);
                    m_Layout.Arrange(m_Words, graphicEngine);
                }
        }
コード例 #2
0
ファイル: CloudControl.cs プロジェクト: zhifu10001/YAGP
        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);

            using (Graphics graphics = e.Graphics)
                using (GdiGraphicEngine graphicEngine =
                           new GdiGraphicEngine(graphics, m_Palette, m_MinWordWeight, m_MaxWordWeight))
                {
                    graphicEngine.FontFamily  = Font.FontFamily;
                    graphicEngine.FontStyle   = FontStyle.Regular;
                    graphicEngine.MinFontSize = MinFontSize;
                    graphicEngine.MaxFontSize = MaxFontSize;

                    foreach (LayoutItem currentItem in wordsToRedraw)
                    {
                        if (m_ItemUderMouse == currentItem)
                        {
                            graphicEngine.DrawEmphasized(currentItem);
                        }
                        else
                        {
                            graphicEngine.Draw(currentItem);
                        }
                    }
                }
        }