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

📄 optionsdialog.cs

📁 一个C#加上flowchart控件的例程
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace FlowCharter
{
	/// <summary>
	/// Summary description for OptionsDialog.
	/// </summary>
	public class OptionsDialog : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label _backColorLabel;
		private System.Windows.Forms.Label _nodeColorLabel;
		private System.Windows.Forms.CheckBox _showAnchorsCheck;
		private System.Windows.Forms.Label _anchorColorLabel;
		private System.Windows.Forms.Label _anchorStyleLabel;
		private System.Windows.Forms.GroupBox _anchorsGroup;
		private System.Windows.Forms.Button _cancelBtn;
		private System.Windows.Forms.Button _okBtn;
		private System.Windows.Forms.ToolBar _anchorStyleToolbar;
		private System.Windows.Forms.ImageList _anchorStyleImageList;
		private System.Windows.Forms.ToolBarButton _circleBtn;
		private System.Windows.Forms.ToolBarButton _rectBtn;
		private System.Windows.Forms.ToolBarButton _xBtn;
		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.Label _connectorColorLabel;
		private System.Windows.Forms.PictureBox _lowerPane;
		private System.Windows.Forms.Panel _buttonPanel;
		private System.Windows.Forms.Label _anchorColorHidden;
		private System.Windows.Forms.Label _backColorHidden;
		private System.Windows.Forms.Label _nodeColorHidden;
		private System.Windows.Forms.Label _connectorColorHidden;

		private FlowCharter.ColorPicker _anchorColorPicker;
		private FlowCharter.ColorPicker _backColorPicker;
		private FlowCharter.ColorPicker _nodeColorPicker;
		private FlowCharter.ColorPicker _connectorColorPicker;

		private bool _showGrid;
		private Color _backColor;
		private Color _nodeColor;
		private Color _connectorColor;

		private bool _showAnchors;
		private Color _anchorColor;
		private System.Windows.Forms.ColorDialog _colorDialog;
		private System.Windows.Forms.CheckBox _showGridCheck;
		private int _anchorStyle;


		public bool ShowGrid
		{
			get { return _showGrid; }
			set { _showGrid = value; }
		}
		public Color BackgroundColor
		{
			get { return _backColor; }
			set { _backColor = value; }
		}
		public Color NodeColor
		{
			get { return _nodeColor; }
			set { _nodeColor = value; }
		}
		public Color ConnectorColor
		{
			get { return _connectorColor; }
			set { _connectorColor = value; }
		}

		public bool ShowAnchors
		{
			get { return _showAnchors; }
			set { _showAnchors = value; }
		}
		public Color AnchorColor
		{
			get { return _anchorColor; }
			set { _anchorColor = value; }
		}
		public int AnchorStyle
		{
			get { return _anchorStyle; }
			set { _anchorStyle = value; }
		}


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

		private void OnLoad(object sender, System.EventArgs e)
		{
			_showGridCheck.Checked = ShowGrid;

			_anchorColorPicker = new ColorPicker();
			_anchorColorPicker.Color = AnchorColor;
			_anchorColorPicker.Location = _anchorColorHidden.Location;
			_anchorColorPicker.Size = _anchorColorHidden.Size;
			_anchorColorPicker.Click += new System.EventHandler(this.AnchorColorPicker_OnClick);

			_backColorPicker = new ColorPicker();
			_backColorPicker.Color = BackgroundColor;
			_backColorPicker.Location = _backColorHidden.Location;
			_backColorPicker.Size = _backColorHidden.Size;
			_backColorPicker.Click += new System.EventHandler(this.BackColorPicker_OnClick);

			_nodeColorPicker = new ColorPicker();
			_nodeColorPicker.Color = NodeColor;
			_nodeColorPicker.Location = _nodeColorHidden.Location;
			_nodeColorPicker.Size = _nodeColorHidden.Size;
			_nodeColorPicker.Click += new System.EventHandler(this.NodeColorPicker_OnClick);

			_connectorColorPicker = new ColorPicker();
			_connectorColorPicker.Color = ConnectorColor;
			_connectorColorPicker.Location = _connectorColorHidden.Location;
			_connectorColorPicker.Size = _connectorColorHidden.Size;
			_connectorColorPicker.Click += new System.EventHandler(this.ConnectorColorPicker_OnClick);

			_anchorsGroup.Controls.Add(_anchorColorPicker);
			this.Controls.Add(_backColorPicker);
			this.Controls.Add(_nodeColorPicker);
			this.Controls.Add(_connectorColorPicker);

			// Initialize controls' values
			_showAnchorsCheck.Checked = ShowAnchors;
			_circleBtn.Pushed = (AnchorStyle == 0);
			_rectBtn.Pushed = (AnchorStyle == 1);
			_xBtn.Pushed = (AnchorStyle == 2);
		}

		/// <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.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(OptionsDialog));
			this._backColorLabel = new System.Windows.Forms.Label();
			this._nodeColorLabel = new System.Windows.Forms.Label();
			this._connectorColorLabel = new System.Windows.Forms.Label();
			this._showAnchorsCheck = new System.Windows.Forms.CheckBox();
			this._anchorColorLabel = new System.Windows.Forms.Label();
			this._anchorStyleLabel = new System.Windows.Forms.Label();
			this._anchorsGroup = new System.Windows.Forms.GroupBox();
			this._anchorColorHidden = new System.Windows.Forms.Label();
			this._buttonPanel = new System.Windows.Forms.Panel();
			this._anchorStyleToolbar = new System.Windows.Forms.ToolBar();
			this._circleBtn = new System.Windows.Forms.ToolBarButton();
			this._rectBtn = new System.Windows.Forms.ToolBarButton();
			this._xBtn = new System.Windows.Forms.ToolBarButton();
			this._anchorStyleImageList = new System.Windows.Forms.ImageList(this.components);
			this._cancelBtn = new System.Windows.Forms.Button();
			this._lowerPane = new System.Windows.Forms.PictureBox();
			this._okBtn = new System.Windows.Forms.Button();
			this._backColorHidden = new System.Windows.Forms.Label();
			this._nodeColorHidden = new System.Windows.Forms.Label();
			this._connectorColorHidden = new System.Windows.Forms.Label();
			this._colorDialog = new System.Windows.Forms.ColorDialog();
			this._showGridCheck = new System.Windows.Forms.CheckBox();
			this._anchorsGroup.SuspendLayout();
			this._buttonPanel.SuspendLayout();
			this.SuspendLayout();
			// 
			// _backColorLabel
			// 
			this._backColorLabel.Location = new System.Drawing.Point(8, 42);
			this._backColorLabel.Name = "_backColorLabel";
			this._backColorLabel.Size = new System.Drawing.Size(106, 16);
			this._backColorLabel.TabIndex = 0;
			this._backColorLabel.Text = "Background color:";
			// 
			// _nodeColorLabel
			// 
			this._nodeColorLabel.Location = new System.Drawing.Point(8, 66);
			this._nodeColorLabel.Name = "_nodeColorLabel";
			this._nodeColorLabel.Size = new System.Drawing.Size(106, 16);
			this._nodeColorLabel.TabIndex = 1;
			this._nodeColorLabel.Text = "Node fill color:";
			// 
			// _connectorColorLabel
			// 
			this._connectorColorLabel.Location = new System.Drawing.Point(8, 90);
			this._connectorColorLabel.Name = "_connectorColorLabel";
			this._connectorColorLabel.Size = new System.Drawing.Size(106, 16);
			this._connectorColorLabel.TabIndex = 2;
			this._connectorColorLabel.Text = "Connector fill color:";
			// 
			// _showAnchorsCheck
			// 
			this._showAnchorsCheck.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this._showAnchorsCheck.Location = new System.Drawing.Point(16, 24);
			this._showAnchorsCheck.Name = "_showAnchorsCheck";
			this._showAnchorsCheck.Size = new System.Drawing.Size(104, 16);
			this._showAnchorsCheck.TabIndex = 4;
			this._showAnchorsCheck.Text = "Show anchors";
			// 
			// _anchorColorLabel
			// 
			this._anchorColorLabel.Location = new System.Drawing.Point(16, 48);
			this._anchorColorLabel.Name = "_anchorColorLabel";
			this._anchorColorLabel.Size = new System.Drawing.Size(72, 16);
			this._anchorColorLabel.TabIndex = 5;
			this._anchorColorLabel.Text = "Anchor color:";
			// 
			// _anchorStyleLabel
			// 
			this._anchorStyleLabel.Location = new System.Drawing.Point(16, 72);
			this._anchorStyleLabel.Name = "_anchorStyleLabel";
			this._anchorStyleLabel.Size = new System.Drawing.Size(72, 16);
			this._anchorStyleLabel.TabIndex = 5;
			this._anchorStyleLabel.Text = "Anchor style:";
			// 
			// _anchorsGroup

⌨️ 快捷键说明

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