本文整理汇总了C#中ZedGraph.MasterPane.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# MasterPane.Draw方法的具体用法?C# MasterPane.Draw怎么用?C# MasterPane.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.MasterPane
的用法示例。
在下文中一共展示了MasterPane.Draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGraph
/// <summary>
///
/// </summary>
/// <param name="OutputStream"></param>
/// <param name="Format"></param>
/// <param name="bShowTransparency">if true, draw squares instead of leaving the
/// background transparent</param>
/// <remarks>
/// bShowTransparency is set to true in design mode, to false otherwise.
/// </remarks>
protected MasterPane CreateGraph( System.IO.Stream OutputStream, ImageFormat Format,
bool bShowTransparency )
{
RectangleF rect = new RectangleF( 0, 0, this.Width, this.Height );
MasterPane mp = new MasterPane( string.Empty, rect );
mp.Margin.All = 0;
mp.Fill.IsVisible = false;
mp.Border.IsVisible = false;
// create all required panes
//for ( int i = 0; i < this.PaneCount; i++ )
//{
mp.Add( new GraphPane( rect, Title, string.Empty, string.Empty ) );
//}
// create output bitmap container
Bitmap image = new Bitmap( this.Width, this.Height );
using ( Graphics g = Graphics.FromImage( image ) )
{
// Apply layout plan
//mp.SetLayout( this.PaneLayout );
mp.ReSize( g, rect );
// Use callback to gather more settings and data values
OnDrawPane( g, mp );
// Allow designer control of axischange
if ( this.AxisChanged ) mp.AxisChange( g );
// Render the graph to a bitmap
if ( bShowTransparency && mp.Fill.Color.A != 255 )
{
//Show the transparency as white/gray filled squares
// We need to add the resource namespace to its name
//string resourceName = string.Format( "{0}.transparency.png", GetType().Namespace );
string resourceName = "ZedGraph.ZedGraph.transparency.png";
Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( resourceName );
if ( stream == null )
throw new Exception( "Does the Build Action of the resource " + resourceName + " is set to Embedded Resource ?" );
using ( System.Drawing.Image brushImage = new Bitmap( stream ) )
using ( TextureBrush brush = new TextureBrush( brushImage, WrapMode.Tile ) )
{
g.FillRectangle( brush, 0, 0, this.Width, this.Height );
}
stream.Close();
}
mp.Draw( g );
}
// Stream the graph out
MemoryStream ms = new MemoryStream();
image.Save( ms, Format );
//TODO: provide caching options
ms.WriteTo( OutputStream );
return mp;
}