📄 loaded.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace HardwareDistributor.UI
{
public partial class Loaded : Form
{
private HardwareDistributor.Controls.GradientHeaders header;
public Loaded()
{
InitializeComponent();
// Need to adjust the column width, so that we automatically adjust to different screen
// sizes and orientations.
this.columnHeaderHardware.Width = this.loadedItemsListView.Width - this.columnHeaderQty.Width - 4;
// We are removing both the Control Box and the Minimize Box, so that we don't
// have to handle these in our code. This is not necessary in Windows Mobile Standard,
// but we are writing this code so that it works on all platforms without any changes
// or any recompiling.
this.ControlBox = false;
this.MinimizeBox = false;
AttachHeader();
}
private void AttachHeader()
{
// Create instance of the gradient header
header = new HardwareDistributor.Controls.GradientHeaders();
// Attach it to the listview
header.Attach(ref loadedItemsListView);
this.Controls.Add(header);
}
/// <summary>
/// Add the loaded item to the listview to be displayed
/// </summary>
/// <param name="_quantity"></param>
/// <param name="_hardwareName"></param>
/// <param name="_inventoryId"></param>
public void Add(int _quantity, string _hardwareName, int _inventoryId)
{
//Add Quantity
ListViewItem lvi = new ListViewItem(_quantity.ToString());
//Add Hardware Name
lvi.SubItems.Add(_hardwareName);
//Add Inventory Id
lvi.SubItems.Add(_inventoryId.ToString());
//Add ListView Items to ListView
loadedItemsListView.Items.Add(lvi);
}
/// <summary>
/// Number of items in the listview
/// </summary>
public int Count
{
get
{
return loadedItemsListView.Items.Count;
}
}
/// <summary>
/// Dismiss Soft Key click
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItemDismiss_Click(object sender, EventArgs e)
{
this.Close();
}
// <summary>
/// Custom Handling for the back key
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BackKeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == System.Windows.Forms.Keys.Back))
{
// Back
// if the back key is hit, close this dialog
this.Close();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -