📄 formbusiness.cs
字号:
// Copyright (c) Jason Fuller.
//
// Use of this source code is subject to the terms of the license found in the
// file License.txt. If you did not accept the terms of that license, you are
// not authorized to use this source code.
#region Using directives
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
#endregion
namespace PocketEarth
{
/// <summary>
/// The form that lets the user choose a business or business category
/// to search for within the current map.
/// </summary>
public class FormBusiness : System.Windows.Forms.Form, IDisposable
{
private Label label1;
private TextBox txtBusiness;
private MenuItem menuDone;
private MenuItem menuCancel;
/// <summary>
/// The lasy business that was searched for.
/// </summary>
private static string business;
private Label label2;
/// <summary>
/// Main menu for the form.
/// </summary>
private System.Windows.Forms.MainMenu mainMenu1;
/// <summary>
/// The business or business category to search for.
/// </summary>
public string Business
{
get { return txtBusiness.Text; }
}
public FormBusiness()
{
InitializeComponent();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
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.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuDone = new System.Windows.Forms.MenuItem();
this.menuCancel = new System.Windows.Forms.MenuItem();
this.label1 = new System.Windows.Forms.Label();
this.txtBusiness = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
//
// mainMenu1
//
this.mainMenu1.MenuItems.Add(this.menuDone);
this.mainMenu1.MenuItems.Add(this.menuCancel);
//
// menuDone
//
this.menuDone.Text = "Done";
this.menuDone.Click += new System.EventHandler(this.menuDone_Click);
//
// menuCancel
//
this.menuCancel.Text = "Cancel";
this.menuCancel.Click += new System.EventHandler(this.menuCancel_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(3, 10);
this.label1.Size = new System.Drawing.Size(170, 55);
this.label1.Text = "Enter the name of a business or business category:";
//
// txtBusiness
//
this.txtBusiness.Location = new System.Drawing.Point(4, 76);
this.txtBusiness.Size = new System.Drawing.Size(169, 24);
//
// label2
//
this.label2.Location = new System.Drawing.Point(3, 113);
this.label2.Size = new System.Drawing.Size(170, 55);
this.label2.Text = "Virtual Earth will search within the current map.";
//
// FormBusiness
//
this.ClientSize = new System.Drawing.Size(176, 180);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtBusiness);
this.Controls.Add(this.label2);
this.Menu = this.mainMenu1;
this.Text = "Find a Business";
this.Load += new System.EventHandler(this.FormBusiness_Load);
}
#endregion
private void menuCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void menuDone_Click(object sender, EventArgs e)
{
// Remember the last business the user chose.
business = txtBusiness.Text;
this.DialogResult = DialogResult.OK;
this.Close();
}
private void FormBusiness_Load(object sender, EventArgs e)
{
DpiHelper.AdjustAllControls(this);
// Fill in the last business the user searched for.
txtBusiness.Text = business;
txtBusiness.Focus();
txtBusiness.SelectAll();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -