Files
McBitFont/McBitFont/Form1.cs
2023-04-27 02:00:40 +03:00

57 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace McBitFont {
public partial class Form1 : Form {
private int cellSize = 50;
private Panel[,] dots = new Panel[255,255];
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
int i, j;
for (i = 0; i < (int)nudX.Value; i++) {
for (j = 0; j < (int)nudY.Value; j++) {
Panel p = new Panel();
p.Parent = dotPanel;
p.Width = cellSize; p.Height = cellSize;
p.BackColor = Color.White;
p.Left = 5 + i * (cellSize + 1);
p.Top = 5 + j * (cellSize + 1);
p.Tag = i.ToString() + ',' + j.ToString();
p.MouseMove += dot_MouseMove;
p.MouseDown += dot_MouseMove;
dots[i,j] = p;
}
}
}
private void dot_MouseMove(object sender, MouseEventArgs e) {
Panel p = (Panel)sender;
if (e.Button == MouseButtons.Left && p.BackColor != Color.Black) {
p.BackColor = Color.Black;
//label3.Text = "Mouse1 " + p.Tag;
//p.Update();
}
if (e.Button == MouseButtons.Right && p.BackColor != Color.White) {
p.BackColor = Color.White;
//label3.Text = "Mouse2 " + p.Tag;
}
label3.Text = "MouseMove " + p.Tag;
}
}
}