diff --git a/McBitFont.sln b/McBitFont.sln new file mode 100644 index 0000000..b724c35 --- /dev/null +++ b/McBitFont.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "McBitFont", "McBitFont\McBitFont.csproj", "{DA4DAD15-0FF6-43B6-AD42-B521DBCA34E5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DA4DAD15-0FF6-43B6-AD42-B521DBCA34E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA4DAD15-0FF6-43B6-AD42-B521DBCA34E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA4DAD15-0FF6-43B6-AD42-B521DBCA34E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA4DAD15-0FF6-43B6-AD42-B521DBCA34E5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B5570D80-5662-486E-9EEA-98EB207024D8} + EndGlobalSection +EndGlobal diff --git a/McBitFont/Form1.Designer.cs b/McBitFont/Form1.Designer.cs new file mode 100644 index 0000000..9b8caf1 --- /dev/null +++ b/McBitFont/Form1.Designer.cs @@ -0,0 +1,115 @@ +namespace McBitFont { + partial class Form1 { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + dotGrid = new DataGridView(); + button1 = new Button(); + nudX = new NumericUpDown(); + nudY = new NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)dotGrid).BeginInit(); + ((System.ComponentModel.ISupportInitialize)nudX).BeginInit(); + ((System.ComponentModel.ISupportInitialize)nudY).BeginInit(); + SuspendLayout(); + // + // dotGrid + // + dotGrid.AllowUserToAddRows = false; + dotGrid.AllowUserToDeleteRows = false; + dotGrid.AllowUserToResizeColumns = false; + dotGrid.AllowUserToResizeRows = false; + dotGrid.ClipboardCopyMode = DataGridViewClipboardCopyMode.Disable; + dotGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + dotGrid.ColumnHeadersVisible = false; + dotGrid.EditMode = DataGridViewEditMode.EditProgrammatically; + dotGrid.Location = new Point(12, 26); + dotGrid.MultiSelect = false; + dotGrid.Name = "dotGrid"; + dotGrid.ReadOnly = true; + dotGrid.RowHeadersVisible = false; + dotGrid.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; + dotGrid.RowTemplate.Height = 25; + dotGrid.SelectionMode = DataGridViewSelectionMode.CellSelect; + dotGrid.Size = new Size(639, 532); + dotGrid.TabIndex = 0; + dotGrid.TabStop = false; + dotGrid.VirtualMode = true; + dotGrid.CellMouseMove += dotGrid_CellMouseMove; + dotGrid.SelectionChanged += dotGrid_SelectionChanged; + // + // button1 + // + button1.Location = new Point(668, 41); + button1.Name = "button1"; + button1.Size = new Size(75, 23); + button1.TabIndex = 1; + button1.Text = "button1"; + button1.UseVisualStyleBackColor = true; + button1.Click += button1_Click; + // + // nudX + // + nudX.Location = new Point(724, 100); + nudX.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + nudX.Name = "nudX"; + nudX.Size = new Size(120, 23); + nudX.TabIndex = 2; + nudX.Value = new decimal(new int[] { 1, 0, 0, 0 }); + nudX.ValueChanged += nudX_ValueChanged; + // + // nudY + // + nudY.Location = new Point(724, 129); + nudY.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + nudY.Name = "nudY"; + nudY.Size = new Size(120, 23); + nudY.TabIndex = 3; + nudY.Value = new decimal(new int[] { 1, 0, 0, 0 }); + nudY.ValueChanged += nudY_ValueChanged; + // + // Form1 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(940, 643); + Controls.Add(nudY); + Controls.Add(nudX); + Controls.Add(button1); + Controls.Add(dotGrid); + Name = "Form1"; + Text = "Form1"; + Load += Form1_Load; + ((System.ComponentModel.ISupportInitialize)dotGrid).EndInit(); + ((System.ComponentModel.ISupportInitialize)nudX).EndInit(); + ((System.ComponentModel.ISupportInitialize)nudY).EndInit(); + ResumeLayout(false); + } + + #endregion + + private DataGridView dotGrid; + private Button button1; + private NumericUpDown nudX; + private NumericUpDown nudY; + } +} \ No newline at end of file diff --git a/McBitFont/Form1.cs b/McBitFont/Form1.cs new file mode 100644 index 0000000..bb1cfee --- /dev/null +++ b/McBitFont/Form1.cs @@ -0,0 +1,77 @@ +using System.Windows.Forms; + +namespace McBitFont { + public partial class Form1 : Form { + public Form1() { + InitializeComponent(); + + // Setup the grid + dotGrid.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(0xff, 0, 0, 0); + dotGrid.ColumnHeadersVisible = false; + dotGrid.RowHeadersVisible = false; + dotGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; + dotGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; + dotGrid.ColumnCount = 5; + dotGrid.RowCount = 7; + + dotGrid_updateCellSizes(); + } + + private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { + + } + + private void fillData() { + + } + + private void button1_Click(object sender, EventArgs e) { + + } + + private void dotGrid_CellMouseMove(object sender, DataGridViewCellMouseEventArgs e) { + int row = e.RowIndex; + int col = e.ColumnIndex; + DataGridViewCell cell = dotGrid.Rows[row].Cells[col]; + + if (e.Button == MouseButtons.Left && cell.Style.BackColor != Color.Black) { + cell.Style.BackColor = Color.Black; + dotGrid.InvalidateCell(col, row); + } + if (e.Button == MouseButtons.Right && cell.Style.BackColor != Color.White) { + cell.Style.BackColor = Color.White; + dotGrid.InvalidateCell(col, row); + } + dotGrid.Update(); + + } + + private void dotGrid_SelectionChanged(object sender, EventArgs e) { + dotGrid.ClearSelection(); + } + + private void dotGrid_updateCellSizes() { + for (int i = 0; i < dotGrid.ColumnCount; i++) { + dotGrid.Columns[i].Width = 50; + } + for (int i = 0; i < dotGrid.RowCount; i++) { + dotGrid.Rows[i].Height = 50; + } + } + + private void Form1_Load(object sender, EventArgs e) { + nudX.Value = dotGrid.ColumnCount; + nudY.Value = dotGrid.RowCount; + } + + private void nudX_ValueChanged(object sender, EventArgs e) { + dotGrid.ColumnCount = (int)nudX.Value; + dotGrid_updateCellSizes(); + } + + private void nudY_ValueChanged(object sender, EventArgs e) { + dotGrid.RowCount = (int)nudY.Value; + dotGrid_updateCellSizes(); + } + } +} \ No newline at end of file diff --git a/McBitFont/Form1.resx b/McBitFont/Form1.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/McBitFont/Form1.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/McBitFont/McBitFont.csproj b/McBitFont/McBitFont.csproj new file mode 100644 index 0000000..b57c89e --- /dev/null +++ b/McBitFont/McBitFont.csproj @@ -0,0 +1,11 @@ + + + + WinExe + net6.0-windows + enable + true + enable + + + \ No newline at end of file diff --git a/McBitFont/Program.cs b/McBitFont/Program.cs new file mode 100644 index 0000000..d273820 --- /dev/null +++ b/McBitFont/Program.cs @@ -0,0 +1,14 @@ +namespace McBitFont { + internal static class Program { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new Form1()); + } + } +} \ No newline at end of file