📄 dlgchooseclient.cs
字号:
using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;using System.Data;namespace WWAM.Forms.Dlg{ public class DlgChooseClient : WWAM.Forms.Dlg.DlgBase {
#region DlgChooseClient
private DevExpress.XtraGrid.GridControl gcClient;
private DevExpress.XtraGrid.Views.Grid.GridView gvClient;
private DevExpress.XtraGrid.Columns.GridColumn gcolClientClientType;
private DevExpress.XtraGrid.Columns.GridColumn gcolClientCode;
private DevExpress.XtraGrid.Columns.GridColumn gcolClientLinkMan;
private DevExpress.XtraGrid.Columns.GridColumn gcolClientPhone;
private DevExpress.XtraGrid.Columns.GridColumn gcolClientFax;
private DevExpress.XtraGrid.Columns.GridColumn gcolClientAddress;
private DevExpress.XtraGrid.Columns.GridColumn gcolClientZipCode;
private DevExpress.XtraGrid.Columns.GridColumn gcolClientMemo; private System.ComponentModel.IContainer components = null; public DlgChooseClient() { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); // TODO: 在 InitializeComponent 调用后添加任何初始化 } public DlgChooseClient(Form form):base(form) { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); // TODO: 在 InitializeComponent 调用后添加任何初始化 } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region 设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.gcClient = new DevExpress.XtraGrid.GridControl();
this.gvClient = new DevExpress.XtraGrid.Views.Grid.GridView();
this.gcolClientClientType = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcolClientCode = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcolClientLinkMan = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcolClientPhone = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcolClientFax = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcolClientAddress = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcolClientZipCode = new DevExpress.XtraGrid.Columns.GridColumn();
this.gcolClientMemo = new DevExpress.XtraGrid.Columns.GridColumn();
((System.ComponentModel.ISupportInitialize)(this.gcClient)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gvClient)).BeginInit();
this.SuspendLayout();
//
// btnAccept
//
this.btnAccept.Location = new System.Drawing.Point(360, 328);
this.btnAccept.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
this.btnAccept.LookAndFeel.UseWindowsXPTheme = false;
this.btnAccept.Name = "btnAccept";
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(456, 328);
this.btnCancel.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
this.btnCancel.LookAndFeel.UseWindowsXPTheme = false;
this.btnCancel.Name = "btnCancel";
//
// gcClient
//
this.gcClient.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
//
// gcClient.EmbeddedNavigator
//
this.gcClient.EmbeddedNavigator.Buttons.Append.Visible = false;
this.gcClient.EmbeddedNavigator.Buttons.CancelEdit.Visible = false;
this.gcClient.EmbeddedNavigator.Buttons.Edit.Visible = false;
this.gcClient.EmbeddedNavigator.Buttons.EndEdit.Visible = false;
this.gcClient.EmbeddedNavigator.Buttons.NextPage.Visible = false;
this.gcClient.EmbeddedNavigator.Buttons.PrevPage.Visible = false;
this.gcClient.EmbeddedNavigator.Buttons.Remove.Visible = false;
this.gcClient.EmbeddedNavigator.Name = "";
this.gcClient.EmbeddedNavigator.TextStringFormat = "第 {0} 条 / 共 {1} 条";
this.gcClient.Location = new System.Drawing.Point(8, 8);
this.gcClient.MainView = this.gvClient;
this.gcClient.Name = "gcClient";
this.gcClient.Size = new System.Drawing.Size(536, 304);
this.gcClient.TabIndex = 4;
this.gcClient.UseEmbeddedNavigator = true;
this.gcClient.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.gvClient});
//
// gvClient
//
this.gvClient.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
this.gcolClientClientType,
this.gcolClientCode,
this.gcolClientLinkMan,
this.gcolClientPhone,
this.gcolClientFax,
this.gcolClientAddress,
this.gcolClientZipCode,
this.gcolClientMemo});
this.gvClient.GridControl = this.gcClient;
this.gvClient.Name = "gvClient";
this.gvClient.OptionsCustomization.AllowFilter = false;
this.gvClient.OptionsMenu.EnableFooterMenu = false;
this.gvClient.OptionsMenu.EnableGroupPanelMenu = false;
this.gvClient.OptionsView.ColumnAutoWidth = false;
this.gvClient.OptionsView.ShowGroupPanel = false;
this.gvClient.Layout += new System.EventHandler(this.View_Layout);
//
// gcolClientClientType
//
this.gcolClientClientType.Caption = "分类";
this.gcolClientClientType.FieldName = "ClientType";
this.gcolClientClientType.Name = "gcolClientClientType";
this.gcolClientClientType.Visible = true;
this.gcolClientClientType.VisibleIndex = 0;
this.gcolClientClientType.Width = 64;
//
// gcolClientCode
//
this.gcolClientCode.Caption = "客户名称";
this.gcolClientCode.FieldName = "Code";
this.gcolClientCode.Name = "gcolClientCode";
this.gcolClientCode.Visible = true;
this.gcolClientCode.VisibleIndex = 1;
this.gcolClientCode.Width = 114;
//
// gcolClientLinkMan
//
this.gcolClientLinkMan.Caption = "联系人";
this.gcolClientLinkMan.FieldName = "LinkMan";
this.gcolClientLinkMan.Name = "gcolClientLinkMan";
this.gcolClientLinkMan.Visible = true;
this.gcolClientLinkMan.VisibleIndex = 2;
this.gcolClientLinkMan.Width = 79;
//
// gcolClientPhone
//
this.gcolClientPhone.Caption = "电话";
this.gcolClientPhone.FieldName = "Phone";
this.gcolClientPhone.Name = "gcolClientPhone";
this.gcolClientPhone.Visible = true;
this.gcolClientPhone.VisibleIndex = 3;
this.gcolClientPhone.Width = 111;
//
// gcolClientFax
//
this.gcolClientFax.Caption = "传真";
this.gcolClientFax.FieldName = "Fax";
this.gcolClientFax.Name = "gcolClientFax";
this.gcolClientFax.Visible = true;
this.gcolClientFax.VisibleIndex = 4;
this.gcolClientFax.Width = 88;
//
// gcolClientAddress
//
this.gcolClientAddress.Caption = "地址";
this.gcolClientAddress.FieldName = "Address";
this.gcolClientAddress.Name = "gcolClientAddress";
this.gcolClientAddress.Visible = true;
this.gcolClientAddress.VisibleIndex = 5;
this.gcolClientAddress.Width = 165;
//
// gcolClientZipCode
//
this.gcolClientZipCode.Caption = "邮编";
this.gcolClientZipCode.FieldName = "ZipCode";
this.gcolClientZipCode.Name = "gcolClientZipCode";
this.gcolClientZipCode.Visible = true;
this.gcolClientZipCode.VisibleIndex = 6;
this.gcolClientZipCode.Width = 61;
//
// gcolClientMemo
//
this.gcolClientMemo.Caption = "备注";
this.gcolClientMemo.FieldName = "Memo";
this.gcolClientMemo.Name = "gcolClientMemo";
this.gcolClientMemo.Visible = true;
this.gcolClientMemo.VisibleIndex = 7;
this.gcolClientMemo.Width = 146;
//
// DlgChooseClient
//
this.AcceptButton = this.btnAccept;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(554, 368);
this.Controls.Add(this.gcClient);
this.Name = "DlgChooseClient";
this.Controls.SetChildIndex(this.btnCancel, 0);
this.Controls.SetChildIndex(this.btnAccept, 0);
this.Controls.SetChildIndex(this.gcClient, 0);
((System.ComponentModel.ISupportInitialize)(this.gcClient)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gvClient)).EndInit();
this.ResumeLayout(false);
} #endregion #endregion
#region Varable && Property public DataRow drClient { get { return gvClient.GetDataRow(gvClient.FocusedRowHandle); } } #endregion #region FromEvent protected override void OnFormLoad()
{
this.setLayoutFileName("ClientChoose");
this.ViewLoadLayout(this.gvClient);
}
protected override void OnFormClose()
{
this.ViewSaveLayout(this.gvClient);
}
#endregion #region CanClose protected override bool CanClose()
{
if(drClient==null)
{
this.gcClient.Focus();
return false;
}
return base.CanClose ();
}
#endregion #region OnFormShow protected override void OnFormShow()
{ base.OnFormShow (); this.gcClient.Focus(); } #endregion #region ShowDialog public DialogResult ShowDialog(string title, DataTable dtClient) { this.Text = title; this.gcClient.DataSource = dtClient; return base.ShowDialog(); } #endregion
}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -