Example #1
0
        private void pictureBox3_MouseClick(object sender, MouseEventArgs e)
        {
            switch (e.Button)
            {
            case MouseButtons.Left:
                HClusterNode nodeC = left.CheckClick(left.rootNode, e.X, e.Y);
                if (nodeC != null)
                {
                    TextBoxView rr = new TextBoxView(nodeC.setStruct);
                    rr.Show();
                }
                if (colorNodeLeft != null && colorNodeLeft.joined != null)
                {
                    auxLeft = colorNodeLeft;
                }
                break;

            case MouseButtons.Right:
                auxLeft = leftNode;
                break;
            }
            if (auxLeft != null)
            {
                if (colorNodeLeft != null)
                {
                    left.ChangeColors(colorNodeLeft, Color.Black);
                }
                colorNodeLeft = null;
                left.rootNode = auxLeft;
                left.PrepareGraphNodes(leftBitMap);
                Graphics g = Graphics.FromImage(leftBitMap);
                g.Clear(pictureBox3.BackColor);
                pictureBox3.Refresh();
                pictureBox1.Refresh();
            }
        }
Example #2
0
        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            HClusterNode clickNode;

            if (linemode)
            {
                linemode = false;
                if (listNodes.Count > 0)
                {
                    SaveMarkedClusters.Enabled = true;
                    orderVis.Enabled           = true;
                }
                pictureBox1.Invalidate();
                return;
            }
            if (markflag)
            {
                clickNode = drawH.CheckClick(drawH.rootNode, e.X, e.Y);
                if (clickNode != null)
                {
                    if (e.Button == MouseButtons.Right)
                    {
                        if (listNodes.ContainsKey(clickNode))
                        {
                            listNodes.Remove(clickNode);
                        }
                    }
                    else
                    {
                        if (listNodes == null)
                        {
                            listNodes = new Dictionary <HClusterNode, Color>();
                        }
                        if (!listNodes.ContainsKey(clickNode))
                        {
                            listNodes.Add(clickNode, Color.Red);
                        }
                    }
                    if (listNodes.Count > 0)
                    {
                        SaveMarkedClusters.Enabled = true;
                        orderVis.Enabled           = true;
                    }
                    pictureBox1.Invalidate();
                }


                return;
            }
            clickNode = drawH.CheckClick(drawH.rootNode, e.X, e.Y);

            if (clickNode != null)
            {
                if (e.Button == MouseButtons.Right)
                {
                    drawH.rootNode = clickNode;
                    drawH.PrepareGraphNodes(buffer);
                    ClearBuffer();
                    pictureBox1.Invalidate();

                    //this.Invalidate();
                }
                else
                {
                    FormText info = new FormText(clickNode);
                    info.Show();
                    if (clickNode.setProfiles != null && clickNode.setProfiles.Count > 0)
                    {
                        DrawPanel pn = new DrawPanel("Leave profile: " + clickNode.refStructure);
                        pn.CreateBMP();
                        pn.drawPic = delegate { double res = DrawNodeProfiles(pn.bmp, clickNode.setProfiles, clickNode.consistency); pn.Text = res.ToString(); };
                        pn.Show();
                        pn.pictureBox1.Invalidate();
                    }
                }
            }
            string lab = drawH.CheckColorRegion(e.X, e.Y);

            if (lab != null)
            {
                DialogResult res;
                colorDialog1 = new ColorDialog();
                int [] colorTab = new int [drawH.classColor.Count];
                int    i        = 0;
                foreach (var item in drawH.classColor)
                {
                    colorTab[i++] = ColorTranslator.ToOle(item.Value);
                }
                colorDialog1.CustomColors = colorTab;

                colorDialog1.Color = drawH.classColor[lab];

                res = colorDialog1.ShowDialog();
                if (res == DialogResult.OK)
                {
                    drawH.classColor[lab] = Color.FromArgb(colorDialog1.Color.R, colorDialog1.Color.G, colorDialog1.Color.B);
                    buffer = null;
                    pictureBox1.Invalidate();
                    pictureBox1.Refresh();
                }
            }
        }