Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- using System.Drawing;
- using System.IO;
- namespace WindowsFormsApp1
- {
- partial class Form1
- {
- private System.ComponentModel.IContainer components = null;
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
- private void InitializeComponent()
- {
- //загрузка кнопок
- this.buttonsMap = LoadButtons("buttons.txt");
- this.components = new System.ComponentModel.Container();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- this.SuspendLayout();
- //
- // imageList1
- //
- this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // pictureBox1
- //
- this.pictureBox1.Image = global::WindowsFormsApp2.Properties.Resources.кока;
- this.pictureBox1.Location = new System.Drawing.Point(-1, -1);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(1709, 936);
- this.pictureBox1.TabIndex = 1;
- this.pictureBox1.TabStop = false;
- this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.DrawLinePoints);
- //
- // Form1
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1370, 749);
- this.Controls.Add(this.pictureBox1);
- this.Name = "Form1";
- this.Text = "Form1";
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- this.ResumeLayout(false);
- }
- public System.Windows.Forms.Button[] LoadButtons(string path)
- {
- var text = File.ReadAllText(path).Split('\n');
- var result = new System.Windows.Forms.Button[text.Length];
- for (int i = 0; i < text.Length; i++)
- {
- var str = text[i].Split(' ');
- var point = new Point(int.Parse(str[0]), int.Parse(str[1]));
- result[i] = CreateButton(point, i);
- }
- return result;
- }
- private System.Windows.Forms.Button CreateButton(Point point, int buttonIndex)
- {
- var button = new System.Windows.Forms.Button();
- button.Location = point;
- button.Size = new Size(27, 25);
- button.TabIndex = buttonIndex + 3;
- button.Tag = buttonIndex;
- button.Name = "button" + buttonIndex.ToString();
- button.Text = buttonIndex.ToString();
- button.UseVisualStyleBackColor = true;
- button.Click += new System.EventHandler(this.ButtonMap_Click);
- this.Controls.Add(button);
- return button;
- }
- private System.Windows.Forms.ImageList imageList1;
- private System.Windows.Forms.PictureBox pictureBox1;
- private System.Windows.Forms.Button[] buttonsMap;
- }
- }
Add Comment
Please, Sign In to add comment