Example #1
0
        private void renderMolecule()
        {
            IndigoRenderer renderer = new IndigoRenderer(_indigo);

            _indigo.setOption("render-output-format", "emf");
            _indigo.setOption("render-margins", 10, 10);

            if (showBonds == true)
            {
                _indigo.setOption("render-bond-ids-visible", true);
            }
            else
            {
                _indigo.setOption("render-bond-ids-visible", false);
            }
            if (showAtoms == true)
            {
                _indigo.setOption("render-atom-ids-visible", true);
            }
            else
            {
                _indigo.setOption("render-atom-ids-visible", false);
            }
            _indigo.setOption("render-label-mode", "hetero");
            _indigo.setOption("render-stereo-style", "none");
            _indigo.setOption("render-bond-length", 45);

            _chemStructures[0].layout();
            MemoryStream ms = new MemoryStream(renderer.renderToBuffer(_chemStructures[0]));

            pictureBox1.Image = Image.FromStream(ms);
            ms.Close();
        }
Example #2
0
        public byte[] RenderMolStringToBuffer(string molString)
        {
            var mol = indigo.loadMolecule(molString);

            mol.layout();
            return(renderer.renderToBuffer(mol));
        }
        private void showSelections()
        {
            IndigoRenderer renderer = new IndigoRenderer(_indigo);

            _indigo.setOption("render-output-format", "emf");
            //_indigo.setOption("render-margins", 10, 10);
            _indigo.setOption("render-bond-ids-visible", true);
            _indigo.setOption("render-label-mode", "hetero");
            _indigo.setOption("render-stereo-style", "none");
            //_indigo.setOption("render-bond-length", 45);
            _indigo.setOption("render-image-size", 200, 250);
            List <Panel>      scroll        = new List <Panel>();
            List <PictureBox> renders       = new List <PictureBox>();
            List <Button>     zoomInButton  = new List <Button>();
            List <Button>     zoomOutButton = new List <Button>();

            this.tableLayoutPanel1.RowCount = 0;
            this.tableLayoutPanel1.RowStyles.Clear();
            this.tableLayoutPanel1.AutoScroll = true;
            this.tableLayoutPanel1.AutoSize   = true;

            foreach (IndigoObject item in _chemStructures)
            {
                item.layout();
                MemoryStream ms = new MemoryStream(renderer.renderToBuffer(item));
                renders.Add(new PictureBox());
                scroll.Add(new Panel());
                scroll.Last().Size = new System.Drawing.Size(200, 250);

                renders.Last().SizeMode = PictureBoxSizeMode.StretchImage;
                renders.Last().Size     = new System.Drawing.Size(200, 250);
                renders.Last().Image    = Image.FromStream(ms);
                ms.Close();
                int row = tableLayoutPanel1.RowCount;

                tableLayoutPanel1.Controls.Add(scroll.Last(), 0 /* Column Index */, row /* Row index */);
                scroll.Last().Controls.Add(renders.Last());

                RadioButton selection = new RadioButton();
                selection.CheckedChanged += new EventHandler(selection_Click);

                selection.Name = (tableLayoutPanel1.RowCount).ToString();
                this.tableLayoutPanel1.Controls.Add(selection, 1 /* Column Index */, row /* Row index */);
                this.tableLayoutPanel1.RowCount++;
            }
        }
Example #4
0
        private void renderMolecule2(IndigoObject input, string mw)
        {
            IndigoRenderer renderer = new IndigoRenderer(_indigo);

            _indigo.setOption("render-output-format", "emf");
            _indigo.setOption("render-margins", 10, 10);

            if (showBonds == true)
            {
                _indigo.setOption("render-bond-ids-visible", true);
            }
            else
            {
                _indigo.setOption("render-bond-ids-visible", false);
            }
            if (showAtoms == true)
            {
                _indigo.setOption("render-atom-ids-visible", true);
            }
            else
            {
                _indigo.setOption("render-atom-ids-visible", false);
            }
            _indigo.setOption("render-atom-ids-visible", false);
            _indigo.setOption("render-atom-ids-visible", true);
            _indigo.setOption("render-label-mode", "hetero");
            _indigo.setOption("render-stereo-style", "none");
            _indigo.setOption("render-bond-length", 45);

            input.layout();
            Form1        f  = new Form1();
            MemoryStream ms = new MemoryStream(renderer.renderToBuffer(input));

            f.pictureBox1.Image = Image.FromStream(ms);
            f.label1.Text       = mw;
            f.Show();
            ms.Close();
        }