コード例 #1
0
        // Shadow effect
        private void button1_Click(object sender, EventArgs e)
        {
            // ------------- Shadow Effect ----------------------------
            _FontMgr.BackColor = Color.White;
            _FontMgr.TextColor = Color.Red;
            _FontMgr.SetShadowAttri(Color.LightGray, 3 * _FontMgr.ScaleIndex, -5 * _FontMgr.ScaleIndex);
            //
            _FontMgr.GenerateBmps(m_actualImage, m_virtualImage, m_strList);
            if (m_virtualImage.Count > 0)
            {
                DrawFrameImage(m_virtualImage[0]);
                m_actualImage[0].Save("c:\\shadow.png", ImageFormat.Png);
            }


#if false
            // Get ISEFonts
            List <String> fontName = null;

            // 得到字体
            fontName = null;
            fontName = FontManager.GetSystemFonts();
            foreach (string item in fontName)
            {
                Console.WriteLine(item);
            }

            // 得到指定字体的可用显示尺寸
            List <int> fontSize = null;
            fontSize = FontManager.GetSpecifiedFontHeight("System");
            foreach (int item in fontSize)
            {
                Console.WriteLine(item);
            }
#endif

            // 使用GDI+枚举系统的所有字体
#if _ENUM_SYSFONTS_GDIP_
            pictureBox1.Visible = false;
            FontFamily fontFamily = new FontFamily("Arial");
            Font       font       = new Font(
                fontFamily,
                8,
                FontStyle.Regular,
                GraphicsUnit.Point);
            RectangleF rectF      = new RectangleF(10, 10, 500, 500);
            SolidBrush solidBrush = new SolidBrush(Color.Black);

            string       familyName;
            string       familyList = "";
            FontFamily[] fontFamilies;

            InstalledFontCollection installedFontCollection = new InstalledFontCollection();

            // Get the array of FontFamily objects.
            fontFamilies = installedFontCollection.Families;

            // The loop below creates a large string that is a comma-separated
            // list of all font family names.

            int count = fontFamilies.Length;
            for (int j = 0; j < count; ++j)
            {
                familyName = fontFamilies[j].Name;
                familyList = familyList + familyName;
                familyList = familyList + ",  ";
            }

            // Draw the large string (list of all families) in a rectangle.
            CreateGraphics().DrawString(familyList, font, solidBrush, rectF);
#endif
        }