⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usingtabs.cs

📁 this is a good book for the visual c#
💻 CS
📖 第 1 页 / 共 2 页
字号:
// Fig. 13.29: UsingTabs.cs
// Using TabControl to display various font settings.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace TabTest
{
   /// <summary>
   /// Summary description for UsingTabs.
   /// </summary>
   public class UsingTabs : System.Windows.Forms.Form
   {
      // output label reflects text changes
      private System.Windows.Forms.Label displayLabel;

      // table control containing table pages colorTabPage,
      // sizeTabPage, messageTabPage and aboutTabPage
      private System.Windows.Forms.TabControl 
         optionsTabControl;

      // table page containing color options
      private System.Windows.Forms.TabPage colorTabPage;
      private System.Windows.Forms.RadioButton 
         greenRadioButton;
      private System.Windows.Forms.RadioButton redRadioButton;
      private System.Windows.Forms.RadioButton 
         blackRadioButton;

      // table page containing font size options
      private System.Windows.Forms.TabPage sizeTabPage;
      private System.Windows.Forms.RadioButton 
         size20RadioButton;
      private System.Windows.Forms.RadioButton 
         size16RadioButton;
      private System.Windows.Forms.RadioButton 
         size12RadioButton;

      // table page containing text display options
      private System.Windows.Forms.TabPage messageTabPage;
      private System.Windows.Forms.RadioButton 
         goodByeRadioButton;
      private System.Windows.Forms.RadioButton 
         helloRadioButton;

      // table page containing about message
      private System.Windows.Forms.TabPage aboutTabPage;
      private System.Windows.Forms.Label messageLabel;
      /// <summary>
      /// Required designer variable.
      /// </summary>
      private System.ComponentModel.Container 
         components = null;

      public UsingTabs()
      {
         //
         // Required for Windows Form Designer support
         //
         InitializeComponent();
      }

      /// <summary>
      /// Clean up any resources being used.
      /// </summary>
      protected override void Dispose( bool disposing )
      {
         if( disposing )
         {
            if (components != null) 
            {
               components.Dispose();
            }
         }
         base.Dispose( disposing );
      }

		#region Windows Form Designer generated code
      /// <summary>
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// </summary>
      private void InitializeComponent()
      {
         this.displayLabel = new System.Windows.Forms.Label();
         this.optionsTabControl = new System.Windows.Forms.TabControl();
         this.colorTabPage = new System.Windows.Forms.TabPage();
         this.greenRadioButton = new System.Windows.Forms.RadioButton();
         this.redRadioButton = new System.Windows.Forms.RadioButton();
         this.blackRadioButton = new System.Windows.Forms.RadioButton();
         this.sizeTabPage = new System.Windows.Forms.TabPage();
         this.size20RadioButton = new System.Windows.Forms.RadioButton();
         this.size16RadioButton = new System.Windows.Forms.RadioButton();
         this.size12RadioButton = new System.Windows.Forms.RadioButton();
         this.messageTabPage = new System.Windows.Forms.TabPage();
         this.goodByeRadioButton = new System.Windows.Forms.RadioButton();
         this.helloRadioButton = new System.Windows.Forms.RadioButton();
         this.aboutTabPage = new System.Windows.Forms.TabPage();
         this.messageLabel = new System.Windows.Forms.Label();
         this.optionsTabControl.SuspendLayout();
         this.colorTabPage.SuspendLayout();
         this.sizeTabPage.SuspendLayout();
         this.messageTabPage.SuspendLayout();
         this.aboutTabPage.SuspendLayout();
         this.SuspendLayout();
         // 
         // displayLabel
         // 
         this.displayLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
         this.displayLabel.Location = new System.Drawing.Point(24, 192);
         this.displayLabel.Name = "displayLabel";
         this.displayLabel.Size = new System.Drawing.Size(272, 40);
         this.displayLabel.TabIndex = 3;
         this.displayLabel.Text = "Hello!";
         this.displayLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
         // 
         // optionsTabControl
         // 
         this.optionsTabControl.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                        this.colorTabPage,
                                                                                        this.sizeTabPage,
                                                                                        this.messageTabPage,
                                                                                        this.aboutTabPage});
         this.optionsTabControl.Location = new System.Drawing.Point(16, 16);
         this.optionsTabControl.Name = "optionsTabControl";
         this.optionsTabControl.SelectedIndex = 0;
         this.optionsTabControl.Size = new System.Drawing.Size(280, 168);
         this.optionsTabControl.TabIndex = 2;
         // 
         // colorTabPage
         // 
         this.colorTabPage.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                   this.greenRadioButton,
                                                                                   this.redRadioButton,
                                                                                   this.blackRadioButton});
         this.colorTabPage.Location = new System.Drawing.Point(4, 22);
         this.colorTabPage.Name = "colorTabPage";
         this.colorTabPage.Size = new System.Drawing.Size(272, 142);
         this.colorTabPage.TabIndex = 0;
         this.colorTabPage.Text = "Color";
         // 
         // greenRadioButton
         // 
         this.greenRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
         this.greenRadioButton.Location = new System.Drawing.Point(16, 104);
         this.greenRadioButton.Name = "greenRadioButton";
         this.greenRadioButton.TabIndex = 2;
         this.greenRadioButton.Text = "Green";
         this.greenRadioButton.CheckedChanged += new System.EventHandler(this.greenRadioButton_CheckedChanged);
         // 
         // redRadioButton
         // 
         this.redRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
         this.redRadioButton.Location = new System.Drawing.Point(16, 64);
         this.redRadioButton.Name = "redRadioButton";
         this.redRadioButton.TabIndex = 1;
         this.redRadioButton.Text = "Red";
         this.redRadioButton.CheckedChanged += new System.EventHandler(this.redRadioButton_CheckedChanged);
         // 
         // blackRadioButton
         // 
         this.blackRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
         this.blackRadioButton.Location = new System.Drawing.Point(16, 24);
         this.blackRadioButton.Name = "blackRadioButton";
         this.blackRadioButton.TabIndex = 0;
         this.blackRadioButton.Text = "Black";
         this.blackRadioButton.CheckedChanged += new System.EventHandler(this.blackRadioButton_CheckedChanged);
         // 
         // sizeTabPage
         // 
         this.sizeTabPage.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                                  this.size20RadioButton,
                                                                                  this.size16RadioButton,
                                                                                  this.size12RadioButton});
         this.sizeTabPage.Location = new System.Drawing.Point(4, 22);
         this.sizeTabPage.Name = "sizeTabPage";
         this.sizeTabPage.Size = new System.Drawing.Size(272, 142);
         this.sizeTabPage.TabIndex = 1;
         this.sizeTabPage.Text = "Size";
         this.sizeTabPage.Visible = false;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -