当前位置: 首页>>代码示例>>C#>>正文


C# Drawing.Size类代码示例

本文整理汇总了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);
        }
开发者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


注:本文中的Eto.Drawing.Size类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。