Exemple #1
0
        public FormMain()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Add font face names to cboxFont combo box
            try
            {
                // Create managed code font collection.
                fonts = new YaoDurant.Drawing.FontCollection();

                // Loop through collection, adding all items to combo box
                for (int i = 0; i < fonts.Count; i++)
                {
                    cboxFont.Items.Add(fonts[i]);
                }

                fonts.Dispose();
                fonts = null;
            }
            catch
            {
                string str = "Error: cannot create FontCollection" +
                             " -- make sure fontlist.dll is installed";
                MessageBox.Show(str, "FontPicker");
            }

            // Set initial font name, size, and style.
            cboxFont.SelectedIndex  = 0;
            cboxSize.SelectedIndex  = 0;
            cboxStyle.SelectedIndex = 0;
        }
Exemple #2
0
        public FormMain()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            try
            {
                // Create managed code font collection.
                m_fonts = new YaoDurant.Drawing.FontCollection();

                // Loop through collection, adding all items to combo box
                for (int i = 0; i < m_fonts.Count; i++)
                {
                    cboxFont.Items.Add(m_fonts[i]);
                }
            }
            catch
            {
                string str = "Error: cannot create FontCollection" +
                             " -- make sure fontlist.dll is installed";
                MessageBox.Show(str, "FontPicker");
                Close();
                return;
            }

            cboxFont.SelectedIndex  = 0;
            cboxSize.SelectedIndex  = 0;
            cboxStyle.SelectedIndex = 0;
        }
Exemple #3
0
        /// DlgFont_Load - Initialize dialog box controls.
        private void DlgFont_Load(
            object sender,
            System.EventArgs e)
        {
            // Add font face names to comboFont combo box
            YaoDurant.Drawing.FontCollection fonts;
            int iCurrent = -1;

            try
            {
                // Create managed code font collection.
                fonts = new YaoDurant.Drawing.FontCollection();

                // Loop through collection, adding all items to combo box
                for (int i = 0; i < fonts.Count; i++)
                {
                    comboFont.Items.Add(fonts[i]);
                    if (strFontName == fonts[i])
                    {
                        iCurrent = i;
                    }
                }

                fonts.Dispose();
                fonts = null;

                // Set current face name.
                comboFont.SelectedIndex = iCurrent;

                // Set font size.
                string strFontSize = cemFontSize.ToString();
                comboSize.SelectedItem = strFontSize;

                // Set font styles.
                chkBold.Checked      = bBold;
                chkItalic.Checked    = bItalic;
                chkUnderline.Checked = bUnderline;

                // Hide parent.
                m_formParent.Visible = false;
            }
            catch
            {
                string str = "Error: cannot create FontCollection" +
                             " -- make sure fontlist.dll is installed";
                MessageBox.Show(str, "PrintField");

                this.DialogResult = DialogResult.Cancel;
                Close();
            }
        }