📄 formbusinesssearchresults.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>
/// Summary description for FormSearchResults.
/// </summary>
public class FormBusinessSearchResults : System.Windows.Forms.Form, IDisposable
{
private MenuItem menuMapIt;
private MenuItem menuCancel;
private ComboBox comboBox;
private Label lblAddressAndPhone;
/// <summary>
/// Main menu for the form.
/// </summary>
private System.Windows.Forms.MainMenu mainMenu1;
public FormBusinessSearchResults(ArrayList searchResults)
{
InitializeComponent();
DpiHelper.AdjustAllControls(this);
this.comboBox.DataSource = searchResults;
this.comboBox.DisplayMember = "Name";
}
/// <summary>
/// The search result the user has selected.
/// </summary>
public BusinessSearchResult SearchResult
{
get { return (BusinessSearchResult) comboBox.SelectedItem; }
}
/// <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.menuMapIt = new System.Windows.Forms.MenuItem();
this.menuCancel = new System.Windows.Forms.MenuItem();
this.comboBox = new System.Windows.Forms.ComboBox();
this.lblAddressAndPhone = new System.Windows.Forms.Label();
//
// mainMenu1
//
this.mainMenu1.MenuItems.Add(this.menuMapIt);
this.mainMenu1.MenuItems.Add(this.menuCancel);
//
// menuMapIt
//
this.menuMapIt.Text = "Map It";
this.menuMapIt.Click += new System.EventHandler(this.menuMapIt_Click);
//
// menuCancel
//
this.menuCancel.Text = "Cancel";
this.menuCancel.Click += new System.EventHandler(this.menuCancel_Click);
//
// comboBox
//
this.comboBox.Location = new System.Drawing.Point(4, 4);
this.comboBox.Size = new System.Drawing.Size(168, 24);
this.comboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);
//
// lblAddressAndPhone
//
this.lblAddressAndPhone.Font = new System.Drawing.Font("Segoe Condensed", 11F, System.Drawing.FontStyle.Regular);
this.lblAddressAndPhone.Location = new System.Drawing.Point(4, 35);
this.lblAddressAndPhone.Size = new System.Drawing.Size(168, 111);
//
// FormBusinessSearchResults
//
this.ClientSize = new System.Drawing.Size(176, 180);
this.Controls.Add(this.lblAddressAndPhone);
this.Controls.Add(this.comboBox);
this.Menu = this.mainMenu1;
this.Text = "Search Results";
this.Load += new System.EventHandler(this.FormBusinessSearchResults_Load);
}
#endregion
private void menuMapIt_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
private void menuCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{
lblAddressAndPhone.Text = SearchResult.Address + "\n" + SearchResult.Phone;
}
private void FormBusinessSearchResults_Load(object sender, EventArgs e)
{
// Use full width of the screen.
int w = this.Width - DpiHelper.Scale(8);
comboBox.Width = w;
lblAddressAndPhone.Width = w;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -