From 6946e233a85f6a93b6c2443d8cc72e7d386bf8ed Mon Sep 17 00:00:00 2001 From: lg <999544862qq.com> Date: 星期六, 14 九月 2024 11:50:58 +0800 Subject: [PATCH] 基础资料 --- DevApp/Gs.DevApp/UserControl/ShowFilter.Designer.cs | 179 ++++++++++++++++++++++ DevApp/Gs.DevApp/UserControl/ShowFilter.resx | 120 +++++++++++++++ DevApp/Gs.DevApp/UserControl/ShowFilter.cs | 128 ++++++++++++++++ 3 files changed, 427 insertions(+), 0 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/ShowFilter.Designer.cs b/DevApp/Gs.DevApp/UserControl/ShowFilter.Designer.cs new file mode 100644 index 0000000..2a1112f --- /dev/null +++ b/DevApp/Gs.DevApp/UserControl/ShowFilter.Designer.cs @@ -0,0 +1,179 @@ +锘� +namespace Gs.DevApp.UserControl +{ + partial class ShowFilter + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.gcMain = new DevExpress.XtraGrid.GridControl(); + this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView(); + this.gridColumn1 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.repositoryItemComboBox1 = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); + this.gridColumn2 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.repositoryItemComboBox2 = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); + this.gridColumn3 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.panel1 = new System.Windows.Forms.Panel(); + this.btnEsc = new DevExpress.XtraEditors.SimpleButton(); + this.btnQuery = new DevExpress.XtraEditors.SimpleButton(); + ((System.ComponentModel.ISupportInitialize)(this.gcMain)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.repositoryItemComboBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.repositoryItemComboBox2)).BeginInit(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // gcMain + // + this.gcMain.Dock = System.Windows.Forms.DockStyle.Fill; + this.gcMain.Location = new System.Drawing.Point(0, 0); + this.gcMain.MainView = this.gridView1; + this.gcMain.Name = "gcMain"; + this.gcMain.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { + this.repositoryItemComboBox1, + this.repositoryItemComboBox2}); + this.gcMain.Size = new System.Drawing.Size(511, 255); + this.gcMain.TabIndex = 0; + this.gcMain.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { + this.gridView1}); + // + // gridView1 + // + this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { + this.gridColumn1, + this.gridColumn2, + this.gridColumn3}); + this.gridView1.GridControl = this.gcMain; + this.gridView1.Name = "gridView1"; + this.gridView1.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom; + // + // gridColumn1 + // + this.gridColumn1.Caption = "瀛楁"; + this.gridColumn1.ColumnEdit = this.repositoryItemComboBox1; + this.gridColumn1.FieldName = "field"; + this.gridColumn1.MinWidth = 25; + this.gridColumn1.Name = "gridColumn1"; + this.gridColumn1.Visible = true; + this.gridColumn1.VisibleIndex = 0; + this.gridColumn1.Width = 94; + // + // repositoryItemComboBox1 + // + this.repositoryItemComboBox1.AutoHeight = false; + this.repositoryItemComboBox1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); + this.repositoryItemComboBox1.Name = "repositoryItemComboBox1"; + // + // gridColumn2 + // + this.gridColumn2.Caption = "鏉′欢"; + this.gridColumn2.ColumnEdit = this.repositoryItemComboBox2; + this.gridColumn2.FieldName = "fieldWhere"; + this.gridColumn2.MinWidth = 25; + this.gridColumn2.Name = "gridColumn2"; + this.gridColumn2.Visible = true; + this.gridColumn2.VisibleIndex = 1; + this.gridColumn2.Width = 94; + // + // repositoryItemComboBox2 + // + this.repositoryItemComboBox2.AutoHeight = false; + this.repositoryItemComboBox2.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); + this.repositoryItemComboBox2.Name = "repositoryItemComboBox2"; + // + // gridColumn3 + // + this.gridColumn3.Caption = "鍊�"; + this.gridColumn3.FieldName = "fieldValue"; + this.gridColumn3.MinWidth = 25; + this.gridColumn3.Name = "gridColumn3"; + this.gridColumn3.Visible = true; + this.gridColumn3.VisibleIndex = 2; + this.gridColumn3.Width = 94; + // + // panel1 + // + this.panel1.Controls.Add(this.btnEsc); + this.panel1.Controls.Add(this.btnQuery); + this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel1.Location = new System.Drawing.Point(0, 255); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(511, 56); + this.panel1.TabIndex = 1; + // + // btnEsc + // + this.btnEsc.Location = new System.Drawing.Point(391, 15); + this.btnEsc.Name = "btnEsc"; + this.btnEsc.Size = new System.Drawing.Size(94, 29); + this.btnEsc.TabIndex = 1; + this.btnEsc.Text = "鍙栨秷"; + // + // btnQuery + // + this.btnQuery.Location = new System.Drawing.Point(270, 15); + this.btnQuery.Name = "btnQuery"; + this.btnQuery.Size = new System.Drawing.Size(94, 29); + this.btnQuery.TabIndex = 0; + this.btnQuery.Text = "纭畾鏌ヨ"; + // + // ShowFilter + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(511, 311); + this.Controls.Add(this.gcMain); + this.Controls.Add(this.panel1); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ShowFilter"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "璇峰鍔犳煡璇㈡潯浠�"; + ((System.ComponentModel.ISupportInitialize)(this.gcMain)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.repositoryItemComboBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.repositoryItemComboBox2)).EndInit(); + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private DevExpress.XtraGrid.GridControl gcMain; + private DevExpress.XtraGrid.Views.Grid.GridView gridView1; + private System.Windows.Forms.Panel panel1; + private DevExpress.XtraEditors.SimpleButton btnEsc; + private DevExpress.XtraEditors.SimpleButton btnQuery; + private DevExpress.XtraGrid.Columns.GridColumn gridColumn1; + private DevExpress.XtraEditors.Repository.RepositoryItemComboBox repositoryItemComboBox1; + private DevExpress.XtraGrid.Columns.GridColumn gridColumn2; + private DevExpress.XtraEditors.Repository.RepositoryItemComboBox repositoryItemComboBox2; + private DevExpress.XtraGrid.Columns.GridColumn gridColumn3; + } +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/UserControl/ShowFilter.cs b/DevApp/Gs.DevApp/UserControl/ShowFilter.cs new file mode 100644 index 0000000..b3f6a17 --- /dev/null +++ b/DevApp/Gs.DevApp/UserControl/ShowFilter.cs @@ -0,0 +1,128 @@ +锘縰sing DevExpress.XtraEditors; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Collections.Generic; +using DevExpress.XtraEditors.Repository; +using DevExpress.XtraGrid.Columns; +using System.Collections; +using Gs.DevApp.ToolBox; +using static Gs.DevApp.ToolBox.UtilityHelper; + +namespace Gs.DevApp.UserControl +{ + public partial class ShowFilter : DevExpress.XtraEditors.XtraForm + { + public event EventHandler<UpdateParentEventArgs> UpdateParent; + + private GridColumnCollection _columns; + public ShowFilter(GridColumnCollection Columns) + { + this._columns = Columns; + InitializeComponent(); + this.gridView1.OptionsFind.ShowSearchNavButtons = false; + // this.gridView1.OptionsView.ShowAutoFilterRow = true; + this.gridView1.OptionsView.ShowGroupPanel = false; + this.btnEsc.Click += BtnEsc_Click; + this.btnQuery.Click += BtnQuery_Click; + getPageList(); + } + + private void BtnQuery_Click(object sender, EventArgs e) + { + UpdateParent?.Invoke(this, new UpdateParentEventArgs { Data = "hi,杩欓噷鏄煡璇㈡潯浠�" }); + this.Close(); + } + + private void BtnEsc_Click(object sender, EventArgs e) + { + this.Close(); + } + + /// <summary> + /// + /// </summary> + /// <param name="curPage">绗嚑椤�</param> + /// <param name="pageSize">姣忛〉鍑犳潯</param> + private void getPageList() + { + + repositoryItemComboBox1.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; + foreach (GridColumn col in _columns) + { + CboItemEntity item = new CboItemEntity(); + item.Text = col.Caption; + item.Value = col.FieldName; + repositoryItemComboBox1.Items.Add(item); + } + repositoryItemComboBox1.SelectedIndexChanged += RepositoryItemComboBox1_SelectedIndexChanged; + repositoryItemComboBox1.ParseEditValue += RepositoryItemComboBox1_ParseEditValue; + Dictionary<string, string> d2 = new Dictionary<string, string>(); + d2.Add(">", "澶т簬"); + d2.Add("<", "灏忎簬"); + d2.Add("=", "绛変簬"); + d2.Add("<>", "涓嶇瓑浜�"); + d2.Add("like", "鍖呭惈"); + foreach (KeyValuePair<string, string> kvp in d2) + { + CboItemEntity item = new CboItemEntity(); + item.Text = kvp.Value; + item.Value = kvp.Key; + repositoryItemComboBox2.Items.Add(item); + } + repositoryItemComboBox2.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; + repositoryItemComboBox2.SelectedIndexChanged += RepositoryItemComboBox2_SelectedIndexChanged; + repositoryItemComboBox2.ParseEditValue += RepositoryItemComboBox2_ParseEditValue; + try + { + DataTable dt = new DataTable(); + dt.Columns.Add("field", typeof(string)); + dt.Columns.Add("fieldWhere", typeof(string)); + dt.Columns.Add("fieldValue", typeof(string)); + dt.Rows.Add(dt.NewRow()); + gcMain.BindingContext = new BindingContext(); + gcMain.DataSource = dt; + gcMain.ForceInitialize(); + } + catch (Exception ex) + { + ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + } + } + + private void RepositoryItemComboBox2_ParseEditValue(object sender, DevExpress.XtraEditors.Controls.ConvertEditValueEventArgs e) + { + if (e.Value != null) + { + e.Value = e.Value.ToString(); e.Handled = true; + } + } + + private void RepositoryItemComboBox2_SelectedIndexChanged(object sender, EventArgs e) + { + } + + private void RepositoryItemComboBox1_ParseEditValue(object sender, DevExpress.XtraEditors.Controls.ConvertEditValueEventArgs e) + { + if (e.Value != null) + { + e.Value = e.Value.ToString(); e.Handled = true; + } + } + + private void RepositoryItemComboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + + } + } + + + + +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/UserControl/ShowFilter.resx b/DevApp/Gs.DevApp/UserControl/ShowFilter.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DevApp/Gs.DevApp/UserControl/ShowFilter.resx @@ -0,0 +1,120 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file -- Gitblit v1.9.3