本文整理汇总了C#中Generator.CreateShared方法的典型用法代码示例。如果您正苦于以下问题:C# Generator.CreateShared方法的具体用法?C# Generator.CreateShared怎么用?C# Generator.CreateShared使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator.CreateShared方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Instantiator
/// <summary>
/// Gets a delegate to instantiate objects of this type with minimal overhead
/// </summary>
/// <param name="generator">Generator to create the solid brushes</param>
public static Func<Color, SolidBrush> Instantiator (Generator generator = null)
{
var sharedHandler = generator.CreateShared<ISolidBrush> ();
return color => {
var control = sharedHandler.Create (color);
return new SolidBrush (sharedHandler, control);
};
}
示例2: DisplayBounds
public static RectangleF DisplayBounds (Generator generator = null)
{
var handler = generator.CreateShared <IScreens> ();
var bounds = RectangleF.Empty;
foreach (var screen in handler.Screens) {
bounds.Union (screen.Bounds);
}
return bounds;
}
示例3: LinearGradientBrush
#pragma warning disable 612,618
/// <summary>
/// Initializes a new instance of the <see cref="Eto.Drawing.LinearGradientBrush"/> class between two points
/// </summary>
/// <param name="startColor">Start color for the gradient</param>
/// <param name="endColor">End color for the gradient</param>
/// <param name="startPoint">Start point for the gradient</param>
/// <param name="endPoint">End point for the gradient</param>
/// <param name="generator">Generator to create the brush, or null to use the current generator</param>
public LinearGradientBrush(Color startColor, Color endColor, PointF startPoint, PointF endPoint, Generator generator)
{
handler = generator.CreateShared<IHandler>();
ControlObject = handler.Create(startColor, endColor, startPoint, endPoint);
}
示例4: Instantiator
/// <summary>
/// Gets a delegate to instantiate <see cref="LinearGradientBrush"/> objects
/// </summary>
/// <remarks>
/// Use this to instantiate many objects of this type
/// </remarks>
/// <param name="generator">Generator to create the objects with</param>
public static Func<Color, Color, PointF, PointF, LinearGradientBrush> Instantiator (Generator generator = null)
{
var handler = generator.CreateShared<ILinearGradientBrush>();
return (startColor, endColor, startPoint, endPoint) => {
var control = handler.Create (startColor, endColor, startPoint, endPoint);
return new LinearGradientBrush (handler, control);
};
}
示例5: Pen
public Pen(Color color, float thickness, Generator generator)
{
handler = generator.CreateShared<IHandler>();
ControlObject = handler.Create(color, thickness);
}
示例6: Handler
static IMouse Handler (Generator generator)
{
return generator.CreateShared<IMouse> ();
}
示例7: Instantiator
/// <summary>
/// Gets an instantiator for the texture brush to create instances
/// </summary>
/// <remarks>
/// This can be used to instantiate texture brushes when creating many brushes to minimize overhead
/// </remarks>
/// <param name="generator">Generator to create the brush</param>
public Func<Image, float, TextureBrush> Instantiator (Generator generator = null)
{
var handler = generator.CreateShared<ITextureBrush> ();
return (image, opacity) => {
return new TextureBrush (handler, image, opacity);
};
}
示例8: TextureBrush
/// <summary>
/// Initializes a new instance of the <see cref="Eto.Drawing.TextureBrush"/> class.
/// </summary>
/// <param name="image">Image for the brush</param>
/// <param name="opacity">Opacity of the texture to apply to the brush when painting</param>
/// <param name="generator">Generator to create the brush</param>
public TextureBrush (Image image, float opacity = 1f, Generator generator = null)
{
this.Image = image;
handler = generator.CreateShared<ITextureBrush> ();
ControlObject = handler.Create (image, opacity);
}
示例9: AvailableFontFamilies
/// <summary>
/// Gets an enumeration of available font families in the current system
/// </summary>
/// <param name="generator">Generator to get the font families for</param>
/// <returns>An enumeration of font family objects that this system supports</returns>
public static IEnumerable<FontFamily> AvailableFontFamilies (Generator generator = null)
{
var fonts = generator.CreateShared<IFonts>();
return fonts.AvailableFontFamilies;
}
示例10: GetFolderPath
/// <summary>
/// Gets the folder path for the specified special folder
/// </summary>
/// <param name="folder">Special folder to retrieve the path for</param>
/// <param name="generator">Generator to get the folder path with</param>
/// <returns>Path of the specified folder</returns>
public static string GetFolderPath (EtoSpecialFolder folder, Generator generator = null)
{
var handler = generator.CreateShared<IEtoEnvironment> ();
return handler.GetFolderPath (folder);
}
示例11: SolidBrush
public SolidBrush(Color color, Generator generator = null)
{
handler = generator.CreateShared <IHandler>();
ControlObject = handler.Create(color);
}
示例12: Pen
/// <summary>
/// Creates a new pen with the specified <paramref name="color"/> and <paramref name="thickness"/>
/// </summary>
/// <param name="color">Color for the new pen</param>
/// <param name="thickness">Thickness of the new pen</param>
/// <param name="generator">Generator to create the pen for</param>
public Pen (Color color, float thickness = 1f, Generator generator = null)
{
handler = generator.CreateShared<IPen> ();
ControlObject = handler.Create (color, thickness);
}
示例13: Instantiator
/// <summary>
/// Gets a delegate that can be used to create instances of the Pen with low overhead
/// </summary>
/// <param name="generator">Generator to create the pens</param>
public Func<Color, float, Pen> Instantiator (Generator generator = null)
{
var handler = generator.CreateShared<IPen> ();
return (color, thickness) => {
var control = handler.Create (color, thickness);
return new Pen (handler, control);
};
}
示例14: PrimaryScreen
public static Screen PrimaryScreen (Generator generator = null)
{
var handler = generator.CreateShared <IScreens>();
return handler.PrimaryScreen;
}
示例15: Screens
public static IEnumerable<Screen> Screens (Generator generator = null)
{
var handler = generator.CreateShared <IScreens>();
return handler.Screens;
}