📄 btprogressdlg.cs
字号:
//Filename : BTProgressDlg.cs
//Part of : Phone Navigator C# example
//Description : Dialog for showing progress when searching for Bluetooth devices
//Version : 3.2
//
//This example is only to be used with PC Connectivity API version 3.2.
//Compability ("as is") with future versions is not quaranteed.
//
//Copyright (c) 2005-2007 Nokia Corporation.
//
//This material, including but not limited to documentation and any related
//computer programs, is protected by intellectual property rights of Nokia
//Corporation and/or its licensors.
//All rights are reserved. Reproducing, modifying, translating, or
//distributing any or all of this material requires the prior written consent
//of Nokia Corporation. Nokia Corporation retains the right to make changes
//to this material at any time without notice. A copyright license is hereby
//granted to download and print a copy of this material for personal use only.
//No other license to any other intellectual property rights is granted. The
//material is provided "as is" without warranty of any kind, either express or
//implied, including without limitation, any warranty of non-infringement,
//merchantability and fitness for a particular purpose. In no event shall
//Nokia Corporation be liable for any direct, indirect, special, incidental,
//or consequential loss or damages, including but not limited to, lost profits
//or revenue,loss of use, cost of substitute program, or loss of data or
//equipment arising out of the use or inability to use the material, even if
//Nokia Corporation has been advised of the likelihood of such damages occurring.
using System.Windows.Forms;
namespace CSPhoneNavigator.NET
{
public class FRM_ProgressDlg : System.Windows.Forms.Form
{
private bool m_bCancelled = false;
#region " Windows Form Designer generated code "
public FRM_ProgressDlg()
: base()
{
//This call is required by the Windows Form Designer.
InitializeComponent();
//Add any initialization after the InitializeComponent() call
}
//Form overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
if (disposing)
{
if ((components != null))
{
components.Dispose();
}
}
base.Dispose(disposing);
}
//Required by the Windows Form Designer
private System.ComponentModel.IContainer components;
//NOTE: The following procedure is required by the Windows Form Designer
//It can be modified using the Windows Form Designer.
//Do not modify it using the code editor.
internal System.Windows.Forms.Button BTN_Cancel;
internal System.Windows.Forms.Label LBL_Searching;
internal System.Windows.Forms.ProgressBar ProgressBar1;
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FRM_ProgressDlg));
this.BTN_Cancel = new System.Windows.Forms.Button();
this.LBL_Searching = new System.Windows.Forms.Label();
this.ProgressBar1 = new System.Windows.Forms.ProgressBar();
this.SuspendLayout();
//
// BTN_Cancel
//
this.BTN_Cancel.Location = new System.Drawing.Point(296, 8);
this.BTN_Cancel.Name = "BTN_Cancel";
this.BTN_Cancel.Size = new System.Drawing.Size(72, 24);
this.BTN_Cancel.TabIndex = 13;
this.BTN_Cancel.Text = "Cancel";
this.BTN_Cancel.Click += new System.EventHandler(this.BTN_Cancel_Click);
//
// LBL_Searching
//
this.LBL_Searching.Location = new System.Drawing.Point(8, 16);
this.LBL_Searching.Name = "LBL_Searching";
this.LBL_Searching.Size = new System.Drawing.Size(224, 16);
this.LBL_Searching.TabIndex = 14;
this.LBL_Searching.Text = "Searching bluetooth devices...";
//
// ProgressBar1
//
this.ProgressBar1.Location = new System.Drawing.Point(8, 40);
this.ProgressBar1.Name = "ProgressBar1";
this.ProgressBar1.Size = new System.Drawing.Size(360, 8);
this.ProgressBar1.TabIndex = 15;
//
// FRM_ProgressDlg
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(378, 56);
this.Controls.Add(this.ProgressBar1);
this.Controls.Add(this.LBL_Searching);
this.Controls.Add(this.BTN_Cancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FRM_ProgressDlg";
this.Text = "Searching Devices";
this.ResumeLayout(false);
}
#endregion
//===================================================================
// SetProgress
//
// Sets progress bar state
//
//===================================================================
public void SetProgress(int iState)
{
ProgressBar1.Value = iState;
}
//===================================================================
// IsCancelled
//
// Returns true if user has clicked Cancel button
//
//===================================================================
public bool IsCancelled()
{
bool functionReturnValue = false;
Application.DoEvents();
functionReturnValue = m_bCancelled;
// reset search cancel flag.
m_bCancelled = false;
return functionReturnValue;
}
//===================================================================
// BTN_Cancel_Click
//
// User has clicked Cancel button to cancel current operation
//===================================================================
private void BTN_Cancel_Click(object sender, System.EventArgs e)
{
m_bCancelled = true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -