本文整理汇总了C#中ZedGraph.MasterPane.ReSize方法的典型用法代码示例。如果您正苦于以下问题:C# MasterPane.ReSize方法的具体用法?C# MasterPane.ReSize怎么用?C# MasterPane.ReSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZedGraph.MasterPane
的用法示例。
在下文中一共展示了MasterPane.ReSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDrawPane
/// <summary>
/// stub method that passes control for the render event to the the registered
/// event handler.
/// </summary>
protected virtual void OnDrawPane( Graphics g, MasterPane mp )
{
ZedGraphWebControlEventHandler handler;
handler = (ZedGraphWebControlEventHandler)Events[_eventRender];
MasterPaneFill.CopyTo( mp.Fill );
MasterPaneBorder.CopyTo( mp.Border );
if ( ( handler == null ) && ( CurveList.Count == 0 ) && ( GraphObjList.Count == 0 ) )
{
// default with the sample graph if no callback provided
foreach ( GraphPane p in mp.PaneList )
{
ZedGraphWeb.RenderDemo( g, p );
}
}
else
{
foreach ( GraphPane p in mp.PaneList )
{
// Add visual designer influences here - first!!
SetWebProperties( g, p );
// Add DataSource values if available before the callback
PopulateByDataSource( g, p );
//Add Graph Items
AddWebGraphItems( g, p );
}
//TODO: verify callback regression test
// Add custom callback tweeking next
if ( handler != null )
handler( this, g, mp );
// Set the layout according to user preferences
mp.ReSize( g );
}
}
示例2: 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;
}