本文整理汇总了C#中Eto.Drawing.Size类的典型用法代码示例。如果您正苦于以下问题:C# Size类的具体用法?C# Size怎么用?C# Size使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Size类属于Eto.Drawing命名空间,在下文中一共展示了Size类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MenuForm
/// <summary>
/// Creates a new menu form.
/// </summary>
/// <param name="title">Window title.</param>
/// <param name="itemNames">Item names.</param>
/// <param name="actions">Actions.</param>
public MenuForm(string title, string[] itemNames, Action[] actions)
{
Title = title;
SelectedIndex = -1;
if (itemNames == null || actions == null)
return;
if (itemNames.Length != actions.Length)
return;
var stackLayout = new StackLayout {Orientation = Orientation.Vertical, HorizontalContentAlignment = HorizontalAlignment.Stretch };
for (int i = 0; i < itemNames.Length; i++)
{
var idx = i;
var button = new Button { Text = itemNames[idx], Size = new Size(240, 60) };
button.Click += (s, e) =>
{
actions[idx]();
SelectedIndex = idx;
this.Close();
};
stackLayout.Items.Add(new StackLayoutItem(button, true));
}
Content = stackLayout;
Size = new Size(-1, -1);
}
示例2: CSyclesForm
public CSyclesForm(string path)
{
ClientSize = new Eto.Drawing.Size(500, 500);
Title = "CSycles Tester";
Path = path;
Image = new ef.ImageView();
var layout = new ef.TableLayout();
layout.Rows.Add(
new ef.TableRow(
Image
)
);
var scenes = Directory.EnumerateFiles(path, "scene*.xml");
Menu = new ef.MenuBar();
var scenesmenu = Menu.Items.GetSubmenu("scenes");
foreach(var sf in scenes)
{
scenesmenu.Items.Add(new RenderModalCommand(this, sf));
}
Content = layout;
var m = new RendererModel();
DataContext = m;
}
示例3: ImageForm
/// <summary>
/// Creates new image display form.
/// </summary>
/// <param name="title">Window title.</param>
public ImageForm(string title = "")
{
Title = title;
ClientSize = new Size(640, 480);
imageView = new ImageView { Image = bmp };
Content = new Scrollable
{
Content = imageView
};
}
示例4: SetImage
/// <summary>
/// Sets the specified image.
/// </summary>
/// <param name="image">Image to display.</param>
public void SetImage(Bgr<byte>[,] image)
{
if (bmp == null || bmp.Width != image.Width() || bmp.Height != image.Height())
{
bmp = new Bitmap(image.Width(), image.Height(), PixelFormat.Format24bppRgb);
}
BitmapData bmpData = bmp.Lock();
if (bmpData.BytesPerPixel != image.ColorInfo().Size)
{
bmpData.Dispose();
bmpData = null;
bmp = new Bitmap(image.Width(), image.Height(), PixelFormat.Format24bppRgb);
}
bmpData = bmpData ?? bmp.Lock();
using (var uIm = image.Lock())
{
Copy.UnsafeCopy2D(uIm.ImageData, bmpData.Data, uIm.Stride, bmpData.ScanWidth, uIm.Height);
}
bmpData.Dispose();
imageView.Image = bmp;
if (ScaleForm)
ClientSize = new Size(image.Width(), image.Height());
}
示例5: SetSizeAttributes
/// <summary>
/// Sets attributes on the specified <paramref name="element"/> with width and height attributes of the specified value
/// </summary>
/// <remarks>
/// This will write attributes with suffixes "-width" and "-height" prefixed by <paramref name="baseName"/>.
/// For example, if you specify "myProperty" as the base name, then it will write attributes "myProperty-width" and "myProperty-height".
///
/// Passing null as the size will not write either attribute value.
/// </remarks>
/// <param name="element">Element to write the width and height attributes on</param>
/// <param name="baseName">Base attribute name prefix</param>
/// <param name="value">Value to set the width and height attributes, if not null</param>
public static void SetSizeAttributes (this XmlElement element, string baseName, Size? value)
{
if (value != null) {
element.SetAttribute (baseName + "-width", value.Value.Width);
element.SetAttribute (baseName + "-height", value.Value.Height);
}
}
示例6: MainForm
public MainForm(IEnumerable<Section> topNodes = null)
{
Title = string.Format("Test Application [{0}, {1} {2}, {3}]",
Platform.ID,
EtoEnvironment.Is64BitProcess ? "64bit" : "32bit",
EtoEnvironment.Platform.IsMono ? "Mono" : ".NET",
EtoEnvironment.Platform.IsWindows ? EtoEnvironment.Platform.IsWinRT
? "WinRT" : "Windows" : EtoEnvironment.Platform.IsMac
? "Mac" : EtoEnvironment.Platform.IsLinux
? "Linux" : EtoEnvironment.Platform.IsUnix
? "Unix" : "Unknown");
Style = "main";
MinimumSize = new Size(400, 400);
topNodes = topNodes ?? TestSections.Get(TestApplication.DefaultTestAssemblies());
//SectionList = new SectionListGridView(topNodes);
//SectionList = new SectionListTreeView(topNodes);
if (Platform.IsAndroid)
SectionList = new SectionListGridView(topNodes);
else
SectionList = new SectionListTreeGridView(topNodes);
this.Icon = TestIcons.TestIcon;
if (Platform.IsDesktop)
ClientSize = new Size(900, 650);
//Opacity = 0.5;
Content = MainContent();
CreateMenuToolBar();
}
示例7: Paint
/// <summary>
/// Test paint operations on a drawable
/// </summary>
/// <param name="paint">Delegate to execute during the paint event</param>
/// <param name="size">Size of the drawable, or null for 200x200</param>
/// <param name="timeout">Timeout to wait for the operation to complete</param>
public static void Paint(Action<Drawable, PaintEventArgs> paint, Size? size = null, int timeout = DefaultTimeout)
{
Exception exception = null;
Form(form =>
{
var drawable = new Drawable { Size = size ?? new Size(200, 200) };
drawable.Paint += (sender, e) =>
{
try
{
paint(drawable, e);
}
catch (Exception ex)
{
exception = ex;
}
finally
{
Application.Instance.AsyncInvoke(form.Close);
}
};
form.Content = drawable;
}, timeout);
if (exception != null)
throw new Exception("Paint event caused exception", exception);
}
示例8: Init
void Init()
{
_comboBoxServices = new ComboBox();
_comboBoxServices.SelectedIndexChanged += _comboBoxServices_SelectedIndexChanged;
_textAreaInfo = new TextArea{Size=new Size(-1,200)};
_textAreaInfo.Enabled = false;
_textAreaResult = new TextArea();
_textAreaResult.Text = "If you wanna call one service, you can do like this:\n" +
"dynamic ToBase64 = PluginServiceProvider.GetService(\"ToBase64\");\n" +
"var result = ToBase64(new PluginParameter(\"str\", \"Test\"));\n" +
"//result=\"VGVzdA==\"";
_textAreaResult.Enabled = false;
var layout = new DynamicLayout {Padding = new Padding(10, 10)};
layout.AddSeparateRow(
new Label {Text = "The Registered Services", VerticalAlign = VerticalAlign.Middle},
_comboBoxServices);
layout.AddSeparateRow(_textAreaInfo);
layout.AddSeparateRow(_textAreaResult);
Content = layout;
Title = "Developer Tool";
Size = new Size(400, 400);
}
示例9: MyForm
public MyForm()
{
ClientSize = new Size(600, 400);
Title = "Table Layout";
Content = new TableLayout(
new TableRow(new Label { Text = "DataContext Binding" }, DataContextBinding()),
new TableRow(new Label { Text = "Object Binding" }, ObjectBinding()),
new TableRow(new Label { Text = "Direct Binding" }, DirectBinding()),
null // same as creating a row with ScaleHeight = true
) { Spacing = new Size(5, 5), Padding = new Padding(10) };
// Set data context so it propegates to all child controls
DataContext = new MyObject { TextProperty = "Initial value 1" };
Menu = new MenuBar
{
QuitItem = new Command((sender, e) => Application.Instance.Quit())
{
MenuText = "Quit",
Shortcut = Application.Instance.CommonModifier | Keys.Q
}
};
}
示例10: Rectangle
public Rectangle(Size size)
{
this.x = 0;
this.y = 0;
this.width = size.Width;
this.height = size.Height;
}
示例11: SetButtonsPosition
void SetButtonsPosition()
{
// remove the buttons
if (PixelLayout.Children.Contains(Buttons))
PixelLayout.Remove(Buttons);
var size = new Size(200, 200);
var location = Point.Empty;
var containerSize = PixelLayout.Size;
// X
if (Anchor.HasFlag(Anchor.Right) && !Anchor.HasFlag(Anchor.Left))
location.X = containerSize.Width - size.Width;
// Y
if (Anchor.HasFlag(Anchor.Bottom) && !Anchor.HasFlag(Anchor.Top))
location.Y = containerSize.Height - size.Height;
// Width
if (Anchor.HasFlag(Anchor.Left) && Anchor.HasFlag(Anchor.Right))
size.Width = containerSize.Width;
// Height
if (Anchor.HasFlag(Anchor.Top) && Anchor.HasFlag(Anchor.Bottom))
size.Height = containerSize.Height;
// At this point size and location are where
// Buttons should be displayed.
Buttons.Size = size;
PixelLayout.Add(Buttons, location);
}
示例12: ReadXml
public void ReadXml (XmlElement element)
{
var width = element.GetIntAttribute ("width");
var height = element.GetIntAttribute ("height");
var size = Size;
if (width != null) size.Width = width.Value;
if (height != null) size.Height = height.Value;
Size = size;
}
示例13: MainForm
public MainForm()
{
Title = "Notedown";
Icon = Icon.FromResource("Icon.ico");
ClientSize = new Size(800, 600);
Style = "MainWindow";
Update();
}
示例14: TableLayout
public TableLayout(Container container, Size size)
: base(container != null ? container.Generator : Generator.Current, container, typeof(ITableLayout), false)
{
inner = (ITableLayout)Handler;
this.Size = size;
Initialize ();
if (this.Container != null)
this.Container.Layout = this;
}
示例15: MainForm
public MainForm()
{
Title = "MachoMap";
Size = new Size(1280, 800);
Menu = new MenuBar();
ButtonMenuItem fileMenu = Menu.Items.GetSubmenu("&File");
fileMenu.Items.AddRange(new Command[] { new NewWindowCommand(), new OpenFileCommand(this) });
}