Example #1
0
        private void BackgroundWorkerLoadColor_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            if (!IsDisposed && IsHandleCreated)
            {
                foreach (var color in _loadedPalette)
                {
                    try
                    {
                        var _color = new BufferedPanel()
                        {
                            Width       = 32,
                            Height      = 32,
                            BorderStyle = BorderStyle.FixedSingle,
                            BackColor   = color,
                            Cursor      = Cursors.Hand
                        };
                        toolTipColor.SetToolTip(_color, color.ToHEX());
                        _color.Click       += _color_Click;
                        _color.DoubleClick += _color_DoubleClick;

                        object data = new Control[] { _color };
                        (e.Argument as FlowLayoutPanel).Invoke(new AddItemsDelegate(FlowLayoutPanel_Invoke), data);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message);
                    }
                }
            }
        }
        public HoverUI()
        {
            this.Shapes = new List <Shape>();

            Form.CheckForIllegalCrossThreadCalls = false;
            this.FormBorderStyle     = FormBorderStyle.None;
            this.Size                = Screen.PrimaryScreen.WorkingArea.Size;
            this.StartPosition       = FormStartPosition.Manual;
            this.Location            = new Point(0, 0);
            this.TopMost             = true;
            this.AllowTransparency   = true;
            this.BackColor           = Color.FromArgb(196, 255, 226);
            this.TransparencyKey     = Color.FromArgb(196, 255, 226);
            this.ShowIcon            = false;
            this.ShowInTaskbar       = false;
            this.OriginalWindowStyle = (IntPtr)((long)Interoperator.GetWindowLong(this.Handle, -20));
            this.PassthruWindowStyle = (IntPtr)((long)(uint)((int)Interoperator.GetWindowLong(this.Handle, -20) | 524288 | 32));
            this.SetWindowPassthru(true);

            this.canvas           = new BufferedPanel();
            this.canvas.Dock      = DockStyle.Fill;
            this.canvas.BackColor = Color.Transparent;
            this.canvas.BringToFront();
            this.canvas.Paint += CanvasRender;
            this.Controls.Add(this.canvas);
        }
Example #3
0
        private void FormSwatches_Load(object sender, EventArgs e)
        {
            foreach (var item in Properties.Settings.Default.History)
            {
                var color = Color.FromArgb(int.Parse(item));

                var labelColor = new Label
                {
                    //
                    // labelColor
                    //
                    Dock      = DockStyle.Right,
                    AutoSize  = true,
                    Text      = color.ToHEX().ToUpper(),
                    ForeColor = color.Invert(),
                };
                labelColor.MouseClick       += new MouseEventHandler(Panel_MouseClick);
                labelColor.MouseDoubleClick += new MouseEventHandler(Panel_MouseDoubleClick);

                var panelItem = new BufferedPanel()
                {
                    //
                    // panelItem
                    //
                    Cursor    = Cursors.Hand,
                    Dock      = DockStyle.Top,
                    Padding   = new Padding(6),
                    Size      = new Size(192, 32),
                    BackColor = color
                };

                panelItem.Controls.Add(labelColor);
                panelItem.MouseClick       += new MouseEventHandler(Panel_MouseClick);
                panelItem.MouseDoubleClick += new MouseEventHandler(Panel_MouseDoubleClick);

                this.Controls.Add(panelItem);
            }

            panelOptions.SendToBack();

            // Resolution fix
            if (Height > FormHelper.GetWorkingArea().Height)
            {
                Height = MinimumSize.Height;
            }

            comboBoxColorMode.SelectedIndex = 0;
        }
        public Splash_Animation()
        {
            InitializeComponent();

            this.WindowState   = FormWindowState.Normal;
            this.StartPosition = FormStartPosition.CenterScreen;

            panel = new BufferedPanel();

            loader = new Loader(panel);

            //this.Controls.Add(panel);
            //panel.Location = new Point(350, 0);
            //panel.BackColor = System.Drawing.Color.Transparent;
            //panel.BringToFront();
        }
Example #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (logo1 == null)
     {
         logo1 = new BufferedPanel();
         logo1.Location = new System.Drawing.Point(105, 29);
         logo1.Name = "logo1";
         logo1.Size = new System.Drawing.Size(160, 200);
         logo1.TabIndex = 0;
         this.Controls.Add(logo1);
     }
     else
     {
         this.Controls.Remove(logo1);
         logo1 = null;
     }
 }
Example #6
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.generateButton = new System.Windows.Forms.Button();
            this.pointsPanel = new SampleApp.BufferedPanel();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.showInactiveCheck = new System.Windows.Forms.CheckBox();
            this.showConnectionsCheck = new System.Windows.Forms.CheckBox();
            this.mapPanel = new SampleApp.BufferedPanel();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.stopButton = new System.Windows.Forms.Button();
            this.startButton = new System.Windows.Forms.Button();
            this.currentIterationBox = new System.Windows.Forms.TextBox();
            this.label8 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.radiusBox = new System.Windows.Forms.TextBox();
            this.label4 = new System.Windows.Forms.Label();
            this.rateBox = new System.Windows.Forms.TextBox();
            this.label5 = new System.Windows.Forms.Label();
            this.iterationsBox = new System.Windows.Forms.TextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.sizeBox = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBox3.SuspendLayout();
            this.SuspendLayout();
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.generateButton);
            this.groupBox1.Controls.Add(this.pointsPanel);
            this.groupBox1.Location = new System.Drawing.Point(16, 15);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(352, 431);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Points";
            // 
            // generateButton
            // 
            this.generateButton.Location = new System.Drawing.Point(16, 380);
            this.generateButton.Name = "generateButton";
            this.generateButton.Size = new System.Drawing.Size(120, 34);
            this.generateButton.TabIndex = 1;
            this.generateButton.Text = "&Generate";
            this.generateButton.Click += new System.EventHandler(this.generateButton_Click);
            // 
            // pointsPanel
            // 
            this.pointsPanel.BackColor = System.Drawing.Color.White;
            this.pointsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pointsPanel.Location = new System.Drawing.Point(16, 29);
            this.pointsPanel.Name = "pointsPanel";
            this.pointsPanel.Size = new System.Drawing.Size(320, 293);
            this.pointsPanel.TabIndex = 0;
            this.pointsPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.pointsPanel_Paint);
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.showInactiveCheck);
            this.groupBox2.Controls.Add(this.showConnectionsCheck);
            this.groupBox2.Controls.Add(this.mapPanel);
            this.groupBox2.Location = new System.Drawing.Point(384, 15);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(352, 431);
            this.groupBox2.TabIndex = 1;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Map";
            // 
            // showInactiveCheck
            // 
            this.showInactiveCheck.Checked = true;
            this.showInactiveCheck.CheckState = System.Windows.Forms.CheckState.Checked;
            this.showInactiveCheck.Location = new System.Drawing.Point(16, 387);
            this.showInactiveCheck.Name = "showInactiveCheck";
            this.showInactiveCheck.Size = new System.Drawing.Size(256, 24);
            this.showInactiveCheck.TabIndex = 2;
            this.showInactiveCheck.Text = "Show Inactive Neurons";
            this.showInactiveCheck.CheckedChanged += new System.EventHandler(this.showInactiveCheck_CheckedChanged);
            // 
            // showConnectionsCheck
            // 
            this.showConnectionsCheck.Checked = true;
            this.showConnectionsCheck.CheckState = System.Windows.Forms.CheckState.Checked;
            this.showConnectionsCheck.Location = new System.Drawing.Point(16, 351);
            this.showConnectionsCheck.Name = "showConnectionsCheck";
            this.showConnectionsCheck.Size = new System.Drawing.Size(240, 23);
            this.showConnectionsCheck.TabIndex = 1;
            this.showConnectionsCheck.Text = "Show Connections";
            this.showConnectionsCheck.CheckedChanged += new System.EventHandler(this.showConnectionsCheck_CheckedChanged);
            // 
            // mapPanel
            // 
            this.mapPanel.BackColor = System.Drawing.Color.White;
            this.mapPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.mapPanel.Location = new System.Drawing.Point(16, 29);
            this.mapPanel.Name = "mapPanel";
            this.mapPanel.Size = new System.Drawing.Size(320, 293);
            this.mapPanel.TabIndex = 0;
            this.mapPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.mapPanel_Paint);
            // 
            // groupBox3
            // 
            this.groupBox3.Controls.Add(this.stopButton);
            this.groupBox3.Controls.Add(this.startButton);
            this.groupBox3.Controls.Add(this.currentIterationBox);
            this.groupBox3.Controls.Add(this.label8);
            this.groupBox3.Controls.Add(this.label7);
            this.groupBox3.Controls.Add(this.radiusBox);
            this.groupBox3.Controls.Add(this.label4);
            this.groupBox3.Controls.Add(this.rateBox);
            this.groupBox3.Controls.Add(this.label5);
            this.groupBox3.Controls.Add(this.iterationsBox);
            this.groupBox3.Controls.Add(this.label6);
            this.groupBox3.Controls.Add(this.label3);
            this.groupBox3.Controls.Add(this.label2);
            this.groupBox3.Controls.Add(this.sizeBox);
            this.groupBox3.Controls.Add(this.label1);
            this.groupBox3.Location = new System.Drawing.Point(752, 15);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(288, 431);
            this.groupBox3.TabIndex = 2;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "Neural Network";
            // 
            // stopButton
            // 
            this.stopButton.Enabled = false;
            this.stopButton.Location = new System.Drawing.Point(152, 380);
            this.stopButton.Name = "stopButton";
            this.stopButton.Size = new System.Drawing.Size(120, 34);
            this.stopButton.TabIndex = 16;
            this.stopButton.Text = "S&top";
            this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
            // 
            // startButton
            // 
            this.startButton.Location = new System.Drawing.Point(16, 380);
            this.startButton.Name = "startButton";
            this.startButton.Size = new System.Drawing.Size(120, 34);
            this.startButton.TabIndex = 15;
            this.startButton.Text = "&Start";
            this.startButton.Click += new System.EventHandler(this.startButton_Click);
            // 
            // currentIterationBox
            // 
            this.currentIterationBox.Location = new System.Drawing.Point(176, 234);
            this.currentIterationBox.Name = "currentIterationBox";
            this.currentIterationBox.ReadOnly = true;
            this.currentIterationBox.Size = new System.Drawing.Size(96, 26);
            this.currentIterationBox.TabIndex = 14;
            // 
            // label8
            // 
            this.label8.Location = new System.Drawing.Point(16, 237);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(160, 23);
            this.label8.TabIndex = 13;
            this.label8.Text = "Curren iteration:";
            // 
            // label7
            // 
            this.label7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.label7.Location = new System.Drawing.Point(16, 216);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(256, 3);
            this.label7.TabIndex = 12;
            // 
            // radiusBox
            // 
            this.radiusBox.Location = new System.Drawing.Point(176, 175);
            this.radiusBox.Name = "radiusBox";
            this.radiusBox.Size = new System.Drawing.Size(96, 26);
            this.radiusBox.TabIndex = 11;
            // 
            // label4
            // 
            this.label4.Location = new System.Drawing.Point(16, 178);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(160, 24);
            this.label4.TabIndex = 10;
            this.label4.Text = "Initial radius:";
            // 
            // rateBox
            // 
            this.rateBox.Location = new System.Drawing.Point(176, 139);
            this.rateBox.Name = "rateBox";
            this.rateBox.Size = new System.Drawing.Size(96, 26);
            this.rateBox.TabIndex = 9;
            // 
            // label5
            // 
            this.label5.Location = new System.Drawing.Point(16, 142);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(160, 23);
            this.label5.TabIndex = 8;
            this.label5.Text = "Initial learning rate:";
            // 
            // iterationsBox
            // 
            this.iterationsBox.Location = new System.Drawing.Point(176, 102);
            this.iterationsBox.Name = "iterationsBox";
            this.iterationsBox.Size = new System.Drawing.Size(96, 26);
            this.iterationsBox.TabIndex = 7;
            // 
            // label6
            // 
            this.label6.Location = new System.Drawing.Point(16, 105);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(96, 24);
            this.label6.TabIndex = 6;
            this.label6.Text = "Iteraions:";
            // 
            // label3
            // 
            this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.label3.Location = new System.Drawing.Point(16, 88);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(256, 3);
            this.label3.TabIndex = 3;
            // 
            // label2
            // 
            this.label2.Location = new System.Drawing.Point(16, 60);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(240, 22);
            this.label2.TabIndex = 2;
            this.label2.Text = "(neurons count = size * size)";
            // 
            // sizeBox
            // 
            this.sizeBox.Location = new System.Drawing.Point(176, 29);
            this.sizeBox.Name = "sizeBox";
            this.sizeBox.Size = new System.Drawing.Size(96, 26);
            this.sizeBox.TabIndex = 1;
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(16, 32);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(86, 24);
            this.label1.TabIndex = 0;
            this.label1.Text = "Size:";
            // 
            // MainForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
            this.ClientSize = new System.Drawing.Size(1054, 468);
            this.Controls.Add(this.groupBox3);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.Name = "MainForm";
            this.Text = "Kohonen SOM 2D Organizing";
            this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing);
            this.groupBox1.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            this.ResumeLayout(false);

        }
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.generateButton = new System.Windows.Forms.Button();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.mapPanel = new SOMOrganizing.BufferedPanel();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.textBoxHashCodeMultiplier = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.textBoxCoordsMultiplier = new System.Windows.Forms.TextBox();
            this.CoordsMultiplier = new System.Windows.Forms.Label();
            this.textBoxTypeMultiplier = new System.Windows.Forms.TextBox();
            this.TypeMultiplier = new System.Windows.Forms.Label();
            this.textBoxAngleMultiplier = new System.Windows.Forms.TextBox();
            this.AngleMultiplier = new System.Windows.Forms.Label();
            this.label11 = new System.Windows.Forms.Label();
            this.stopButton = new System.Windows.Forms.Button();
            this.startButton = new System.Windows.Forms.Button();
            this.currentIterationBox = new System.Windows.Forms.TextBox();
            this.label8 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.radiusBox = new System.Windows.Forms.TextBox();
            this.label4 = new System.Windows.Forms.Label();
            this.rateBox = new System.Windows.Forms.TextBox();
            this.label5 = new System.Windows.Forms.Label();
            this.iterationsBox = new System.Windows.Forms.TextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.label9 = new System.Windows.Forms.Label();
            this.textBoxQueryPerson = new System.Windows.Forms.TextBox();
            this.groupBox2.SuspendLayout();
            this.groupBox3.SuspendLayout();
            this.SuspendLayout();
            // 
            // generateButton
            // 
            this.generateButton.Location = new System.Drawing.Point(590, 53);
            this.generateButton.Name = "generateButton";
            this.generateButton.Size = new System.Drawing.Size(75, 23);
            this.generateButton.TabIndex = 1;
            this.generateButton.Text = "Clear";
            this.generateButton.Click += new System.EventHandler(this.generateButton_Click);
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.mapPanel);
            this.groupBox2.Location = new System.Drawing.Point(12, 12);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(448, 488);
            this.groupBox2.TabIndex = 1;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Input finger";
            // 
            // mapPanel
            // 
            this.mapPanel.BackColor = System.Drawing.Color.White;
            this.mapPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.mapPanel.Location = new System.Drawing.Point(6, 20);
            this.mapPanel.Name = "mapPanel";
            this.mapPanel.Size = new System.Drawing.Size(431, 460);
            this.mapPanel.TabIndex = 0;
            this.mapPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.mapPanel_Paint);
            // 
            // groupBox3
            // 
            this.groupBox3.Controls.Add(this.textBoxHashCodeMultiplier);
            this.groupBox3.Controls.Add(this.label2);
            this.groupBox3.Controls.Add(this.textBoxCoordsMultiplier);
            this.groupBox3.Controls.Add(this.CoordsMultiplier);
            this.groupBox3.Controls.Add(this.textBoxTypeMultiplier);
            this.groupBox3.Controls.Add(this.TypeMultiplier);
            this.groupBox3.Controls.Add(this.textBoxAngleMultiplier);
            this.groupBox3.Controls.Add(this.AngleMultiplier);
            this.groupBox3.Controls.Add(this.label11);
            this.groupBox3.Controls.Add(this.stopButton);
            this.groupBox3.Controls.Add(this.startButton);
            this.groupBox3.Controls.Add(this.currentIterationBox);
            this.groupBox3.Controls.Add(this.label8);
            this.groupBox3.Controls.Add(this.label7);
            this.groupBox3.Controls.Add(this.radiusBox);
            this.groupBox3.Controls.Add(this.label4);
            this.groupBox3.Controls.Add(this.rateBox);
            this.groupBox3.Controls.Add(this.label5);
            this.groupBox3.Controls.Add(this.iterationsBox);
            this.groupBox3.Controls.Add(this.label6);
            this.groupBox3.Controls.Add(this.label3);
            this.groupBox3.Location = new System.Drawing.Point(483, 113);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(180, 387);
            this.groupBox3.TabIndex = 2;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "Neural Network";
            // 
            // textBoxHashCodeMultiplier
            // 
            this.textBoxHashCodeMultiplier.Location = new System.Drawing.Point(107, 126);
            this.textBoxHashCodeMultiplier.Name = "textBoxHashCodeMultiplier";
            this.textBoxHashCodeMultiplier.Size = new System.Drawing.Size(60, 20);
            this.textBoxHashCodeMultiplier.TabIndex = 25;
            // 
            // label2
            // 
            this.label2.Location = new System.Drawing.Point(7, 118);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(100, 34);
            this.label2.TabIndex = 24;
            this.label2.Text = "HashCode multiplier:";
            // 
            // textBoxCoordsMultiplier
            // 
            this.textBoxCoordsMultiplier.Location = new System.Drawing.Point(107, 93);
            this.textBoxCoordsMultiplier.Name = "textBoxCoordsMultiplier";
            this.textBoxCoordsMultiplier.Size = new System.Drawing.Size(60, 20);
            this.textBoxCoordsMultiplier.TabIndex = 23;
            // 
            // CoordsMultiplier
            // 
            this.CoordsMultiplier.Location = new System.Drawing.Point(7, 95);
            this.CoordsMultiplier.Name = "CoordsMultiplier";
            this.CoordsMultiplier.Size = new System.Drawing.Size(100, 16);
            this.CoordsMultiplier.TabIndex = 22;
            this.CoordsMultiplier.Text = "Coords multiplier:";
            // 
            // textBoxTypeMultiplier
            // 
            this.textBoxTypeMultiplier.Location = new System.Drawing.Point(107, 68);
            this.textBoxTypeMultiplier.Name = "textBoxTypeMultiplier";
            this.textBoxTypeMultiplier.Size = new System.Drawing.Size(60, 20);
            this.textBoxTypeMultiplier.TabIndex = 21;
            // 
            // TypeMultiplier
            // 
            this.TypeMultiplier.Location = new System.Drawing.Point(7, 70);
            this.TypeMultiplier.Name = "TypeMultiplier";
            this.TypeMultiplier.Size = new System.Drawing.Size(100, 16);
            this.TypeMultiplier.TabIndex = 20;
            this.TypeMultiplier.Text = "Type multiplier:";
            // 
            // textBoxAngleMultiplier
            // 
            this.textBoxAngleMultiplier.Location = new System.Drawing.Point(107, 43);
            this.textBoxAngleMultiplier.Name = "textBoxAngleMultiplier";
            this.textBoxAngleMultiplier.Size = new System.Drawing.Size(60, 20);
            this.textBoxAngleMultiplier.TabIndex = 19;
            // 
            // AngleMultiplier
            // 
            this.AngleMultiplier.Location = new System.Drawing.Point(7, 45);
            this.AngleMultiplier.Name = "AngleMultiplier";
            this.AngleMultiplier.Size = new System.Drawing.Size(94, 16);
            this.AngleMultiplier.TabIndex = 18;
            this.AngleMultiplier.Text = "Angle multiplier:";
            this.AngleMultiplier.Click += new System.EventHandler(this.label10_Click);
            // 
            // label11
            // 
            this.label11.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.label11.Location = new System.Drawing.Point(7, 33);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(160, 2);
            this.label11.TabIndex = 17;
            // 
            // stopButton
            // 
            this.stopButton.Enabled = false;
            this.stopButton.Location = new System.Drawing.Point(95, 292);
            this.stopButton.Name = "stopButton";
            this.stopButton.Size = new System.Drawing.Size(75, 23);
            this.stopButton.TabIndex = 16;
            this.stopButton.Text = "S&top";
            this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
            // 
            // startButton
            // 
            this.startButton.Location = new System.Drawing.Point(10, 292);
            this.startButton.Name = "startButton";
            this.startButton.Size = new System.Drawing.Size(75, 23);
            this.startButton.TabIndex = 15;
            this.startButton.Text = "&Start";
            this.startButton.Click += new System.EventHandler(this.startButton_Click);
            // 
            // currentIterationBox
            // 
            this.currentIterationBox.Location = new System.Drawing.Point(107, 254);
            this.currentIterationBox.Name = "currentIterationBox";
            this.currentIterationBox.ReadOnly = true;
            this.currentIterationBox.Size = new System.Drawing.Size(60, 20);
            this.currentIterationBox.TabIndex = 14;
            // 
            // label8
            // 
            this.label8.Location = new System.Drawing.Point(7, 256);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(100, 16);
            this.label8.TabIndex = 13;
            this.label8.Text = "Current iteration:";
            // 
            // label7
            // 
            this.label7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.label7.Location = new System.Drawing.Point(7, 242);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(160, 2);
            this.label7.TabIndex = 12;
            // 
            // radiusBox
            // 
            this.radiusBox.Location = new System.Drawing.Point(107, 214);
            this.radiusBox.Name = "radiusBox";
            this.radiusBox.Size = new System.Drawing.Size(60, 20);
            this.radiusBox.TabIndex = 11;
            // 
            // label4
            // 
            this.label4.Location = new System.Drawing.Point(7, 216);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(100, 16);
            this.label4.TabIndex = 10;
            this.label4.Text = "Initial radius:";
            // 
            // rateBox
            // 
            this.rateBox.Location = new System.Drawing.Point(107, 189);
            this.rateBox.Name = "rateBox";
            this.rateBox.Size = new System.Drawing.Size(60, 20);
            this.rateBox.TabIndex = 9;
            // 
            // label5
            // 
            this.label5.Location = new System.Drawing.Point(7, 191);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(100, 16);
            this.label5.TabIndex = 8;
            this.label5.Text = "Initial learning rate:";
            // 
            // iterationsBox
            // 
            this.iterationsBox.Location = new System.Drawing.Point(107, 164);
            this.iterationsBox.Name = "iterationsBox";
            this.iterationsBox.Size = new System.Drawing.Size(60, 20);
            this.iterationsBox.TabIndex = 7;
            // 
            // label6
            // 
            this.label6.Location = new System.Drawing.Point(7, 166);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(60, 16);
            this.label6.TabIndex = 6;
            this.label6.Text = "Iterations:";
            // 
            // label3
            // 
            this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.label3.Location = new System.Drawing.Point(7, 154);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(160, 2);
            this.label3.TabIndex = 3;
            // 
            // textBox1
            // 
            this.textBox1.Location = new System.Drawing.Point(212, 542);
            this.textBox1.Name = "textBox1";
            this.textBox1.ReadOnly = true;
            this.textBox1.Size = new System.Drawing.Size(100, 20);
            this.textBox1.TabIndex = 4;
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(106, 545);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(100, 16);
            this.label1.TabIndex = 17;
            this.label1.Text = "Matched person:";
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(483, 53);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 18;
            this.button1.Text = "Load image";
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // label9
            // 
            this.label9.Location = new System.Drawing.Point(106, 514);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(100, 16);
            this.label9.TabIndex = 20;
            this.label9.Text = "Query person:";
            // 
            // textBoxQueryPerson
            // 
            this.textBoxQueryPerson.Location = new System.Drawing.Point(212, 511);
            this.textBoxQueryPerson.Name = "textBoxQueryPerson";
            this.textBoxQueryPerson.ReadOnly = true;
            this.textBoxQueryPerson.Size = new System.Drawing.Size(100, 20);
            this.textBoxQueryPerson.TabIndex = 19;
            // 
            // MainForm
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(684, 599);
            this.Controls.Add(this.label9);
            this.Controls.Add(this.textBoxQueryPerson);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.generateButton);
            this.Controls.Add(this.groupBox3);
            this.Controls.Add(this.groupBox2);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.Name = "MainForm";
            this.Text = "Kohonen SOM 2D Organizing";
            this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing);
            this.groupBox2.ResumeLayout(false);
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
Example #8
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.randomizeButton = new System.Windows.Forms.Button();
            this.mapPanel = new SampleApp.BufferedPanel();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.currentIterationBox = new System.Windows.Forms.TextBox();
            this.label5 = new System.Windows.Forms.Label();
            this.stopButton = new System.Windows.Forms.Button();
            this.startButton = new System.Windows.Forms.Button();
            this.label4 = new System.Windows.Forms.Label();
            this.radiusBox = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.rateBox = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.iterationsBox = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.SuspendLayout();
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.randomizeButton);
            this.groupBox1.Controls.Add(this.mapPanel);
            this.groupBox1.Location = new System.Drawing.Point(16, 15);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(355, 387);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Map";
            // 
            // randomizeButton
            // 
            this.randomizeButton.Location = new System.Drawing.Point(16, 336);
            this.randomizeButton.Name = "randomizeButton";
            this.randomizeButton.Size = new System.Drawing.Size(120, 34);
            this.randomizeButton.TabIndex = 1;
            this.randomizeButton.Text = "&Randomize";
            this.randomizeButton.Click += new System.EventHandler(this.randomizeButton_Click);
            // 
            // mapPanel
            // 
            this.mapPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.mapPanel.Location = new System.Drawing.Point(16, 29);
            this.mapPanel.Name = "mapPanel";
            this.mapPanel.Size = new System.Drawing.Size(323, 295);
            this.mapPanel.TabIndex = 0;
            this.mapPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.mapPanel_Paint);
            // 
            // groupBox2
            // 
            this.groupBox2.Controls.Add(this.currentIterationBox);
            this.groupBox2.Controls.Add(this.label5);
            this.groupBox2.Controls.Add(this.stopButton);
            this.groupBox2.Controls.Add(this.startButton);
            this.groupBox2.Controls.Add(this.label4);
            this.groupBox2.Controls.Add(this.radiusBox);
            this.groupBox2.Controls.Add(this.label3);
            this.groupBox2.Controls.Add(this.rateBox);
            this.groupBox2.Controls.Add(this.label2);
            this.groupBox2.Controls.Add(this.iterationsBox);
            this.groupBox2.Controls.Add(this.label1);
            this.groupBox2.Location = new System.Drawing.Point(384, 15);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(304, 387);
            this.groupBox2.TabIndex = 1;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Neural Network";
            // 
            // currentIterationBox
            // 
            this.currentIterationBox.Location = new System.Drawing.Point(176, 175);
            this.currentIterationBox.Name = "currentIterationBox";
            this.currentIterationBox.ReadOnly = true;
            this.currentIterationBox.Size = new System.Drawing.Size(112, 26);
            this.currentIterationBox.TabIndex = 10;
            // 
            // label5
            // 
            this.label5.Location = new System.Drawing.Point(16, 178);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(160, 24);
            this.label5.TabIndex = 9;
            this.label5.Text = "Curren iteration:";
            // 
            // stopButton
            // 
            this.stopButton.Enabled = false;
            this.stopButton.Location = new System.Drawing.Point(168, 336);
            this.stopButton.Name = "stopButton";
            this.stopButton.Size = new System.Drawing.Size(120, 34);
            this.stopButton.TabIndex = 8;
            this.stopButton.Text = "S&top";
            this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
            // 
            // startButton
            // 
            this.startButton.Location = new System.Drawing.Point(32, 336);
            this.startButton.Name = "startButton";
            this.startButton.Size = new System.Drawing.Size(120, 34);
            this.startButton.TabIndex = 7;
            this.startButton.Text = "&Start";
            this.startButton.Click += new System.EventHandler(this.startButton_Click);
            // 
            // label4
            // 
            this.label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.label4.Location = new System.Drawing.Point(16, 146);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(272, 3);
            this.label4.TabIndex = 6;
            // 
            // radiusBox
            // 
            this.radiusBox.Location = new System.Drawing.Point(176, 102);
            this.radiusBox.Name = "radiusBox";
            this.radiusBox.Size = new System.Drawing.Size(112, 26);
            this.radiusBox.TabIndex = 5;
            // 
            // label3
            // 
            this.label3.Location = new System.Drawing.Point(16, 105);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(160, 24);
            this.label3.TabIndex = 4;
            this.label3.Text = "Initial radius:";
            // 
            // rateBox
            // 
            this.rateBox.Location = new System.Drawing.Point(176, 66);
            this.rateBox.Name = "rateBox";
            this.rateBox.Size = new System.Drawing.Size(112, 26);
            this.rateBox.TabIndex = 3;
            // 
            // label2
            // 
            this.label2.Location = new System.Drawing.Point(16, 69);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(160, 23);
            this.label2.TabIndex = 2;
            this.label2.Text = "Initial learning rate:";
            // 
            // iterationsBox
            // 
            this.iterationsBox.Location = new System.Drawing.Point(176, 29);
            this.iterationsBox.Name = "iterationsBox";
            this.iterationsBox.Size = new System.Drawing.Size(112, 26);
            this.iterationsBox.TabIndex = 1;
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(16, 32);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(96, 24);
            this.label1.TabIndex = 0;
            this.label1.Text = "Iteraions:";
            // 
            // MainForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
            this.ClientSize = new System.Drawing.Size(698, 416);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.Name = "MainForm";
            this.Text = "Color Clustering using Kohonen SOM";
            this.Closing += new System.ComponentModel.CancelEventHandler(this.MainForm_Closing);
            this.groupBox1.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.ResumeLayout(false);

        }
Example #9
0
 private void InitializeComponent()
 {
     lblStartText   = new Label();
     lblStart       = new Label();
     lblStartColor  = new Label();
     lblEndText     = new Label();
     lblEnd         = new Label();
     lblEndColor    = new Label();
     btnOkay        = new Button();
     btnCancel      = new Button();
     btnCopyToEnd   = new Button();
     pnlPreview     = new BufferedPanel();
     chkShowAlpha   = new CheckBox();
     btnCopyToStart = new Button();
     lblCopy        = new Label();
     SuspendLayout();
     //
     // lblStartText
     //
     lblStartText.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Left
                                          | AnchorStyles.Right);
     lblStartText.BackColor   = Color.White;
     lblStartText.BorderStyle = BorderStyle.FixedSingle;
     lblStartText.Font        = new Font("Courier New", 9F, FontStyle.Regular, GraphicsUnit.Point, (byte)0);
     lblStartText.Location    = new Point(69, 8);
     lblStartText.Name        = "lblStartText";
     lblStartText.Size        = new Size(187, 20);
     lblStartText.TabIndex    = 4;
     lblStartText.TextAlign   = ContentAlignment.MiddleCenter;
     lblStartText.Click      += new EventHandler(lblStartText_Click);
     //
     // lblStart
     //
     lblStart.Location  = new Point(-1, 8);
     lblStart.Name      = "lblStart";
     lblStart.Size      = new Size(71, 20);
     lblStart.TabIndex  = 3;
     lblStart.Text      = "Start Color:";
     lblStart.TextAlign = ContentAlignment.MiddleRight;
     //
     // lblStartColor
     //
     lblStartColor.Anchor      = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Right);
     lblStartColor.BorderStyle = BorderStyle.FixedSingle;
     lblStartColor.Location    = new Point(255, 8);
     lblStartColor.Name        = "lblStartColor";
     lblStartColor.Size        = new Size(40, 20);
     lblStartColor.TabIndex    = 2;
     lblStartColor.Click      += new EventHandler(lblStartText_Click);
     //
     // lblEndText
     //
     lblEndText.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Left
                                        | AnchorStyles.Right);
     lblEndText.BackColor   = Color.White;
     lblEndText.BorderStyle = BorderStyle.FixedSingle;
     lblEndText.Font        = new Font("Courier New", 9F, FontStyle.Regular, GraphicsUnit.Point, (byte)0);
     lblEndText.Location    = new Point(69, 52);
     lblEndText.Name        = "lblEndText";
     lblEndText.Size        = new Size(187, 20);
     lblEndText.TabIndex    = 4;
     lblEndText.TextAlign   = ContentAlignment.MiddleCenter;
     lblEndText.Click      += new EventHandler(lblEndText_Click);
     //
     // lblEnd
     //
     lblEnd.Location  = new Point(2, 52);
     lblEnd.Name      = "lblEnd";
     lblEnd.Size      = new Size(68, 20);
     lblEnd.TabIndex  = 3;
     lblEnd.Text      = "End Color:";
     lblEnd.TextAlign = ContentAlignment.MiddleRight;
     //
     // lblEndColor
     //
     lblEndColor.Anchor      = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Right);
     lblEndColor.BorderStyle = BorderStyle.FixedSingle;
     lblEndColor.Location    = new Point(255, 52);
     lblEndColor.Name        = "lblEndColor";
     lblEndColor.Size        = new Size(40, 20);
     lblEndColor.TabIndex    = 2;
     lblEndColor.Click      += new EventHandler(lblEndText_Click);
     //
     // btnOkay
     //
     btnOkay.Anchor   = AnchorStyles.Bottom;
     btnOkay.Location = new Point(86, 119);
     btnOkay.Name     = "btnOkay";
     btnOkay.Size     = new Size(65, 23);
     btnOkay.TabIndex = 6;
     btnOkay.Text     = "Okay";
     btnOkay.UseVisualStyleBackColor = true;
     btnOkay.Click += new EventHandler(btnOkay_Click);
     //
     // btnCancel
     //
     btnCancel.Anchor   = AnchorStyles.Bottom;
     btnCancel.Location = new Point(157, 119);
     btnCancel.Name     = "btnCancel";
     btnCancel.Size     = new Size(65, 23);
     btnCancel.TabIndex = 7;
     btnCancel.Text     = "Cancel";
     btnCancel.UseVisualStyleBackColor = true;
     btnCancel.Click += new EventHandler(btnCancel_Click);
     //
     // btnCopyToEnd
     //
     btnCopyToEnd.Anchor   = AnchorStyles.Top;
     btnCopyToEnd.Location = new Point(106, 30);
     btnCopyToEnd.Name     = "btnCopyToEnd";
     btnCopyToEnd.Size     = new Size(22, 20);
     btnCopyToEnd.TabIndex = 9;
     btnCopyToEnd.Text     = "↓";
     btnCopyToEnd.UseVisualStyleBackColor = true;
     btnCopyToEnd.Click += new EventHandler(btnCopyToEnd_Click);
     //
     // pnlPreview
     //
     pnlPreview.Anchor = (AnchorStyles)(AnchorStyles.Top | AnchorStyles.Left
                                        | AnchorStyles.Right);
     pnlPreview.BorderStyle = BorderStyle.FixedSingle;
     pnlPreview.Location    = new Point(12, 81);
     pnlPreview.Name        = "pnlPreview";
     pnlPreview.Size        = new Size(283, 27);
     pnlPreview.TabIndex    = 8;
     pnlPreview.Paint      += new PaintEventHandler(pnlPreview_Paint);
     //
     // chkShowAlpha
     //
     chkShowAlpha.AutoSize   = true;
     chkShowAlpha.BackColor  = Color.Transparent;
     chkShowAlpha.Checked    = true;
     chkShowAlpha.CheckState = CheckState.Checked;
     chkShowAlpha.Location   = new Point(211, 33);
     chkShowAlpha.Name       = "chkShowAlpha";
     chkShowAlpha.Size       = new Size(83, 17);
     chkShowAlpha.TabIndex   = 10;
     chkShowAlpha.Text       = "Show Alpha";
     chkShowAlpha.UseVisualStyleBackColor = false;
     chkShowAlpha.CheckedChanged         += new EventHandler(chkShowAlpha_CheckedChanged);
     //
     // btnCopyToStart
     //
     btnCopyToStart.Anchor = AnchorStyles.Top;
     btnCopyToStart.Font   =
         new Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, (byte)0);
     btnCopyToStart.Location = new Point(177, 30);
     btnCopyToStart.Name     = "btnCopyToStart";
     btnCopyToStart.Size     = new Size(22, 20);
     btnCopyToStart.TabIndex = 11;
     btnCopyToStart.Text     = "↑";
     btnCopyToStart.UseVisualStyleBackColor = true;
     btnCopyToStart.Click += new EventHandler(btnCopyToStart_Click);
     //
     // lblCopy
     //
     lblCopy.AutoSize  = true;
     lblCopy.Location  = new Point(137, 34);
     lblCopy.Name      = "lblCopy";
     lblCopy.Size      = new Size(31, 13);
     lblCopy.TabIndex  = 12;
     lblCopy.Text      = "Copy";
     lblCopy.TextAlign = ContentAlignment.MiddleCenter;
     //
     // GradientDialog
     //
     ClientSize = new Size(309, 154);
     Controls.Add(lblCopy);
     Controls.Add(btnCopyToStart);
     Controls.Add(chkShowAlpha);
     Controls.Add(lblStartColor);
     Controls.Add(lblStartText);
     Controls.Add(lblEndText);
     Controls.Add(lblStart);
     Controls.Add(btnCopyToEnd);
     Controls.Add(lblEnd);
     Controls.Add(lblEndColor);
     Controls.Add(pnlPreview);
     Controls.Add(btnCancel);
     Controls.Add(btnOkay);
     FormBorderStyle = FormBorderStyle.FixedToolWindow;
     MaximizeBox     = false;
     MinimizeBox     = false;
     Name            = "GradientDialog";
     ShowIcon        = false;
     ShowInTaskbar   = false;
     Text            = "Gradient Fill";
     ResumeLayout(false);
     PerformLayout();
 }
Example #10
0
        /// <summary>
        ///  Initializes the components.
        /// </summary>
        /// <param name="columns"></param>
        /// <param name="rows"></param>
        private void InitializeComponents(GameSettings settings)
        {
            int columns = settings.Columns;
            int rows = settings.Rows;

            #region Statusstrip
            informationStatusStrip = new StatusStrip();
            informationStatusStrip.Renderer = new CustomRenderer(new CustomColorTable());

            Controls.Add(informationStatusStrip);
            #endregion

            #region Game Panels
            Panel rootPanel = new Panel();
            rootPanel.Size = ClientSize;
            rootPanel.BackgroundImage = Properties.Resources.Stadium;
            rootPanel.Location = new Point(0, 20);
            rootPanel.BorderStyle = BorderStyle.FixedSingle;

            informationPanel = new InformationPanel();
            informationPanel.Size = new Size(ClientSize.Width, 130);
            informationPanel.Location = new Point(10, 0);
            informationPanel.BackColor = Color.Transparent;

            //Initialize stadium panel
            stadiumPanel = new FieldPanel(true);
            stadiumPanel.Size = new Size(ClientSize.Width, ClientSize.Height);
            stadiumPanel.Location = new Point(0, 60);
            stadiumPanel.BackColor = Color.Transparent;

            int edgeLength = 20;

            columns += 2;
            rows += 2;

            directionLinesPanel = new Panel();
            directionLinesPanel.Size = new Size((columns) * edgeLength, (rows) * edgeLength);
            directionLinesPanel.BackColor = Color.Transparent;
            directionLinesPanel.Paint += directionLinesPanel_Paint;
            directionLinesPanel.Location = new Point(70, 85);

            fieldGrid = new BufferedPanel();
            fieldGrid.Size = directionLinesPanel.Size;
            fieldGrid.BackColor = Color.Transparent;
            fieldGrid.Location = new Point(0, 0);
            fieldGrid.Paint += fieldGrid_Paint;
            fieldGrid.MouseMove += fieldGrid_MouseMove;
            fieldGrid.MouseDown += fieldGrid_MouseDown;
            fieldGrid.MouseUp += fieldGrid_MouseUp;

            fieldCell = new Rectangle[columns, rows];
            for (int r = 0; r < rows; r++)
            {
                for (int c = 0; c < columns; c++)
                {
                    Rectangle cell = new Rectangle();
                    cell.Size = new Size(edgeLength, edgeLength);
                    cell.Location = new Point(c * edgeLength, r * edgeLength);
                    fieldCell[c, r] = cell;
                }
            }

            directionLinesPanel.Controls.Add(fieldGrid);

            stadiumPanel.Controls.Add(directionLinesPanel);
            stadiumPanel.UpdateSettings(fieldCell, settings, directionLinesPanel.Location);
            #endregion

            rootPanel.Controls.Add(informationPanel);
            rootPanel.Controls.Add(stadiumPanel);

            Controls.Add(rootPanel);
        }
Example #11
0
 void resize_board(BufferedPanel bp) 
 {
     if (bp.Width < bp.Height)
     {
         m_board_start_x = 0;
         m_board_start_y = (bp.Height - bp.Width) / 2;
     }
     else
     {
         m_board_start_x = (bp.Width - bp.Height) / 2;
         m_board_start_y = 0;
     }
 }
Example #12
0
        void resize_stone(BufferedPanel panel)
        {
            //label5.Text = "x=" + panel.Width + "y=" + panel.Height;
            float board_x, board_y;
            // 縦横の小さい方に合わせる
            if (panel.Width < panel.Height)
            {
                // margin考慮
                board_x = panel.Width - (panel.Width * border_rate);
                board_y = panel.Height - (panel.Width * border_rate);
                m_scale = board_x / (m_board_width + 16);
                m_mass_size = board_x / BOARD_SIZE;
                m_fix_x = (float)30.5 * m_scale;
                m_fix_y = (board_y - board_x) / 2 + ((float)30.5 * m_scale);
            }
            else
            {
                board_x = panel.Width - (panel.Height * border_rate);
                board_y = panel.Height - (panel.Height * border_rate);
                m_scale = board_y / (m_board_height + 16);
                m_mass_size = board_y / BOARD_SIZE;
                m_fix_x = (board_x - board_y) / 2 + ((float)30.5 * m_scale);
                m_fix_y = (float)30.5 * m_scale;
            }

            if (m_scale != 0)
            {
                // 各描画インスタンスの座標をスケーリング
                stone_size_x = (m_board_width / BOARD_SIZE) * m_scale;
                stone_size_y = (m_board_height / BOARD_SIZE) * m_scale;
                last_move_fix_x = (21 * m_scale) + m_fix_x;
                last_move_fix_y = (21 * m_scale) + m_fix_y;
                canmove_x = (19 * m_scale) + m_fix_x;
                canmove_y = (21 * m_scale) + m_fix_y;
                font_scale_x = (2 * m_scale) + m_fix_x;
                font_scale_y = (14 * m_scale) + m_fix_y;

                // フォントスケーリング
                m_ft = new Font("MS UI Gothic", 9 * m_scale);
                m_ft2 = new Font("MS UI Gothic", 8 * m_scale);
                m_ft3 = new Font("Arial", 18 * m_scale, FontStyle.Bold | FontStyle.Italic);
                m_ft4 = new Font("Arial", 15 * m_scale, FontStyle.Bold | FontStyle.Italic);
            }
        }
Example #13
0
        private void Form1_Load(object sender, EventArgs e)
        {
            bkImg = new Bitmap(KZreversi.Properties.Resources.othello_bk);
            whImg = new Bitmap(KZreversi.Properties.Resources.othello_wh);
            m_back_bitmap = new Bitmap(KZreversi.Properties.Resources.wood_pattern);
            m_panel1_bitmap = new Bitmap(KZreversi.Properties.Resources.othello_board);

            // 盤面背景のセット
            panel_back = new BufferedPanel(false);
            panel_back.Width = 534;
            panel_back.Height = 534;
            panel_back.Location = new Point(0, 0);
            panel_back.Paint += panel_back_Paint;
            panel_back.BackgroundImageLayout = ImageLayout.Stretch;
            panel_back.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            this.Controls.Add(panel_back);

            // 盤面のセット
            panel_board = new BufferedPanel(false);
            panel_board.Width = 480;
            panel_board.Height = 480;
            panel_board.Location = new Point(26, 30);
            panel_board.BackColor = Color.Transparent;
            panel_board.Paint += panel_board_Paint;
            panel_board.Resize += panel_Resize;
            panel_board.BackgroundImageLayout = ImageLayout.Zoom;
            panel_board.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            // 盤面背景の子として登録
            panel_back.Controls.Add(panel_board);

            // 盤面のセット
            panel1 = new BufferedPanel(true);
            panel1.Width = 480;
            panel1.Height = 480;
            panel1.Location = new Point(0, 0);
            panel1.BackColor = Color.Transparent;
            panel1.Paint += panel1_Paint;
            panel1.Click += panel1_Click;
            panel1.DoubleClick += panel1_Click;
            panel1.Resize += panel_Resize;
            panel1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            // 盤面背景の子として登録
            panel_board.Controls.Add(panel1);

            m_board_width = panel1.Width - (panel1.Width * border_rate);
            m_board_height = panel1.Height - (panel1.Height * border_rate);

            // 画像とフォントのスケーリング
            resize_stone(panel1);

            LoadForm lf = new LoadForm();
            lf.ShowDialog(this);

            if (loadResult == false)
            {
                MessageBox.Show(
                    "DLLかAIデータ読み込みに失敗しました。アプリケーションを終了します。",
                    "読み込みエラー",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                this.Close();
            }

            // !! ステータスバーのみC#のメモリ管理下から外すため自力解放必須 !!
            // このdelegateをGC対象外にする
            m_gcHandle_setCpuMessageDelegate = GCHandle.Alloc(cpuMessageDelegate);
            // C++側から呼び出せるようにする
            cpuMessageDelegatePtr = Marshal.GetFunctionPointerForDelegate(cpuMessageDelegate);
            // C側に関数ポインタを登録
            cppWrapper.EntryFunction(cpuMessageDelegatePtr);
            m_gcHandle_setCpuMessageDelegate.Free();

            // CPU情報表示用
            m_gcHandle_setPVLineDelegate = GCHandle.Alloc(setPVLineDelegate);
            setPVLineDelegatePtr = Marshal.GetFunctionPointerForDelegate(setPVLineDelegate);
            cppWrapper.EntryFunction(setPVLineDelegatePtr);
            m_gcHandle_setPVLineDelegate.Free();

            // MPC進捗状況表示用
            m_gcHandle_setMPCInfoDelegate = GCHandle.Alloc(setMPCInfoDelegate);
            setMPCInfoDelegatePtr = Marshal.GetFunctionPointerForDelegate(setMPCInfoDelegate);
            cppWrapper.EntryFunction(setMPCInfoDelegatePtr);
            m_gcHandle_setMPCInfoDelegate.Free();

            // デフォルトのCPU設定
            for (int i = 0; i < cpuClass.Length; i++)
            {
                if (i == 0)
                {
                    cpuClass[i].SetColor(BoardClass.BLACK);
                }
                else
                {
                    cpuClass[i].SetColor(BoardClass.WHITE);
                }

                // size(MB)--> size * 1024 * 1024 / sizeof(hash_entry) = size * 1024 * 16
                cpuClass[i].SetCasheSize(128 * 1024 * 16); // 128MB default
                cpuClass[i].SetSearchDepth(6);
                cpuClass[i].SetWinLossDepth(14);
                cpuClass[i].SetExactDepth(12);
                cpuClass[i].SetBookFlag(true);
                cpuClass[i].SetBookVariability(1);
                cpuClass[i].SetMpcFlag(true);
                cpuClass[i].SetTableFlag(true);
            }
        }