本文整理汇总了C#中Eto.Drawing.Size类的典型用法代码示例。如果您正苦于以下问题:C# Size类的具体用法?C# Size怎么用?C# Size使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Size类属于Eto.Drawing命名空间,在下文中一共展示了Size类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:gitter-badger,项目名称:dot-imaging,代码行数:36,代码来源:MenuForm.cs
示例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;
}
开发者ID:jesterKing,项目名称:CCSycles,代码行数:27,代码来源:CSyclesForm.cs
示例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
};
}
开发者ID:bestwpw,项目名称:dot-imaging,代码行数:16,代码来源:ImageForm.cs
示例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());
}
开发者ID:bestwpw,项目名称:dot-imaging,代码行数:32,代码来源:ImageForm.cs
示例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);
}
}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:19,代码来源:XmlExtensions.cs
示例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();
}
开发者ID:picoe,项目名称:Eto,代码行数:31,代码来源:MainForm.cs
示例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);
}
开发者ID:alexandrebaker,项目名称:Eto,代码行数:32,代码来源:FormTester.cs
示例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);
}
开发者ID:kevins1022,项目名称:Altman,代码行数:26,代码来源:DeveloperTool.cs
示例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
}
};
}
开发者ID:mhusen,项目名称:Eto,代码行数:25,代码来源:Main.cs
示例10: Rectangle
public Rectangle(Size size)
{
this.x = 0;
this.y = 0;
this.width = size.Width;
this.height = size.Height;
}
开发者ID:hultqvist,项目名称:Eto,代码行数:7,代码来源:Rectangle.cs
示例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);
}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:31,代码来源:AnchorSection.cs
示例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;
}
开发者ID:hultqvist,项目名称:Eto,代码行数:9,代码来源:XmlExtensions.cs
示例13: MainForm
public MainForm()
{
Title = "Notedown";
Icon = Icon.FromResource("Icon.ico");
ClientSize = new Size(800, 600);
Style = "MainWindow";
Update();
}
开发者ID:andererandre,项目名称:Notedown,代码行数:9,代码来源:MainForm.cs
示例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;
}
开发者ID:M1C,项目名称:Eto,代码行数:9,代码来源:TableLayout.cs
示例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) });
}
开发者ID:piedar,项目名称:MachoMap,代码行数:9,代码来源:MainForm.cs
示例16: ClipBoundsShouldMatchClientSize
public void ClipBoundsShouldMatchClientSize()
{
var size = new Size(200, 200);
TestUtils.Paint((drawable, e) =>
{
var graphics = e.Graphics;
Assert.AreEqual(size, drawable.ClientSize, "Drawable client size should be 200x200");
Assert.AreEqual(Size.Round(drawable.ClientSize), Size.Round(graphics.ClipBounds.Size), "Clip bounds should match drawable client size");
}, size);
}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:10,代码来源:ClipTests.cs
示例17: DynamicLayout
public DynamicLayout(Padding? padding, Size? spacing = null, Generator generator = null)
: base(generator)
{
topTable = new DynamicTable
{
Padding = padding,
Spacing = spacing
};
currentItem = topTable;
}
开发者ID:Exe0,项目名称:Eto,代码行数:10,代码来源:DynamicLayout.cs
示例18: 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);
PictureBox = new PictureBox { Image = bmp, AutoScale = true };
Content = PictureBox;
this.Shown += (s, e) => PictureBox.Image = bmp;
}
开发者ID:gitter-badger,项目名称:dot-imaging,代码行数:14,代码来源:ImageForm.cs
示例19: Box
public Box (Size canvasSize, bool useTexturesAndGradients)
{
var size = new SizeF(random.Next (50) + 50, random.Next (50) + 50);
var location = new PointF(random.Next (canvasSize.Width - (int)size.Width), random.Next (canvasSize.Height - (int)size.Height));
position = new RectangleF(location, size);
increment = new SizeF (random.Next (3) + 1, random.Next (3) + 1);
if (random.Next (2) == 1)
increment.Width = -increment.Width;
if (random.Next (2) == 1)
increment.Height = -increment.Height;
angle = random.Next (360);
rotation = (random.Next (20) - 10f) / 4f;
var rect = new RectangleF (size);
color = GetRandomColor (random);
switch (random.Next (useTexturesAndGradients ? 4 : 2)) {
case 0:
draw = (g) => g.DrawRectangle (color, rect);
erase = (g) => g.DrawRectangle (Colors.Black, rect);
break;
case 1:
draw = (g) => g.DrawEllipse (color, rect);
erase = (g) => g.DrawEllipse (Colors.Black, rect);
break;
case 2:
switch (random.Next (2)) {
case 0:
fillBrush = new LinearGradientBrush (GetRandomColor (random), GetRandomColor (random), PointF.Empty, new PointF(size.Width, size.Height));
break;
case 1:
fillBrush = new TextureBrush(texture) {
Transform = Matrix.FromScale (size / 80)
};
break;
}
draw = (g) => g.FillEllipse (fillBrush, rect);
erase = (g) => g.FillEllipse (Colors.Black, rect);
break;
case 3:
switch (random.Next (2)) {
case 0:
fillBrush = new LinearGradientBrush (GetRandomColor (random), GetRandomColor (random), PointF.Empty, new PointF(size.Width, size.Height));
break;
case 1:
fillBrush = new TextureBrush(texture) {
Transform = Matrix.FromScale (size / 80)
};
break;
}
draw = (g) => g.FillRectangle (fillBrush, rect);
erase = (g) => g.FillRectangle (Colors.Black, rect);
break;
}
}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:55,代码来源:DirectDrawingSection.cs
示例20: HiSumDisplay
public HiSumDisplay()
{
// sets the client (inner) size of the window for your content
ClientSize = new Eto.Drawing.Size(600, 400);
Title = "HiSum";
TreeGridView view = new TreeGridView(){Height = 500};
view.Columns.Add(new GridColumn() { HeaderText = "Summary", DataCell = new TextBoxCell(0), AutoSize = true, Resizable = true, Editable = false });
var textbox = new TextBox() {Width = 1000};
var button = new Button(){Text = "Go", Width = 15};
var label = new Label() {Width = 100};
var tbResult = new TextArea() {Width = 1000};
button.Click += (sender, e) =>
{
Reader reader = new Reader();
List<int> top100 = reader.GetTop100();
List<FullStory> fullStories = new List<FullStory>();
foreach (int storyID in top100.Take(30))
{
FullStory fullStory = reader.GetStoryFull(storyID);
fullStories.Add(fullStory);
}
TreeGridItemCollection data = GetTree(fullStories);
view.DataStore = data;
};
Content = new TableLayout
{
Spacing = new Size(5, 5), // space between each cell
Padding = new Padding(10, 10, 10, 10), // space around the table's sides
Rows = {
new TableRow(
new Label{Text = "Input URL from Hacker News: ",Width=200},
textbox,
button,
label
),
new TableRow(
null,
tbResult,
null,
null
),
new TableRow(
new Label(),
view
),
// by default, the last row & column will get scaled. This adds a row at the end to take the extra space of the form.
// otherwise, the above row will get scaled and stretch the TextBox/ComboBox/CheckBox to fill the remaining height.
new TableRow { ScaleHeight = true }
}
};
}
开发者ID:kzganesan,项目名称:HackerNewsSummary,代码行数:55,代码来源:HiSumDisplay.cs
注:本文中的Eto.Drawing.Size类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论