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(); }
/// <summary> /// Returns a depiction of the chemical structure as a bitmap. /// </summary> /// <param name="width">The desired width in pixels.</param> /// <param name="height">The desired height in pixels.</param> /// <returns>The bitmap depicting the chemical structure.</returns> public Bitmap ToBitmap(int width, int height) { Bitmap bitmap = null; try { using (Indigo indigo = new Indigo()) { IndigoRenderer indigoRenderer = new IndigoRenderer(indigo); indigo.setOption("render-coloring", true); indigo.setOption("render-image-size", width, height); indigo.setOption("render-label-mode", "hetero"); indigo.setOption("render-margins", 10, 10); indigo.setOption("render-output-format", "png"); indigo.setOption("render-relative-thickness", 1.6f); IndigoObject structure = CreateIndigoStructure(indigo); structure.dearomatize(); structure.layout(); bitmap = indigoRenderer.renderToBitmap(structure); structure.Dispose(); } } catch { bitmap = Properties.Resources.Error; } return(bitmap); }
public IndigoBase() { renderer = new IndigoRenderer(indigo); indigo.setOption("ignore-stereochemistry-errors", true); indigo.setOption("render-output-format", "png"); indigo.setOption("render-margins", 20, 20); //indigo.setOption("render-image-max-width", 500); //indigo.setOption("render-image-max-height", 250); indigo.setOption("render-coloring", true); indigo.setOption("render-stereo-style", "none"); }
private IndigoRenderer GetRenderer(Indigo indigo) { var renderer = new IndigoRenderer(indigo); indigo.setOption("render-output-format", "png"); indigo.setOption("render-stereo-style", "ext"); indigo.setOption("render-margins", 5, 5); indigo.setOption("render-coloring", true); indigo.setOption("render-relative-thickness", "1.5"); return(renderer); }
private IndigoRenderer GetRenderer(Indigo indigo, string format = "png", int width = -1, int height = -1) { var renderer = new IndigoRenderer(indigo); indigo.setOption("render-output-format", format); indigo.setOption("render-stereo-style", "ext"); indigo.setOption("render-margins", 5, 5); indigo.setOption("render-coloring", true); indigo.setOption("render-relative-thickness", "1.5"); indigo.setOption("render-image-size", width, height); return(renderer); }
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++; } }
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(); }
public IndigoChemistryDepiction(Indigo _indigo) { indigo = _indigo; renderer = new IndigoRenderer(indigo); }