-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed colums trailing off the window, added large bool cells, tables …
…are now colored by depth
- Loading branch information
alex
committed
Apr 5, 2024
1 parent
fd516ba
commit 14b251e
Showing
31 changed files
with
235 additions
and
56 deletions.
There are no files selected for viewing
Binary file added
BIN
+5.46 KB
MDB/.vs/MDB/FileContentIndex/694e35d9-88bf-4c72-bc1d-0caac47735a3.vsidx
Binary file not shown.
Binary file added
BIN
+777 KB
MDB/.vs/MDB/FileContentIndex/74a166b1-a9d4-46c1-bc2e-6efa22be5ff6.vsidx
Binary file not shown.
Binary file added
BIN
+9.15 KB
MDB/.vs/MDB/FileContentIndex/91c7100b-bab4-41e5-b584-3b5691091d49.vsidx
Binary file not shown.
Binary file removed
BIN
-775 KB
MDB/.vs/MDB/FileContentIndex/fece8dbd-a5cb-4521-89b5-3d970da23adf.vsidx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-2.08 KB
(30%)
MDB/CustomTabControl/obj/x86/Debug/CustomTabControl.csproj.AssemblyReference.cache
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
MDB/CustomTabControl/obj/x86/Debug/JacksonSoft.CustomTabControl.dll
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
MDB/CustomTabControl/obj/x86/Debug/JacksonSoft.CustomTabControl.pdb
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
MDB/WindowsFormsApp1/Custom Controls/CustomDataGridViewCheckBoxCell.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
using System.Drawing; | ||
using System; | ||
using System.Windows.Forms; | ||
|
||
namespace MDB | ||
{ | ||
public class CustomDataGridViewCheckBoxCell : DataGridViewCheckBoxCell | ||
{ | ||
private Rectangle curCellBounds; | ||
private Rectangle checkBoxRect; | ||
|
||
public CustomDataGridViewCheckBoxCell() : base() { } | ||
|
||
protected override void Paint( | ||
Graphics g, | ||
Rectangle clipBounds, | ||
Rectangle cellBounds, | ||
int rowIndex, | ||
DataGridViewElementStates elementState, | ||
object value, | ||
object formattedValue, | ||
string errorText, | ||
DataGridViewCellStyle cellStyle, | ||
DataGridViewAdvancedBorderStyle advancedBorderStyle, | ||
DataGridViewPaintParts paintParts) | ||
{ | ||
// Paint default except the check box parts. | ||
var parts = paintParts & ~(DataGridViewPaintParts.ContentForeground | ||
| DataGridViewPaintParts.ContentBackground); | ||
|
||
base.Paint(g, | ||
clipBounds, | ||
cellBounds, | ||
rowIndex, | ||
elementState, | ||
value, | ||
formattedValue, | ||
errorText, | ||
cellStyle, | ||
advancedBorderStyle, | ||
parts); | ||
|
||
if (curCellBounds != cellBounds) | ||
{ | ||
// To get the box size... | ||
var col = OwningColumn as CustomDataGridViewCheckBoxColumn; | ||
|
||
curCellBounds = cellBounds; | ||
// ToDo: Use col.DefaultCellStyle.Alignment or | ||
// DataGridView.ColumnHeadersDefaultCellStyle.Alignment | ||
// to position the box. MiddleCenter here... | ||
checkBoxRect = new Rectangle( | ||
(cellBounds.Width - col.CheckBoxSize.Width) / 2 + cellBounds.X, | ||
(cellBounds.Height - col.CheckBoxSize.Height) / 2 + cellBounds.Y, | ||
col.CheckBoxSize.Width, | ||
col.CheckBoxSize.Height); | ||
} | ||
|
||
ControlPaint.DrawCheckBox(g, checkBoxRect, (bool)formattedValue | ||
? ButtonState.Checked | ButtonState.Flat | ||
: ButtonState.Flat); | ||
} | ||
|
||
// In case you don't use the `Alignment` property to position the | ||
// box. This is to disallow toggling the state if you click on the | ||
// original content area outside the drawn box. | ||
protected override void OnContentClick(DataGridViewCellEventArgs e) | ||
{ | ||
if (!ReadOnly && | ||
checkBoxRect.Contains(DataGridView.PointToClient(Cursor.Position))) | ||
base.OnContentClick(e); | ||
} | ||
|
||
protected override void OnContentDoubleClick(DataGridViewCellEventArgs e) | ||
{ | ||
if (!ReadOnly && | ||
checkBoxRect.Contains(DataGridView.PointToClient(Cursor.Position))) | ||
base.OnContentDoubleClick(e); | ||
} | ||
|
||
// Toggle the checked state by mouse clicks... | ||
protected override void OnMouseUp(DataGridViewCellMouseEventArgs e) | ||
{ | ||
base.OnMouseUp(e); | ||
|
||
if (!ReadOnly && e.Button == MouseButtons.Left && | ||
checkBoxRect.Contains(DataGridView.PointToClient(Cursor.Position))) | ||
{ | ||
Value = Value == null || !Convert.ToBoolean(Value); | ||
DataGridView.RefreshEdit(); | ||
DataGridView.NotifyCurrentCellDirty(true); | ||
} | ||
} | ||
|
||
// ... and Space key... | ||
protected override void OnKeyDown(KeyEventArgs e, int rowIndex) | ||
{ | ||
base.OnKeyDown(e, rowIndex); | ||
if (!ReadOnly && e.KeyCode == Keys.Space) | ||
{ | ||
Value = Value == null || !Convert.ToBoolean(Value.ToString()); | ||
DataGridView.RefreshEdit(); | ||
DataGridView.NotifyCurrentCellDirty(true); | ||
} | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
MDB/WindowsFormsApp1/Custom Controls/CustomDataGridViewCheckBoxColumn.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace MDB | ||
{ | ||
public class CustomDataGridViewCheckBoxColumn : DataGridViewCheckBoxColumn | ||
{ | ||
public CustomDataGridViewCheckBoxColumn() : base() => | ||
CellTemplate = new CustomDataGridViewCheckBoxCell(); | ||
|
||
public override DataGridViewCell CellTemplate | ||
{ | ||
get => base.CellTemplate; | ||
set | ||
{ | ||
if (value != null && | ||
!value.GetType().IsAssignableFrom(typeof(CustomDataGridViewCheckBoxCell))) | ||
throw new InvalidCastException("CustomDataGridViewCheckBoxCell."); | ||
|
||
base.CellTemplate = value; | ||
} | ||
} | ||
|
||
[Category("Appearance")] | ||
[DefaultValue(typeof(Size), "32, 32")] | ||
[Description("The size of the check box.")] | ||
public Size CheckBoxSize { get; set; } = new Size(32, 32); | ||
|
||
// We should copy the new properties. | ||
public override object Clone() | ||
{ | ||
var c = base.Clone() as CustomDataGridViewCheckBoxColumn; | ||
c.CheckBoxSize = CheckBoxSize; | ||
return c; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
MDB/WindowsFormsApp1/Edit Regex Refrence Table Constructor Prompt.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.