locked
Background Image RRS feed

  • Question

  • Hi,

     

    is it possible to define a background image in GViewer?

    I tried it with the BackgroundImage Property but the image is not visible.

     

    Thanks,

    Jaspis

    Tuesday, August 26, 2008 3:07 PM

Answers

  • Hi Jaspis,

    The following sample does it.

    using System;

    using System.Drawing;

    using System.Windows.Forms;

    using Microsoft.Msagl.Drawing;

    namespace WindowsFormsApplication1 {

    public partial class Form1 : Form {

    public Form1() {

    InitializeComponent();

    }

    private void gViewer1_Load(object sender, EventArgs e) {

    gViewer1.Graph = CreateGraph();

    gViewer1.DrawingPanel.BackgroundImage=new Bitmap("C:\\dev\\MSAGL_RTMJune2008\\Samples\\NodesWithImages\\creek.jpg");

    gViewer1.OutsideAreaBrush = Brushes.Transparent;

    }

    private Microsoft.Msagl.Drawing.Graph CreateGraph() {

    Graph g = new Graph();

    g.AddEdge("a", "b");

    g.Attr.BackgroundColor = Microsoft.Msagl.Drawing.Color.Transparent;

    return g;

    }

    }

    }

    Thanks,

    Lev

    Wednesday, September 3, 2008 9:21 PM