📄 sampletabcontrol.cs
字号:
// *****************************************************************************
//
// (c) Crownwood Consulting Limited 2002
// All rights reserved. The software and associated documentation
// supplied hereunder are the proprietary information of Crownwood Consulting
// Limited, Haxey, North Lincolnshire, England and are supplied subject to
// licence terms.
//
// Magic Version 1.7 www.dotnetmagic.com
// *****************************************************************************
using System;
using System.IO;
using System.Drawing;
using System.Resources;
using System.Reflection;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Crownwood.Magic.Common;
using Crownwood.Magic.Menus;
using Crownwood.Magic.Controls;
using Crownwood.Magic.Win32;
namespace SampleTabControl
{
public class SampleTabControl : System.Windows.Forms.Form
{
private static int _count = 0;
private PopupMenu _popupMenu;
private ImageList _internalImages;
private bool _update = false;
private Color _startForeColor;
private Color _startBackColor;
private Color _startButtonActive;
private Color _startButtonInactive;
private Color _startTextInactiveColor;
private Color _startHotTextColor;
private string[] _strings = new string[]{"P&roperties",
"Solution Explo&rer",
"&Task List",
"&Command Window",
"Callstack",
"B&reakpoints",
"Output"};
private System.Windows.Forms.Button addPage;
private System.Windows.Forms.Button removePage;
private System.Windows.Forms.Button clearAll;
private System.Windows.Forms.GroupBox StyleGroup;
private System.Windows.Forms.GroupBox AppearanceGroup;
private System.Windows.Forms.GroupBox exampleColors;
private System.Windows.Forms.CheckBox positionAtTop;
private System.Windows.Forms.CheckBox hotTrack;
private System.Windows.Forms.CheckBox shrinkPages;
private System.Windows.Forms.CheckBox showClose;
private System.Windows.Forms.CheckBox showArrows;
private System.Windows.Forms.CheckBox insetPlain;
private System.Windows.Forms.CheckBox insetPagesOnly;
private System.Windows.Forms.CheckBox selectedTextOnly;
private System.Windows.Forms.CheckBox hoverSelect;
private System.Windows.Forms.CheckBox idePixelBorder;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.NumericUpDown numericUpDown3;
private System.Windows.Forms.NumericUpDown numericUpDown4;
private System.Windows.Forms.RadioButton radioIDE;
private System.Windows.Forms.RadioButton radioPlain;
private System.Windows.Forms.RadioButton radioMultiBox;
private System.Windows.Forms.RadioButton radioMultiForm;
private System.Windows.Forms.RadioButton radioMultiDocument;
private System.Windows.Forms.RadioButton red;
private System.Windows.Forms.RadioButton blue;
private System.Windows.Forms.RadioButton normal;
private System.Windows.Forms.CheckBox idePixelArea;
private System.Windows.Forms.CheckBox multiLine;
private Crownwood.Magic.Controls.TabControl tabControl;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton tabHideUsingLogic;
private System.Windows.Forms.RadioButton tabHideAlways;
private System.Windows.Forms.RadioButton tabShowAlways;
private System.Windows.Forms.RadioButton tabHideWithoutMouse;
private System.Windows.Forms.CheckBox multilineFullWidth;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public SampleTabControl()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
// Create a strip of images by loading an embedded bitmap resource
_internalImages = ResourceHelper.LoadBitmapStrip(this.GetType(),
"SampleTabControl.SampleImages.bmp",
new Size(16,16),
new Point(0,0));
_popupMenu = new PopupMenu();
_popupMenu.MenuCommands.Add(new MenuCommand("Example1", _internalImages, 0));
_popupMenu.MenuCommands.Add(new MenuCommand("Example2", _internalImages, 1));
_popupMenu.MenuCommands.Add(new MenuCommand("Example3", _internalImages, 2));
tabControl.ContextPopupMenu = _popupMenu;
tabControl.ImageList = _internalImages;
// Hook into the close button
tabControl.ClosePressed += new EventHandler(OnRemovePage);
// Remember initial colors
_startForeColor = tabControl.ForeColor;
_startBackColor = tabControl.BackColor;
_startButtonActive = tabControl.ButtonActiveColor;
_startButtonInactive = tabControl.ButtonInactiveColor;
_startTextInactiveColor = tabControl.TextInactiveColor;
_startHotTextColor = tabControl.HotTextColor;
normal.Checked = true;
UpdateControls();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.selectedTextOnly = new System.Windows.Forms.CheckBox();
this.positionAtTop = new System.Windows.Forms.CheckBox();
this.radioMultiBox = new System.Windows.Forms.RadioButton();
this.removePage = new System.Windows.Forms.Button();
this.hotTrack = new System.Windows.Forms.CheckBox();
this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
this.hoverSelect = new System.Windows.Forms.CheckBox();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.radioMultiForm = new System.Windows.Forms.RadioButton();
this.showClose = new System.Windows.Forms.CheckBox();
this.shrinkPages = new System.Windows.Forms.CheckBox();
this.addPage = new System.Windows.Forms.Button();
this.clearAll = new System.Windows.Forms.Button();
this.StyleGroup = new System.Windows.Forms.GroupBox();
this.radioPlain = new System.Windows.Forms.RadioButton();
this.radioIDE = new System.Windows.Forms.RadioButton();
this.label4 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.insetPlain = new System.Windows.Forms.CheckBox();
this.insetPagesOnly = new System.Windows.Forms.CheckBox();
this.showArrows = new System.Windows.Forms.CheckBox();
this.radioMultiDocument = new System.Windows.Forms.RadioButton();
this.AppearanceGroup = new System.Windows.Forms.GroupBox();
this.exampleColors = new System.Windows.Forms.GroupBox();
this.red = new System.Windows.Forms.RadioButton();
this.blue = new System.Windows.Forms.RadioButton();
this.normal = new System.Windows.Forms.RadioButton();
this.idePixelBorder = new System.Windows.Forms.CheckBox();
this.idePixelArea = new System.Windows.Forms.CheckBox();
this.multiLine = new System.Windows.Forms.CheckBox();
this.tabControl = new Crownwood.Magic.Controls.TabControl();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tabHideWithoutMouse = new System.Windows.Forms.RadioButton();
this.tabHideUsingLogic = new System.Windows.Forms.RadioButton();
this.tabHideAlways = new System.Windows.Forms.RadioButton();
this.tabShowAlways = new System.Windows.Forms.RadioButton();
this.multilineFullWidth = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.StyleGroup.SuspendLayout();
this.AppearanceGroup.SuspendLayout();
this.exampleColors.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// selectedTextOnly
//
this.selectedTextOnly.Location = new System.Drawing.Point(176, 224);
this.selectedTextOnly.Name = "selectedTextOnly";
this.selectedTextOnly.Size = new System.Drawing.Size(120, 24);
this.selectedTextOnly.TabIndex = 1;
this.selectedTextOnly.Text = "Selected Text Only";
this.selectedTextOnly.CheckedChanged += new System.EventHandler(this.selectedTextOnly_CheckedChanged);
//
// positionAtTop
//
this.positionAtTop.Location = new System.Drawing.Point(176, 8);
this.positionAtTop.Name = "positionAtTop";
this.positionAtTop.TabIndex = 1;
this.positionAtTop.Text = "Position At Top";
this.positionAtTop.CheckedChanged += new System.EventHandler(this.positionAtTop_CheckedChanged);
//
// radioMultiBox
//
this.radioMultiBox.Location = new System.Drawing.Point(16, 64);
this.radioMultiBox.Name = "radioMultiBox";
this.radioMultiBox.Size = new System.Drawing.Size(88, 24);
this.radioMultiBox.TabIndex = 0;
this.radioMultiBox.Text = "MultiBox";
this.radioMultiBox.Click += new System.EventHandler(this.OnAppearanceMultiBox);
//
// removePage
//
this.removePage.Location = new System.Drawing.Point(424, 376);
this.removePage.Name = "removePage";
this.removePage.Size = new System.Drawing.Size(88, 24);
this.removePage.TabIndex = 0;
this.removePage.Text = "RemovePage";
this.removePage.Click += new System.EventHandler(this.OnRemovePage);
//
// hotTrack
//
this.hotTrack.Location = new System.Drawing.Point(176, 32);
this.hotTrack.Name = "hotTrack";
this.hotTrack.TabIndex = 1;
this.hotTrack.Text = "HotTrack";
this.hotTrack.CheckedChanged += new System.EventHandler(this.Highlight_CheckedChanged);
//
// numericUpDown3
//
this.numericUpDown3.Location = new System.Drawing.Point(384, 336);
this.numericUpDown3.Name = "numericUpDown3";
this.numericUpDown3.Size = new System.Drawing.Size(56, 20);
this.numericUpDown3.TabIndex = 2;
this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged);
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(384, 304);
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(56, 20);
this.numericUpDown1.TabIndex = 2;
this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
//
// numericUpDown4
//
this.numericUpDown4.Location = new System.Drawing.Point(544, 336);
this.numericUpDown4.Name = "numericUpDown4";
this.numericUpDown4.Size = new System.Drawing.Size(56, 20);
this.numericUpDown4.TabIndex = 2;
this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown4_ValueChanged);
//
// hoverSelect
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -