📄 searchform.cs
字号:
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Sun188.iSBus.Common;
using Sun188.iSBus.DataAccess;
namespace Sun188.iSBus.WinUI
{
/// <summary>
/// SearchForm 的摘要说明。
/// </summary>
public class SearchForm : System.Windows.Forms.Form
{
#region 控件定义===============================================
private System.Windows.Forms.Panel plLeft;
private System.Windows.Forms.PictureBox pictureBox8;
private System.Windows.Forms.Panel plMain;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label lbTitle;
private System.Windows.Forms.Panel plToolbar;
private System.Windows.Forms.ImageList imageList2;
private System.Windows.Forms.Panel plBotton;
private System.Windows.Forms.PictureBox pictureBox12;
private System.Windows.Forms.PictureBox pictureBox11;
private System.Windows.Forms.PictureBox pictureBox10;
private System.Windows.Forms.ImageList imageList3;
private System.Windows.Forms.Panel plTop;
private System.Windows.Forms.PictureBox btnClose;
private System.Windows.Forms.PictureBox btnMax;
private System.Windows.Forms.PictureBox btnMin;
private System.Windows.Forms.PictureBox pictureBox7;
private System.Windows.Forms.PictureBox pictureBox6;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Timer tmClock;
private System.Windows.Forms.Panel plRight;
private System.Windows.Forms.PictureBox pictureBox9;
private System.Windows.Forms.ToolBar toolBar1;
private System.Windows.Forms.ToolBarButton tbtnHelp;
private System.Windows.Forms.ToolBarButton tbtnAbout;
private System.Windows.Forms.ToolBarButton tbtnClose;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.Timer timerShow;
private System.Windows.Forms.Timer timerHide;
#endregion
#region 字段定义===============================================
/// <summary>
/// 当前CityID
/// </summary>
private int cityID;
/// <summary>
/// 总的记录数
/// </summary>
private int totalRecordCount = 0;
/// <summary>
/// 鼠标的位置
/// </summary>
private int xPos,yPos;
/// <summary>
/// 鼠标偏移坐标
/// </summary>
private Point m_pOffset;
/// <summary>
/// 窗体的位置
/// </summary>
private Point locationMain = new Point(300,250);
/// <summary>
/// 最小按钮图片
/// </summary>
private Bitmap btnMinBmp;
/// <summary>
/// 关闭按钮图片
/// </summary>
private Bitmap btnCloseBmp;
/// <summary>
/// 最小按钮是否是MouseOver事件
/// </summary>
private bool btnMinMouseOver = false;
/// <summary>
/// 最小按钮是否是MouseDown事件
/// </summary>
private bool btnMinMouseDown = false;
/// <summary>
/// 关闭按钮是否是MouseOver事件
/// </summary>
private bool btnCloseMouseOver = false;
/// <summary>
/// 关闭按钮是否是MouseDown事件
/// </summary>
private bool btnCloseMouseDown = false;
/// <summary>
/// 搜索按钮图片
/// </summary>
private Bitmap btnSerachBmp;
/// <summary>
/// 搜索按钮鼠标事件
/// </summary>
private bool btnSearchOver = false;
private bool btnSearchDown = false;
private DataSet dsStop;
public MainForm mMainForm;
public int searchID = 0;
private double hideForm = 1;
private System.Windows.Forms.ColumnHeader StopDescription;
private System.Windows.Forms.ColumnHeader StopName;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.StatusBarPanel statusBarPanel1;
private System.Windows.Forms.StatusBarPanel statusBarPanel2;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.TextBox txbSearch;
private System.Windows.Forms.PictureBox btnSearch;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.ListView lVStopList;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private double showForm = 0;
#endregion
#region 窗体加载事件处理=======================================
private void SearchForm_Load(object sender, System.EventArgs e)
{
this.timerShow.Enabled = true;
//取回cityID
this.cityID = MainForm.cityID;
//获取当前汽车经过的站点列表
this.GetStopList();
//统计信息
this.StatisticInfo();
//取动计时器
this.tmClock.Enabled = true;
//状态栏处理
this.StatusBar();
//设置最小化关闭按钮
this.DrawButton(1);
this.DrawButton(2);
}
#endregion
#region 清理资源===============================================
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region Windows Form Designer generated code===================
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(SearchForm));
this.plLeft = new System.Windows.Forms.Panel();
this.pictureBox8 = new System.Windows.Forms.PictureBox();
this.plMain = new System.Windows.Forms.Panel();
this.panel8 = new System.Windows.Forms.Panel();
this.lVStopList = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.panel7 = new System.Windows.Forms.Panel();
this.txbSearch = new System.Windows.Forms.TextBox();
this.btnSearch = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.lbTitle = new System.Windows.Forms.Label();
this.plToolbar = new System.Windows.Forms.Panel();
this.toolBar1 = new System.Windows.Forms.ToolBar();
this.tbtnHelp = new System.Windows.Forms.ToolBarButton();
this.tbtnAbout = new System.Windows.Forms.ToolBarButton();
this.tbtnClose = new System.Windows.Forms.ToolBarButton();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.imageList2 = new System.Windows.Forms.ImageList(this.components);
this.plBotton = new System.Windows.Forms.Panel();
this.pictureBox12 = new System.Windows.Forms.PictureBox();
this.pictureBox11 = new System.Windows.Forms.PictureBox();
this.pictureBox10 = new System.Windows.Forms.PictureBox();
this.imageList3 = new System.Windows.Forms.ImageList(this.components);
this.plTop = new System.Windows.Forms.Panel();
this.btnClose = new System.Windows.Forms.PictureBox();
this.btnMax = new System.Windows.Forms.PictureBox();
this.btnMin = new System.Windows.Forms.PictureBox();
this.pictureBox7 = new System.Windows.Forms.PictureBox();
this.pictureBox6 = new System.Windows.Forms.PictureBox();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.tmClock = new System.Windows.Forms.Timer(this.components);
this.plRight = new System.Windows.Forms.Panel();
this.pictureBox9 = new System.Windows.Forms.PictureBox();
this.timerShow = new System.Windows.Forms.Timer(this.components);
this.timerHide = new System.Windows.Forms.Timer(this.components);
this.StopDescription = new System.Windows.Forms.ColumnHeader();
this.StopName = new System.Windows.Forms.ColumnHeader();
this.plLeft.SuspendLayout();
this.plMain.SuspendLayout();
this.panel8.SuspendLayout();
this.panel7.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
this.panel1.SuspendLayout();
this.panel3.SuspendLayout();
this.plToolbar.SuspendLayout();
this.plBotton.SuspendLayout();
this.plTop.SuspendLayout();
this.plRight.SuspendLayout();
this.SuspendLayout();
//
// plLeft
//
this.plLeft.Controls.AddRange(new System.Windows.Forms.Control[] {
this.pictureBox8});
this.plLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.plLeft.Location = new System.Drawing.Point(0, 26);
this.plLeft.Name = "plLeft";
this.plLeft.Size = new System.Drawing.Size(4, 320);
this.plLeft.TabIndex = 7;
//
// pictureBox8
//
this.pictureBox8.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox8.BackgroundImage")));
this.pictureBox8.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox8.Name = "pictureBox8";
this.pictureBox8.Size = new System.Drawing.Size(4, 320);
this.pictureBox8.TabIndex = 0;
this.pictureBox8.TabStop = false;
//
// plMain
//
this.plMain.Controls.AddRange(new System.Windows.Forms.Control[] {
this.panel8,
this.panel7,
this.panel2,
this.panel1,
this.plToolbar});
this.plMain.Location = new System.Drawing.Point(0, 26);
this.plMain.Name = "plMain";
this.plMain.Size = new System.Drawing.Size(428, 318);
this.plMain.TabIndex = 8;
//
// panel8
//
this.panel8.Controls.AddRange(new System.Windows.Forms.Control[] {
this.lVStopList});
this.panel8.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel8.Location = new System.Drawing.Point(0, 76);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(428, 220);
this.panel8.TabIndex = 7;
//
// lVStopList
//
this.lVStopList.Activation = System.Windows.Forms.ItemActivation.OneClick;
this.lVStopList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2});
this.lVStopList.Cursor = System.Windows.Forms.Cursors.Default;
this.lVStopList.FullRowSelect = true;
this.lVStopList.GridLines = true;
this.lVStopList.Location = new System.Drawing.Point(6, 4);
this.lVStopList.MultiSelect = false;
this.lVStopList.Name = "lVStopList";
this.lVStopList.Size = new System.Drawing.Size(420, 214);
this.lVStopList.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.lVStopList.TabIndex = 10;
this.lVStopList.View = System.Windows.Forms.View.Details;
this.lVStopList.SelectedIndexChanged += new System.EventHandler(this.lVStopList_SelectedIndexChanged);
//
// columnHeader1
//
this.columnHeader1.Text = "站点名称";
this.columnHeader1.Width = 200;
//
// columnHeader2
//
this.columnHeader2.Text = "站点详细描述";
this.columnHeader2.Width = 300;
//
// panel7
//
this.panel7.Controls.AddRange(new System.Windows.Forms.Control[] {
this.txbSearch,
this.btnSearch,
this.label1});
this.panel7.Dock = System.Windows.Forms.DockStyle.Top;
this.panel7.Location = new System.Drawing.Point(0, 48);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(428, 28);
this.panel7.TabIndex = 6;
//
// txbSearch
//
this.txbSearch.Location = new System.Drawing.Point(44, 3);
this.txbSearch.Name = "txbSearch";
this.txbSearch.Size = new System.Drawing.Size(172, 21);
this.txbSearch.TabIndex = 11;
this.txbSearch.Text = "";
//
// btnSearch
//
this.btnSearch.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left);
this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSearch.Image = ((System.Drawing.Bitmap)(resources.GetObject("btnSearch.Image")));
this.btnSearch.Location = new System.Drawing.Point(221, 4);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(40, 18);
this.btnSearch.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.btnSearch.TabIndex = 10;
this.btnSearch.TabStop = false;
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
this.btnSearch.MouseMove += new System.Windows.Forms.MouseEventHandler(this.btnSearch_MouseMove);
this.btnSearch.MouseLeave += new System.EventHandler(this.btnSearch_MouseLeave);
this.btnSearch.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnSearch_MouseDown);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(4, 6);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(42, 14);
this.label1.TabIndex = 0;
this.label1.Text = "关键字";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// panel2
//
this.panel2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.statusBar1});
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(0, 296);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(428, 22);
this.panel2.TabIndex = 2;
//
// statusBar1
//
this.statusBar1.Name = "statusBar1";
this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -