Merge branch 'manual-drawing-attempt'

This commit is contained in:
Anton Mukhin
2023-05-03 12:58:09 +03:00
3 changed files with 220 additions and 137 deletions

View File

@@ -24,10 +24,10 @@
/// </summary> /// </summary>
private void InitializeComponent() { private void InitializeComponent() {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("adasd"); System.Windows.Forms.ListViewItem listViewItem5 = new System.Windows.Forms.ListViewItem("adasd");
System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("ddddd", 0); System.Windows.Forms.ListViewItem listViewItem6 = new System.Windows.Forms.ListViewItem("ddddd", 0);
System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem("ffff"); System.Windows.Forms.ListViewItem listViewItem7 = new System.Windows.Forms.ListViewItem("ffff");
System.Windows.Forms.ListViewItem listViewItem4 = new System.Windows.Forms.ListViewItem(""); System.Windows.Forms.ListViewItem listViewItem8 = new System.Windows.Forms.ListViewItem("");
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.dotPanel = new System.Windows.Forms.Panel(); this.dotPanel = new System.Windows.Forms.Panel();
this.nudX = new System.Windows.Forms.NumericUpDown(); this.nudX = new System.Windows.Forms.NumericUpDown();
@@ -51,6 +51,9 @@
this.miniList = new System.Windows.Forms.ListView(); this.miniList = new System.Windows.Forms.ListView();
this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.hScroll = new System.Windows.Forms.HScrollBar();
this.vScroll = new System.Windows.Forms.VScrollBar();
this.label5 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.nudX)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudY)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudY)).BeginInit();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
@@ -61,14 +64,15 @@
this.dotPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.dotPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.dotPanel.AutoScroll = true;
this.dotPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.dotPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.dotPanel.BackColor = System.Drawing.SystemColors.ControlDark; this.dotPanel.BackColor = System.Drawing.SystemColors.ControlDark;
this.dotPanel.Location = new System.Drawing.Point(12, 12); this.dotPanel.Location = new System.Drawing.Point(12, 12);
this.dotPanel.Name = "dotPanel"; this.dotPanel.Name = "dotPanel";
this.dotPanel.Size = new System.Drawing.Size(613, 542); this.dotPanel.Size = new System.Drawing.Size(593, 518);
this.dotPanel.TabIndex = 0; this.dotPanel.TabIndex = 0;
this.dotPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.dotPanel_Paint);
this.dotPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.dotPanel_MouseMove); this.dotPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.dotPanel_MouseMove);
this.dotPanel.Resize += new System.EventHandler(this.cbZoom_SelectedIndexChanged);
// //
// nudX // nudX
// //
@@ -171,6 +175,7 @@
this.cbZoom.Size = new System.Drawing.Size(59, 21); this.cbZoom.Size = new System.Drawing.Size(59, 21);
this.cbZoom.TabIndex = 6; this.cbZoom.TabIndex = 6;
this.cbZoom.TabStop = false; this.cbZoom.TabStop = false;
this.cbZoom.SelectedIndexChanged += new System.EventHandler(this.cbZoom_SelectedIndexChanged);
// //
// label4 // label4
// //
@@ -315,10 +320,10 @@
this.miniList.GridLines = true; this.miniList.GridLines = true;
this.miniList.HideSelection = false; this.miniList.HideSelection = false;
this.miniList.Items.AddRange(new System.Windows.Forms.ListViewItem[] { this.miniList.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem1, listViewItem5,
listViewItem2, listViewItem6,
listViewItem3, listViewItem7,
listViewItem4}); listViewItem8});
this.miniList.LargeImageList = this.imageList1; this.miniList.LargeImageList = this.imageList1;
this.miniList.Location = new System.Drawing.Point(634, 325); this.miniList.Location = new System.Drawing.Point(634, 325);
this.miniList.MultiSelect = false; this.miniList.MultiSelect = false;
@@ -339,6 +344,7 @@
// //
// button2 // button2
// //
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(790, 156); this.button2.Location = new System.Drawing.Point(790, 156);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23); this.button2.Size = new System.Drawing.Size(75, 23);
@@ -347,11 +353,45 @@
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click); this.button2.Click += new System.EventHandler(this.button2_Click);
// //
// hScroll
//
this.hScroll.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.hScroll.Location = new System.Drawing.Point(12, 533);
this.hScroll.Name = "hScroll";
this.hScroll.Size = new System.Drawing.Size(593, 21);
this.hScroll.TabIndex = 14;
this.hScroll.ValueChanged += new System.EventHandler(this.hScroll_ValueChanged);
//
// vScroll
//
this.vScroll.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.vScroll.LargeChange = 25;
this.vScroll.Location = new System.Drawing.Point(608, 12);
this.vScroll.Name = "vScroll";
this.vScroll.Size = new System.Drawing.Size(21, 518);
this.vScroll.TabIndex = 15;
this.vScroll.ValueChanged += new System.EventHandler(this.vScroll_ValueChanged);
//
// label5
//
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(632, 25);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(35, 13);
this.label5.TabIndex = 16;
this.label5.Text = "label5";
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(877, 566); this.ClientSize = new System.Drawing.Size(877, 566);
this.Controls.Add(this.label5);
this.Controls.Add(this.vScroll);
this.Controls.Add(this.hScroll);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.miniList); this.Controls.Add(this.miniList);
this.Controls.Add(this.outBox); this.Controls.Add(this.outBox);
@@ -402,6 +442,9 @@
private System.Windows.Forms.ListView miniList; private System.Windows.Forms.ListView miniList;
private System.Windows.Forms.ImageList imageList1; private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.HScrollBar hScroll;
private System.Windows.Forms.VScrollBar vScroll;
private System.Windows.Forms.Label label5;
} }
} }

View File

@@ -14,70 +14,70 @@ namespace McBitFont {
public partial class Form1 : Form { public partial class Form1 : Form {
struct FrameMiniature { struct FrameMiniature {
public FrameMiniature(int cc, int ww, int hh) {
code = cc;
width = ww;
height = hh;
data = new bool[ww, hh];
}
public int code; public int code;
public int width; public int width;
public int height; public int height;
public bool[,] data; public bool[,] data;
}; };
FrameMiniature f; private FrameMiniature f;
private int cellSize = 10; private int cellSize = 10;
private int dotWidth, dotHeight; private int dotWidth, dotHeight;
private Panel[,] dots = new Panel[255,255]; private int pixelOffset = 5;
private int gap;
private int w, h;
public Form1() { public Form1() {
InitializeComponent(); InitializeComponent();
this.dotPanel.MouseWheel += new MouseEventHandler(this.dotPanel_MouseWheel);
} }
private void Form1_Load(object sender, EventArgs e) { private void Form1_Load(object sender, EventArgs e) {
int i, j;
dotWidth = (int)nudX.Value; dotWidth = (int)nudX.Value;
dotHeight = (int)nudY.Value; dotHeight = (int)nudY.Value;
for (i = 0; i < dotWidth; i++) { gap = (cellSize < 5) ? 0 : 1;
for (j = 0; j < dotHeight; j++) { w = pixelOffset + dotWidth * (cellSize + gap);
Panel p = new Panel(); h = pixelOffset + dotHeight * (cellSize + gap);
dots[i,j] = NewDot(i, j);
}
}
cbZoom.SelectedIndex = 3; cbZoom.SelectedIndex = 3;
cbZoom.SelectedIndexChanged += cbZoom_SelectedIndexChanged; cbZoom.SelectedIndexChanged += cbZoom_SelectedIndexChanged;
f.code = 1; f = new FrameMiniature(1, dotWidth, dotHeight);
f.width = dotWidth;
f.height = dotHeight;
f.data = new bool[dotWidth, dotHeight];
} }
private Panel NewDot(int i, int j) { private void dotPanel_MouseWheel(object sender, MouseEventArgs e) {
Panel p = new Panel(); int t = e.Delta / 120;
p.Parent = dotPanel; if (e.Delta == 0) return;
p.Width = cellSize; p.Height = cellSize; if (ModifierKeys.HasFlag(Keys.Shift)) {
p.BackColor = Color.White; t += cbZoom.SelectedIndex;
p.BorderStyle = BorderStyle.None; if (t > cbZoom.Items.Count - 1) return;
p.Left = 5 + i * (cellSize + 1); if (t < 0) return;
p.Top = 5 + j * (cellSize + 1); cbZoom.SelectedIndex = t;
p.Tag = i.ToString() + ',' + j.ToString(); } else if (ModifierKeys.HasFlag(Keys.Control)) {
p.MouseMove += dot_MouseMove; if (hScroll.Enabled) {
p.MouseDown += dot_MouseMove; t = t * -1 * (cellSize + gap) + hScroll.Value;
//p.Paint += dotPanel_Paint; if (t < hScroll.Minimum) t = hScroll.Minimum;
return p; if (t > hScroll.Maximum) t = hScroll.Maximum;
} hScroll.Value = t;
}
private void dot_MouseMove(object sender, MouseEventArgs e) { } else {
Panel p = (Panel)sender; if (vScroll.Enabled) {
t = t * -1 * (cellSize + gap) + vScroll.Value;
if (e.Button == MouseButtons.Left && p.BackColor != Color.Black) { if (t < vScroll.Minimum) t = vScroll.Minimum;
p.BackColor = Color.Black; if (t > vScroll.Maximum) t = vScroll.Maximum;
vScroll.Value = t;
}
} }
if (e.Button == MouseButtons.Right && p.BackColor != Color.White) {
p.BackColor = Color.White;
}
label3.Text = "Over: " + p.Tag;
p.Capture = false;
} }
private void nudX_ValueChanged(object sender, EventArgs e) { private void nudX_ValueChanged(object sender, EventArgs e) {
@@ -88,157 +88,190 @@ namespace McBitFont {
dotResize(dotWidth, (int)nudY.Value); dotResize(dotWidth, (int)nudY.Value);
} }
private void dotResize(int w, int h) { private void dotResize(int ww, int hh) {
//Width int imax, jmax;
if (w > dotWidth) { bool[,] t;
for (int i = dotWidth; i < w; i++) {
for (int j = 0; j < dotHeight; j++) { if (ww < dotWidth) imax = ww;
dots[i, j] = NewDot(i, j); else imax = dotWidth;
} if (hh < dotHeight) jmax = hh;
} else jmax = dotHeight;
}
if (w < dotWidth) {
for (int i = w; i < dotWidth; i++) {
for (int j = 0; j < dotHeight; j++) {
dots[i, j].Dispose();
}
}
}
dotWidth = w;
//Height f.width = ww;
if (h > dotHeight) { f.height = hh;
for (int i = 0; i < dotWidth; i++) { t = new bool[ww, hh];
for (int j = dotHeight; j < h; j++) { for (int i=0; i<imax; i++) {
dots[i, j] = NewDot(i, j); for (int j=0; j<jmax; j++) {
} t[i, j] = f.data[i, j];
} }
} }
if (h < dotHeight) { f.data = t;
for (int i = 0; i < dotWidth; i++) { dotWidth = ww;
for (int j = h; j < dotHeight; j++) { dotHeight = hh;
dots[i, j].Dispose(); w = pixelOffset + dotWidth * (cellSize + gap);
} h = pixelOffset + dotHeight * (cellSize + gap);
} cbZoom_SelectedIndexChanged(cbZoom, null);
}
dotHeight = h;
} }
private void cbZoom_SelectedIndexChanged(object sender, EventArgs e) { private void cbZoom_SelectedIndexChanged(object sender, EventArgs e) {
cellSize = Convert.ToInt32(cbZoom.Text); cellSize = Convert.ToInt32(cbZoom.Text);
dotScale(); gap = (cellSize < 5) ? 0 : 1;
w = pixelOffset + dotWidth * (cellSize + gap);
h = pixelOffset + dotHeight * (cellSize + gap);
if (w <= dotPanel.Width) {
hScroll.Enabled = false;
hScroll.Value = 0;
} else {
hScroll.Maximum = w - dotPanel.Width + 12;
hScroll.Minimum = 0;
hScroll.Enabled = true;
}
if (h <= dotPanel.Height) {
vScroll.Enabled = false;
vScroll.Value = 0;
} else {
vScroll.Maximum = h - dotPanel.Height + 12;
vScroll.Minimum = 0;
vScroll.Enabled = true;
}
dotPanel.Refresh();
} }
private void btnShiftLeft_Click(object sender, EventArgs e) { private void btnShiftLeft_Click(object sender, EventArgs e) {
bool c;
for (int j = 0; j < dotHeight; j++) { for (int j = 0; j < dotHeight; j++) {
Color c = dots[0, j].BackColor; c = f.data[0, j];
for (int i = 0; i < dotWidth; i++) { for (int i = 0; i < dotWidth; i++) {
if (i == dotWidth - 1) { if (i == dotWidth - 1) {
dots[i, j].BackColor = c; f.data[i, j] = c;
} else { } else {
dots[i, j].BackColor = dots[i+1, j].BackColor; f.data[i, j] = f.data[i + 1, j];
} }
} }
} }
dotPanel.Refresh();
} }
private void btnShiftRight_Click(object sender, EventArgs e) { private void btnShiftRight_Click(object sender, EventArgs e) {
bool c;
for (int j = 0; j < dotHeight; j++) { for (int j = 0; j < dotHeight; j++) {
Color c = dots[dotWidth - 1, j].BackColor; c = f.data[dotWidth - 1, j];
for (int i = dotWidth-1; i >= 0; i--) { for (int i = dotWidth - 1; i >= 0; i--) {
if (i == 0) { if (i == 0) {
dots[i, j].BackColor = c; f.data[i, j] = c;
} else { } else {
dots[i, j].BackColor = dots[i - 1, j].BackColor; f.data[i, j] = f.data[i - 1, j];
} }
} }
} }
dotPanel.Refresh();
} }
private void dotPanel_MouseMove(object sender, MouseEventArgs e) { private void dotPanel_MouseMove(object sender, MouseEventArgs e) {
Panel p = (Panel)sender; if (e.X >= w || e.X <= pixelOffset || e.Y >= h || e.Y <= pixelOffset) return;
p.Capture = false; label3.Text = e.X.ToString() + ',' + e.Y.ToString();
int i = (e.X - pixelOffset + hScroll.Value) / (cellSize + gap);
int j = (e.Y - pixelOffset + vScroll.Value) / (cellSize + gap);
label5.Text = i.ToString() + ',' + j.ToString();
if (e.Button == MouseButtons.Left && !f.data[i, j]) {
Graphics g = dotPanel.CreateGraphics();
SolidBrush sbb = new SolidBrush(Color.Black);
f.data[i, j] = true;
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
g.FillRectangle(sbb, x, y, cellSize, cellSize);
}
if (e.Button == MouseButtons.Right && f.data[i, j]) {
Graphics g = dotPanel.CreateGraphics();
SolidBrush sbw = new SolidBrush(Color.White);
f.data[i, j] = false;
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
g.FillRectangle(sbw, x, y, cellSize, cellSize);
}
} }
private void btnShiftUp_Click(object sender, EventArgs e) { private void btnShiftUp_Click(object sender, EventArgs e) {
bool c;
for (int i = 0; i < dotWidth; i++) { for (int i = 0; i < dotWidth; i++) {
Color c = dots[i, 0].BackColor; c = f.data[i, 0];
for (int j = 0; j < dotHeight; j++) { for (int j = 0; j < dotHeight; j++) {
if (j == dotHeight - 1) { if (j == dotHeight - 1) {
dots[i, j].BackColor = c; f.data[i, j] = c;
} else { } else {
dots[i, j].BackColor = dots[i, j + 1].BackColor; f.data[i, j] = f.data[i, j + 1];
} }
} }
} }
dotPanel.Refresh();
} }
private void btnShiftDown_Click(object sender, EventArgs e) { private void btnShiftDown_Click(object sender, EventArgs e) {
bool c;
for (int i = 0; i < dotWidth; i++) { for (int i = 0; i < dotWidth; i++) {
Color c = dots[i, dotHeight - 1].BackColor; c = f.data[i, dotHeight - 1];
for (int j = dotHeight-1; j >= 0; j--) { for (int j = dotHeight-1; j >= 0; j--) {
if (j == 0) { if (j == 0) {
dots[i, j].BackColor = c; f.data[i, j] = c;
} else { } else {
dots[i, j].BackColor = dots[i, j - 1].BackColor; f.data[i, j] = f.data[i, j - 1];
} }
} }
} }
dotPanel.Refresh();
} }
private void btnInvert_Click(object sender, EventArgs e) { private void btnInvert_Click(object sender, EventArgs e) {
for (int i = 0; i < dotWidth; i++) { for (int i = 0; i < dotWidth; i++) {
for (int j = 0; j < dotHeight; j++) { for (int j = 0; j < dotHeight; j++) {
if (dots[i, j].BackColor == Color.White) f.data[i, j] = !f.data[i, j];
dots[i, j].BackColor = Color.Black;
else
dots[i, j].BackColor = Color.White;
} }
} }
dotPanel.Refresh();
} }
private void btnMirrorX_Click(object sender, EventArgs e) { private void btnMirrorX_Click(object sender, EventArgs e) {
int a, b, j; int a, b, j;
Color c; bool c;
for (j = 0; j < dotHeight; j++) { for (j = 0; j < dotHeight; j++) {
a = 0; a = 0;
b = dotWidth - 1; b = dotWidth - 1;
while (a < b) { while (a < b) {
c = dots[a, j].BackColor; c = f.data[a, j];
dots[a, j].BackColor = dots[b, j].BackColor; f.data[a, j] = f.data[b, j];
dots[b, j].BackColor = c; f.data[b, j] = c;
a++; a++;
b--; b--;
} }
} }
dotPanel.Refresh();
} }
private void btnMirrorY_Click(object sender, EventArgs e) { private void btnMirrorY_Click(object sender, EventArgs e) {
int a, b, i; int a, b, i;
Color c; bool c;
for (i = 0; i < dotWidth; i++) { for (i = 0; i < dotWidth; i++) {
a = 0; a = 0;
b = dotHeight - 1; b = dotHeight - 1;
while (a < b) { while (a < b) {
c = dots[i, a].BackColor; c = f.data[i, a];
dots[i, a].BackColor = dots[i, b].BackColor; f.data[i, a] = f.data[i, b];
dots[i, b].BackColor = c; f.data[i, b] = c;
a++; a++;
b--; b--;
} }
} }
dotPanel.Refresh();
} }
private void button1_Click(object sender, EventArgs e) { private void button1_Click(object sender, EventArgs e) {
for (int i = 0; i < dotWidth; i++) {
for (int j = 0; j < dotHeight; j++) {
if (dots[i, j].BackColor == Color.Black) f.data[i, j] = true;
else f.data[i, j] = false;
}
}
outBox.Clear(); outBox.Clear();
String str; String str;
Byte b = 0; Byte b = 0;
@@ -260,41 +293,48 @@ namespace McBitFont {
} }
private void button2_Click(object sender, EventArgs e) { private void button2_Click(object sender, EventArgs e) {
var bmp = new Bitmap(dotWidth, dotHeight); int picSize = (dotWidth > dotHeight) ? dotWidth : dotHeight;
var bmp = new Bitmap(picSize, picSize);
Color c;
for (int i=0; i<dotWidth; i++) { for (int i=0; i<dotWidth; i++) {
for (int j=0; j<dotHeight; j++) { for (int j=0; j<dotHeight; j++) {
bmp.SetPixel(i, j, dots[i, j].BackColor); c = f.data[i, j] ? Color.Black : Color.White;
bmp.SetPixel(i, j, c);
} }
} }
var sizedBMP = new Bitmap(bmp, new Size(50, 50));
imageList1.Images.RemoveByKey("32"); imageList1.Images.RemoveByKey("32");
imageList1.Images.Add("32", (Image)bmp); imageList1.Images.Add("32", (Image)sizedBMP);
miniList.Items[0].ImageKey = "32"; miniList.Items[0].ImageKey = "32";
bmp.Dispose(); bmp.Dispose();
sizedBMP.Dispose();
} }
private void dotScale() { private void dotPanel_Paint(object sender, PaintEventArgs e) {
bool large = dotWidth * dotHeight > 12 * 12; Graphics g = dotPanel.CreateGraphics();
int gap = (cellSize < 5) ? 0 : 1; SolidBrush sbb = new SolidBrush(Color.Black);
SolidBrush sbw = new SolidBrush(Color.White);
SolidBrush sb;
if (large) { for (int i=0; i<dotWidth; i++) {
pbZoom.Maximum = dotWidth * dotHeight; for (int j=0; j<dotHeight; j++) {
pbZoom.Value = 0; if (f.data[i, j]) sb = sbb;
pbZoom.Visible = true; else sb = sbw;
dotPanel.Visible = false; int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
} int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
for (int i = 0; i < dotWidth; i++) { g.FillRectangle(sb, x, y, cellSize, cellSize);
for (int j = 0; j < dotHeight; j++) {
dots[i, j].Width = cellSize; dots[i, j].Height = cellSize;
dots[i, j].Left = 5 + i * (cellSize + gap);
dots[i, j].Top = 5 + j * (cellSize + gap);
if (large) pbZoom.PerformStep();
} }
} }
if (large) { }
dotPanel.Visible = true;
pbZoom.Visible = false;
}
private void hScroll_ValueChanged(object sender, EventArgs e) {
label5.Text = hScroll.Value.ToString();
dotPanel.Refresh();
}
private void vScroll_ValueChanged(object sender, EventArgs e) {
label5.Text = vScroll.Value.ToString();
dotPanel.Refresh();
} }
} }

View File

@@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAA8 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAA8
BwAAAk1TRnQBSQFMAwEBAAEIAQABCAEAATIBAAEyAQAE/wEFAQAI/wFCAU0BdgcAAXYDAAEoAwAByAMA BwAAAk1TRnQBSQFMAwEBAAEwAQABMAEAATIBAAEyAQAE/wEFAQAI/wFCAU0BdgcAAXYDAAEoAwAByAMA
ATIDAAEBAQABBAUAAYgBExgAAYACAAGAAwACgAEAAYADAAGAAQABgAEAAoACAAPAAQADgAMAAf8CAAH/ ATIDAAEBAQABBAUAAYgBExgAAYACAAGAAwACgAEAAYADAAGAAQABgAEAAoACAAPAAQADgAMAAf8CAAH/
AwAC/wEAAf8DAAH/AQAB/wEAAv8CAAP//wA1AAEPAYgB8AEAAQ8BiAHwAQABDwGIAfBZAAEHAQABgAEA AwAC/wEAAf8DAAH/AQAB/wEAAv8CAAP//wA1AAEPAYgB8AEAAQ8BiAHwAQABDwGIAfBZAAEHAQABgAEA
AQcBAAFwAQABCAEAAXBZAAEHAQABgAEAAQcBAAFwAQABCAEAAXBZAAEHAQABgAEAAQcBAAFwAQABCAEA AQcBAAFwAQABCAEAAXBZAAEHAQABgAEAAQcBAAFwAQABCAEAAXBZAAEHAQABgAEAAQcBAAFwAQABCAEA