www.pudn.com > Fetion.rar > CustomEmotionBatchResultForm.cs


namespace Imps.Client.Pc 
{ 
    using Imps.Client.Pc.BizControls; 
    using Imps.Client.Pc.Controls; 
    using System; 
    using System.Collections.Generic; 
    using System.ComponentModel; 
    using System.Drawing; 
    using System.Windows.Forms; 
 
    public class CustomEmotionBatchResultForm : XIMDialog 
    { 
        private IList _errList; 
        private Form _parentForm; 
        private int _successCount; 
        private XButton btnOK; 
        private DataGridViewTextBoxColumn columnName; 
        private DataGridViewTextBoxColumn columnPath; 
        private IContainer components; 
        private DataGridView dgvResult; 
        private static readonly string FormTitle = "{0}个自定义表情添加成功,{1}个自定义表情添加失败。"; 
        private bool listBinded; 
        private Label lTilte; 
        private Panel panel1; 
        private UPanel upGridView; 
 
        public CustomEmotionBatchResultForm(int successCount, IList errList) : this(successCount, errList, null) 
        { 
        } 
 
        public CustomEmotionBatchResultForm(int successCount, IList errList, Form parentForm) 
        { 
            this.listBinded = true; 
            this._successCount = successCount; 
            this._errList = errList; 
            this._parentForm = parentForm; 
            this.InitializeComponent(); 
        } 
 
        private void btnOK_Click(object sender, EventArgs e) 
        { 
            base.Close(); 
        } 
 
        private void CustomEmotionBatchResultForm_FormClosed(object sender, FormClosedEventArgs e) 
        { 
            if ((this._parentForm != null) && !this._parentForm.IsDisposed) 
            { 
                this._parentForm.Close(); 
            } 
        } 
 
        private void CustomEmotionBatchResultForm_Load(object sender, EventArgs e) 
        { 
            this.lTilte.Text = string.Format(FormTitle, this._successCount, this._errList.Count); 
            this.listBinded = false; 
            try 
            { 
                this.dgvResult.Rows.Clear(); 
                this.dgvResult.RowCount = this._errList.Count + 15; 
                for (int i = 0; i < this._errList.Count; i++) 
                { 
                    DataGridViewRow row = this.dgvResult.Rows[i]; 
                    row.Tag = this._errList[i]; 
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell(); 
                    cell.Value = this._errList[i][0]; 
                    DataGridViewTextBoxCell cell2 = new DataGridViewTextBoxCell(); 
                    cell2.Value = this._errList[i][1]; 
                    row.Cells[0] = cell; 
                    row.Cells[1] = cell2; 
                } 
            } 
            catch 
            { 
            } 
            this.listBinded = true; 
        } 
 
        private void CustomEmotionBatchResultForm_Shown(object sender, EventArgs e) 
        { 
            this.btnOK.Focus(); 
        } 
 
        private void dgvResult_CellEnter(object sender, DataGridViewCellEventArgs e) 
        { 
            if (this.dgvResult.Rows[e.RowIndex].Tag == null) 
            { 
                this.btnOK.Focus(); 
            } 
        } 
 
        private void dgvResult_Enter(object sender, EventArgs e) 
        { 
            this.dgvResult.CurrentCell = this.dgvResult[0, 0]; 
        } 
 
        private void dgvResult_Scroll(object sender, ScrollEventArgs e) 
        { 
            if ((e.NewValue > (this._errList.Count - 1)) && (this._errList.Count > 0)) 
            { 
                this.dgvResult.FirstDisplayedScrollingRowIndex = this._errList.Count - 1; 
            } 
        } 
 
        private void dgvResult_SelectionChanged(object sender, EventArgs e) 
        { 
            if (this.listBinded) 
            { 
                foreach (DataGridViewRow row in this.dgvResult.SelectedRows) 
                { 
                    if (row.Tag == null) 
                    { 
                        row.Selected = false; 
                    } 
                } 
            } 
        } 
 
        protected override void Dispose(bool disposing) 
        { 
            if (disposing && (this.components != null)) 
            { 
                this.components.Dispose(); 
            } 
            base.Dispose(disposing); 
        } 
 
        private void InitializeComponent() 
        { 
            DataGridViewCellStyle style = new DataGridViewCellStyle(); 
            DataGridViewCellStyle style2 = new DataGridViewCellStyle(); 
            DataGridViewCellStyle style3 = new DataGridViewCellStyle(); 
            DataGridViewCellStyle style4 = new DataGridViewCellStyle(); 
            DataGridViewCellStyle style5 = new DataGridViewCellStyle(); 
            this.lTilte = new Label(); 
            this.btnOK = new XButton(); 
            this.panel1 = new Panel(); 
            this.upGridView = new UPanel(); 
            this.dgvResult = new DataGridView(); 
            this.columnPath = new DataGridViewTextBoxColumn(); 
            this.columnName = new DataGridViewTextBoxColumn(); 
            this.panel1.SuspendLayout(); 
            this.upGridView.SuspendLayout(); 
            ((ISupportInitialize) this.dgvResult).BeginInit(); 
            base.SuspendLayout(); 
            this.lTilte.AutoSize = true; 
            this.lTilte.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0); 
            this.lTilte.Location = new System.Drawing.Point(3, 10); 
            this.lTilte.Name = "lTilte"; 
            this.lTilte.Size = new Size(0xf9, 13); 
            this.lTilte.TabIndex = 0; 
            this.lTilte.Text = "X个自定表情添加成功,X个自定表情添加失败"; 
            this.btnOK.AutoArrangementX = true; 
            this.btnOK.AutoSizeToImage = false; 
            this.btnOK.BackColor = Color.Transparent; 
            this.btnOK.BackgroundImageDisable = null; 
            this.btnOK.BackgroundImageDown = null; 
            this.btnOK.BackgroundImageHover = null; 
            this.btnOK.ChangeSkin = true; 
            this.btnOK.DialogResult = DialogResult.Cancel; 
            this.btnOK.Location = new System.Drawing.Point(0xf4, 0x174); 
            this.btnOK.Name = "btnOK"; 
            this.btnOK.Size = new Size(0x4b, 0x19); 
            this.btnOK.TabIndex = 0; 
            this.btnOK.Text = "确定"; 
            this.btnOK.UseVisualStyleBackColor = false; 
            this.btnOK.Click += new EventHandler(this.btnOK_Click); 
            this.panel1.Controls.Add(this.upGridView); 
            this.panel1.Controls.Add(this.lTilte); 
            this.panel1.Location = new System.Drawing.Point(2, 2); 
            this.panel1.Name = "panel1"; 
            this.panel1.Size = new Size(330, 0x16c); 
            this.panel1.TabIndex = 1; 
            this.upGridView.BorderColor = Color.FromArgb(0xcb, 0xd4, 0xde); 
            this.upGridView.BorderInsideColor = Color.White; 
            this.upGridView.BorderInsideWidth = 1; 
            this.upGridView.BorderWidth = 1; 
            this.upGridView.Controls.Add(this.dgvResult); 
            this.upGridView.Location = new System.Drawing.Point(6, 0x24); 
            this.upGridView.Name = "upGridView"; 
            this.upGridView.Padding = new Padding(1); 
            this.upGridView.Size = new Size(0x141, 0x143); 
            this.upGridView.TabIndex = 0; 
            this.dgvResult.AllowUserToAddRows = false; 
            this.dgvResult.AllowUserToDeleteRows = false; 
            this.dgvResult.AllowUserToResizeColumns = false; 
            this.dgvResult.AllowUserToResizeRows = false; 
            style.BackColor = Color.White; 
            style.ForeColor = Color.Black; 
            style.SelectionBackColor = Color.FromArgb(0xa8, 0xe9, 0xfe); 
            style.SelectionForeColor = Color.Black; 
            this.dgvResult.AlternatingRowsDefaultCellStyle = style; 
            this.dgvResult.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; 
            this.dgvResult.BackgroundColor = Color.White; 
            this.dgvResult.BorderStyle = BorderStyle.None; 
            this.dgvResult.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; 
            style2.Alignment = DataGridViewContentAlignment.MiddleCenter; 
            style2.BackColor = Color.White; 
            style2.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0); 
            style2.ForeColor = SystemColors.WindowText; 
            style2.SelectionBackColor = SystemColors.Highlight; 
            style2.SelectionForeColor = SystemColors.HighlightText; 
            style2.WrapMode = DataGridViewTriState.True; 
            this.dgvResult.ColumnHeadersDefaultCellStyle = style2; 
            this.dgvResult.ColumnHeadersHeight = 0x16; 
            this.dgvResult.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; 
            this.dgvResult.Columns.AddRange(new DataGridViewColumn[] { this.columnPath, this.columnName }); 
            style3.Alignment = DataGridViewContentAlignment.MiddleLeft; 
            style3.BackColor = Color.FromArgb(0xf4, 0xf7, 0xf9); 
            style3.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0); 
            style3.ForeColor = Color.Black; 
            style3.SelectionBackColor = Color.FromArgb(0xa8, 0xe9, 0xfe); 
            style3.SelectionForeColor = Color.Black; 
            style3.WrapMode = DataGridViewTriState.False; 
            this.dgvResult.DefaultCellStyle = style3; 
            this.dgvResult.Dock = DockStyle.Fill; 
            this.dgvResult.EnableHeadersVisualStyles = false; 
            this.dgvResult.GridColor = Color.FromArgb(0xdb, 0xe8, 240); 
            this.dgvResult.Location = new System.Drawing.Point(1, 1); 
            this.dgvResult.Name = "dgvResult"; 
            this.dgvResult.ReadOnly = true; 
            this.dgvResult.RowHeadersVisible = false; 
            this.dgvResult.RowTemplate.Height = 0x17; 
            this.dgvResult.RowTemplate.ReadOnly = true; 
            this.dgvResult.ScrollBars = ScrollBars.Vertical; 
            this.dgvResult.SelectionMode = DataGridViewSelectionMode.FullRowSelect; 
            this.dgvResult.Size = new Size(0x13f, 0x141); 
            this.dgvResult.TabIndex = 0; 
            this.dgvResult.Enter += new EventHandler(this.dgvResult_Enter); 
            this.dgvResult.Scroll += new ScrollEventHandler(this.dgvResult_Scroll); 
            this.dgvResult.CellEnter += new DataGridViewCellEventHandler(this.dgvResult_CellEnter); 
            this.dgvResult.SelectionChanged += new EventHandler(this.dgvResult_SelectionChanged); 
            style4.Alignment = DataGridViewContentAlignment.MiddleCenter; 
            this.columnPath.DefaultCellStyle = style4; 
            this.columnPath.FillWeight = 200f; 
            this.columnPath.HeaderText = "图片路径"; 
            this.columnPath.Name = "columnPath"; 
            this.columnPath.ReadOnly = true; 
            this.columnPath.SortMode = DataGridViewColumnSortMode.NotSortable; 
            style5.Alignment = DataGridViewContentAlignment.MiddleCenter; 
            this.columnName.DefaultCellStyle = style5; 
            this.columnName.FillWeight = 106f; 
            this.columnName.HeaderText = "失败原因"; 
            this.columnName.Name = "columnName"; 
            this.columnName.ReadOnly = true; 
            this.columnName.SortMode = DataGridViewColumnSortMode.NotSortable; 
            base.AcceptButton = this.btnOK; 
            base.AutoScaleDimensions = new SizeF(6f, 13f); 
            base.AutoScaleMode = AutoScaleMode.Font; 
            this.BackColor = Color.White; 
            base.BaseHeight = 0x23e; 
            base.BaseWidth = 0x14c; 
            base.CancelButton = this.btnOK; 
            base.ClientSize = new Size(0x14c, 0x23e); 
            base.Controls.Add(this.panel1); 
            base.Controls.Add(this.btnOK); 
            base.DisplayLocation = new System.Drawing.Point(15, 15); 
            base.DisplaySize = new Size(0x14c, 0x23e); 
            base.FormBorderStyle = FormBorderStyle.FixedSingle; 
            base.MinimizeBox = false; 
            base.Name = "CustomEmotionBatchResultForm"; 
            base.Padding = new Padding(4, 0, 4, 0x2f); 
            base.StartPosition = FormStartPosition.CenterScreen; 
            base.Text = "Fetion 2008"; 
            base.FormClosed += new FormClosedEventHandler(this.CustomEmotionBatchResultForm_FormClosed); 
            base.Shown += new EventHandler(this.CustomEmotionBatchResultForm_Shown); 
            base.Load += new EventHandler(this.CustomEmotionBatchResultForm_Load); 
            this.panel1.ResumeLayout(false); 
            this.panel1.PerformLayout(); 
            this.upGridView.ResumeLayout(false); 
            ((ISupportInitialize) this.dgvResult).EndInit(); 
            base.ResumeLayout(false); 
        } 
    } 
}