📄 stageditems.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 StagedItems : Form
{
HardwareDistributor.Controls.GradientHeaders header;
public StagedItems()
{
InitializeComponent();
// Need to adjust the column width, so that we automatically adjust to different screen
// sizes and orientations.
this.columnHeaderHardware.Width = this.stagedItemsListView.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;
// Create instance of the gradient header
header = new HardwareDistributor.Controls.GradientHeaders();
// Attach it to the listview
header.Attach(ref stagedItemsListView);
this.Controls.Add(header);
}
/// <summary>
/// Add an item to the staged items
/// </summary>
/// <param name="_quantity"></param>
/// <param name="_hardwareName"></param>
/// <param name="_newInStock"></param>
/// <param name="_inventoryId"></param>
public void Add(int _quantity, string _hardwareName, int _newInStock, int _inventoryId)
{
//Add Quantity
ListViewItem lvi = new ListViewItem(_quantity.ToString());
//Add Hardware Name
lvi.SubItems.Add(_hardwareName);
//Add In Updated Stock Amount
lvi.SubItems.Add(_newInStock.ToString());
//Add Inventory Id
lvi.SubItems.Add(_inventoryId.ToString());
//Add ListView Items to ListView
stagedItemsListView.Items.Add(lvi);
}
/// <summary>
/// The number of items in the listview
/// </summary>
public int Count
{
get
{
return stagedItemsListView.Items.Count;
}
}
/// <summary>
/// The items in the listview
/// </summary>
public ListView.ListViewItemCollection Items
{
get
{
return stagedItemsListView.Items;
}
}
/// <summary>
/// Dismiss the dialog
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void menuItemDismiss_Click(object sender, EventArgs e)
{
this.Hide();
}
// <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 + -