コード例 #1
0
ファイル: FrmRead.cs プロジェクト: zhongxiaobang/Book
        /// <summary>
        /// 从配置文件中恢复窗体和控件状态
        /// </summary>
        public void RecoveryConfiguration()
        {
            FrmReadConfig config = FormConfigManager.GetFrmReadConfig(book);

            if (config != null)
            {
                listBox1.Font      = new Font(new FontFamily(config.ListBoxFontFamilyName), config.ListBoxFontSize);
                listBox1.ForeColor = config.ListBoxForeColor;
                listBox1.BackColor = config.ListBoxBackColor;
                textBox1.Font      = new Font(new FontFamily(config.TextBoxFamilyName), config.TextBoxFontSize);
                textBox1.ForeColor = config.TextBoxForeColor;
                textBox1.BackColor = config.TextBoxBackColor;
                WindowState        = config.FormWindowState;
                Left   = config.FormLeft;
                Top    = config.FormTop;
                Width  = config.FormWidth;
                Height = config.FormHeight;

                listBox1.SelectedIndex = config.ReadIndex;
                listBox1_MouseDoubleClick(null, null);
            }
        }
コード例 #2
0
ファイル: FrmRead.cs プロジェクト: zhongxiaobang/Book
        private void FrmRead_FormClosed(object sender, FormClosedEventArgs e)
        {
            //保存窗体和控件状态
            FrmReadConfig config = new FrmReadConfig();

            config.ReadIndex             = CurrentIndex;
            config.ListBoxFontFamilyName = listBox1.Font.Name;
            config.ListBoxFontSize       = listBox1.Font.Size;
            config.ListBoxForeColor      = listBox1.ForeColor;
            config.ListBoxBackColor      = listBox1.BackColor;
            config.TextBoxFamilyName     = textBox1.Font.Name;
            config.TextBoxFontSize       = textBox1.Font.Size;
            config.TextBoxForeColor      = textBox1.ForeColor;
            config.TextBoxBackColor      = textBox1.BackColor;
            config.FormWindowState       = WindowState;
            config.FormLeft   = Left;
            config.FormTop    = Top;
            config.FormWidth  = Width;
            config.FormHeight = Height;

            FormConfigManager.SetFrmReadConfigConfig(config, book);
        }