diff --git a/Stealth.Winform/MainFOrm.Designer.cs b/Stealth.Winform/MainFOrm.Designer.cs index d2e6479..0f1ee03 100644 --- a/Stealth.Winform/MainFOrm.Designer.cs +++ b/Stealth.Winform/MainFOrm.Designer.cs @@ -29,6 +29,10 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.dataGridView_WindowList = new System.Windows.Forms.DataGridView(); + this.hWnd = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Title = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.isModified = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.isRemoved = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.button_Refresh = new System.Windows.Forms.Button(); this.groupBox_WindowDetail = new System.Windows.Forms.GroupBox(); this.tableLayoutPanel_WindowDetail = new System.Windows.Forms.TableLayoutPanel(); @@ -49,10 +53,6 @@ private void InitializeComponent() this.removedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.hWnd = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Title = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.isModified = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.isRemoved = new System.Windows.Forms.DataGridViewCheckBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_WindowList)).BeginInit(); this.groupBox_WindowDetail.SuspendLayout(); this.tableLayoutPanel_WindowDetail.SuspendLayout(); @@ -88,8 +88,46 @@ private void InitializeComponent() this.dataGridView_WindowList.ShowRowErrors = false; this.dataGridView_WindowList.Size = new System.Drawing.Size(479, 201); this.dataGridView_WindowList.TabIndex = 0; + this.dataGridView_WindowList.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dataGridView_WindowList_CellFormatting); this.dataGridView_WindowList.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_WindowList_RowEnter); // + // hWnd + // + this.hWnd.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.hWnd.DataPropertyName = "hWnd"; + this.hWnd.HeaderText = "hWnd"; + this.hWnd.Name = "hWnd"; + this.hWnd.ReadOnly = true; + this.hWnd.Width = 54; + // + // Title + // + this.Title.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.Title.DataPropertyName = "windowTitle"; + this.Title.HeaderText = "Title"; + this.Title.Name = "Title"; + this.Title.ReadOnly = true; + // + // isModified + // + this.isModified.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; + this.isModified.DataPropertyName = "isModified"; + this.isModified.HeaderText = "Modified"; + this.isModified.MinimumWidth = 25; + this.isModified.Name = "isModified"; + this.isModified.ReadOnly = true; + this.isModified.Width = 25; + // + // isRemoved + // + this.isRemoved.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; + this.isRemoved.DataPropertyName = "isRemoved"; + this.isRemoved.HeaderText = "Removed"; + this.isRemoved.MinimumWidth = 25; + this.isRemoved.Name = "isRemoved"; + this.isRemoved.ReadOnly = true; + this.isRemoved.Width = 25; + // // button_Refresh // this.button_Refresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -313,43 +351,6 @@ private void InitializeComponent() this.aboutToolStripMenuItem.Text = "&About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // - // hWnd - // - this.hWnd.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.hWnd.DataPropertyName = "hWnd"; - this.hWnd.HeaderText = "hWnd"; - this.hWnd.Name = "hWnd"; - this.hWnd.ReadOnly = true; - this.hWnd.Width = 54; - // - // Title - // - this.Title.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.Title.DataPropertyName = "windowTitle"; - this.Title.HeaderText = "Title"; - this.Title.Name = "Title"; - this.Title.ReadOnly = true; - // - // isModified - // - this.isModified.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; - this.isModified.DataPropertyName = "isModified"; - this.isModified.HeaderText = "Modified"; - this.isModified.MinimumWidth = 25; - this.isModified.Name = "isModified"; - this.isModified.ReadOnly = true; - this.isModified.Width = 25; - // - // isRemoved - // - this.isRemoved.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; - this.isRemoved.DataPropertyName = "isRemoved"; - this.isRemoved.HeaderText = "Removed"; - this.isRemoved.MinimumWidth = 25; - this.isRemoved.Name = "isRemoved"; - this.isRemoved.ReadOnly = true; - this.isRemoved.Width = 25; - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); diff --git a/Stealth.Winform/MainFOrm.resx b/Stealth.Winform/MainFOrm.resx index 94e4766..df3183b 100644 --- a/Stealth.Winform/MainFOrm.resx +++ b/Stealth.Winform/MainFOrm.resx @@ -132,16 +132,4 @@ 17, 17 - - True - - - True - - - True - - - True - \ No newline at end of file diff --git a/Stealth.Winform/MainForm.cs b/Stealth.Winform/MainForm.cs index fd2b4ae..4900393 100644 --- a/Stealth.Winform/MainForm.cs +++ b/Stealth.Winform/MainForm.cs @@ -90,20 +90,20 @@ private void WindowListFilter() !((modifiedToolStripMenuItem.Checked && !c.isModified) //hide removed || (removedToolStripMenuItem.Checked && c.isRemoved)) - + // logic: - //{ - // //show modified only - // if (modifiedToolStripMenuItem.Checked) - // if (!c.isModified) - // return false; + //{ + // //show modified only + // if (modifiedToolStripMenuItem.Checked) + // if (!c.isModified) + // return false; // //hide removed - // if (removedToolStripMenuItem.Checked) - // if (c.isRemoved) - // return false; - // return true; - //} + // if (removedToolStripMenuItem.Checked) + // if (c.isRemoved) + // return false; + // return true; + //} ) .ToList(); @@ -133,15 +133,31 @@ private void dataGridView_WindowList_RowEnter(object sender, DataGridViewCellEve } //style - DataGridViewCellStyle isRemovedStyle = new DataGridViewCellStyle() + private void dataGridView_WindowList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { - ForeColor = Color.Gray - }; + if (e.RowIndex > 0) + { + if (e.ColumnIndex == dataGridView_WindowList.Columns["isModified"].Index) + { + if ((bool)(e.Value)) + { + dataGridView_WindowList.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightGreen; + } + } - DataGridViewCellStyle isModifiedStyle = new DataGridViewCellStyle() - { - BackColor = Color.LightYellow - }; + if (e.ColumnIndex == dataGridView_WindowList.Columns["isRemoved"].Index) + { + if ((bool)(e.Value)) + { + var cellStyle = dataGridView_WindowList.Rows[e.RowIndex].DefaultCellStyle; + cellStyle.ForeColor = Color.Gray; + if (cellStyle.Font == null) + cellStyle.Font = dataGridView_WindowList.DefaultCellStyle.Font; + cellStyle.Font = new Font(cellStyle.Font, FontStyle.Strikeout); + } + } + } + } #endregion @@ -204,9 +220,6 @@ private void aboutToolStripMenuItem_Click(object sender, EventArgs e) } #endregion - - - } public class WindowComparer : IEqualityComparer