コード例 #1
0
ファイル: EditorView.cs プロジェクト: shenyczz/ApsimX
        private void OnChangeFont(object sender, EventArgs e)
        {
            try
            {
                if (fontDialog != null)
                {
                    fontDialog.Destroy();
                }

                fontDialog = new FontSelectionDialog("Select a font");

                // Center the dialog on the main window.
                fontDialog.TransientFor   = MainWidget as Window;
                fontDialog.WindowPosition = WindowPosition.CenterOnParent;

                // Select the current font.
                if (Utility.Configuration.Settings.FontName != null)
                {
                    fontDialog.SetFontName(Utility.Configuration.Settings.EditorFontName.ToString());
                }

                // Event handlers.
                fontDialog.OkButton.Clicked     += OnFontSelected;
                fontDialog.OkButton.Clicked     += OnDestroyFontDialog;
                fontDialog.ApplyButton.Clicked  += OnFontSelected;
                fontDialog.CancelButton.Clicked += OnDestroyFontDialog;

                // Show the dialog.
                fontDialog.ShowAll();
            }
            catch (Exception err)
            {
                ShowError(err);
            }
        }
コード例 #2
0
ファイル: MainView.cs プロジェクト: peter-devoil/ApsimX
        /// <summary>
        /// Shows the font selection dialog.
        /// </summary>
        public void ShowFontChooser()
        {
            string title = "Select a font";

#if NETFRAMEWORK
            fontDialog = new FontSelectionDialog(title);
#else
            fontDialog = new FontChooserDialog(title, window1);
#endif

            // Center the dialog on the main window.
            fontDialog.TransientFor   = MainWidget as Window;
            fontDialog.WindowPosition = WindowPosition.CenterOnParent;

            // Select the current font.
            if (Utility.Configuration.Settings.FontName != null)
            {
                fontDialog.SetFontName(Utility.Configuration.Settings.FontName.ToString());
            }

#if NETFRAMEWORK
            fontDialog.Response += OnChangeFont;
            //fontDialog.OkButton.Clicked += OnChangeFont;
#else
            //fontDialog.FontActivated += OnChangeFont;
            fontDialog.Response += OnChangeFont;
#endif

            // Show the dialog.
            fontDialog.ShowAll();
        }
コード例 #3
0
ファイル: MainView.cs プロジェクト: Scicrop/ApsimX
        /// <summary>
        /// Shows the font selection dialog.
        /// </summary>
        public void ShowFontChooser()
        {
            fontDialog = new FontSelectionDialog("Select a font");

            // Center the dialog on the main window.
            fontDialog.TransientFor   = MainWidget as Window;
            fontDialog.WindowPosition = WindowPosition.CenterOnParent;

            // Select the current font.
            if (Utility.Configuration.Settings.Font != null)
            {
                fontDialog.SetFontName(Utility.Configuration.Settings.Font.ToString());
            }

            // Event handlers.
            fontDialog.OkButton.Clicked     += OnChangeFont;
            fontDialog.OkButton.Clicked     += OnDestroyFontDialog;
            fontDialog.ApplyButton.Clicked  += OnChangeFont;
            fontDialog.CancelButton.Clicked += OnDestroyFontDialog;

            // Show the dialog.
            fontDialog.ShowAll();
        }