Im writing application on Winforms C# and using library MSAGL to display graph
s.
At now im stuck on loading graph
s from file *.msagl.
Here is my code for proccessing loaded file:
private void loadGraphToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog()==DialogResult.Cancel)
{
return;
}
string fileName = openFileDialog.FileName;
string file = File.ReadAllText(fileName);
MessageBox.Show(file);//just pint all text from file
AppValues.DrawGraph(gGraphViewer,graph!,pnlGraphDisplay);
graphIsInitialized();
}
How can i get a graph (variable with type Microsft.Msagl.Drawing.Graph) from this file to draw it on gGraphViewer (type GViewer)?
Function DrawGraph:
public static void DrawGraph(GViewer gViewer,Graph graph,Panel panel)
{
gViewer.Graph = graph;
gViewer.Dock = DockStyle.Fill;
panel.Controls.Add(gViewer);
gViewer.OutsideAreaBrush = System.Drawing.Brushes.White;
gViewer.ToolBarIsVisible = false;
}
TA1989 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.