示例#1
0
        void Init()
        {
            //_textBoxUrl
            _textBoxUrl = new TextBox();

            //_buttonReadFile
            _buttonReadFile = new Button { Text = StrRes.GetString("StrLoad", "Load") };
            _buttonReadFile.Click += _buttonReadFile_Click;

            //_buttonSaveFile
            _buttonSaveFile = new Button {Text = StrRes.GetString("StrSave","Save")};
            _buttonSaveFile.Click += _buttonSaveFile_Click;

            //_textAreaBody
            _textAreaBody = new TextArea();

            var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) };
            layout.BeginVertical();
            layout.BeginHorizontal();
            layout.AddCentered(_textBoxUrl, xscale: true, horizontalCenter: false);
            layout.AddCentered(_buttonReadFile, horizontalCenter: false);
            layout.AddCentered(_buttonSaveFile, horizontalCenter: false);
            layout.EndBeginHorizontal();
            layout.EndVertical();

            layout.AddRow(_textAreaBody);

            Content = layout;
        }
示例#2
0
		Control CreateViews(Image image)
		{
			var layout = new DynamicLayout();
			layout.BeginHorizontal();
			layout.Add("ImageView");
			layout.AddAutoSized(new ImageView { Image = image });
			layout.AddAutoSized(new ImageView { Image = image, Size = new Size(64, 64) });
			layout.AddAutoSized(new ImageView { Image = image, Size = new Size(32, 32) });
			layout.EndBeginHorizontal();
			layout.Add("Drawable");
			layout.AddAutoSized(new DrawableImageView { Image = image });
			layout.AddAutoSized(new DrawableImageView { Image = image, MinimumSize = new Size(64, 64), ScaleImage = true });
			layout.AddAutoSized(new DrawableImageView { Image = image, MinimumSize = new Size(32, 32), ScaleImage = true });
			layout.EndBeginHorizontal();
			layout.Add("Button");
			layout.AddAutoSized(new Button { Image = image, Text = "Auto Size" });
			layout.AddAutoSized(new Button { Image = image, Text = "64px Height", Height = 64 });
			layout.AddAutoSized(new Button { Image = image, Text = "32px Height", Height = 32 });
			layout.EndBeginHorizontal();
			layout.EndHorizontal();
			return layout;
		}
示例#3
-1
		void Init()
		{
			//_textBoxUrl
			_textBoxUrl = new TextBox();

			//_buttonReadFile
			_buttonReadFile = new Button { Text = StrRes.GetString("StrLoad", "Load") };
			_buttonReadFile.Click += _buttonReadFile_Click;

			//_buttonSaveFile
			_buttonSaveFile = new Button {Text = StrRes.GetString("StrSave","Save")};
			_buttonSaveFile.Click += _buttonSaveFile_Click;

			//_textAreaBody
			_textAreaBody = new TextArea();
            //rightMenu_Body
            var rightMenuBody = new ContextMenu();
		    var findCommand = new Command
		    {
		        MenuText = StrRes.GetString("StrFind", "Find"),
		        Shortcut = Keys.F | Application.Instance.CommonModifier
		    };
            findCommand.Executed += findCommand_Executed;
            rightMenuBody.Items.Add(findCommand);

			var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) };
			layout.BeginVertical();
			layout.BeginHorizontal();
			layout.AddCentered(_textBoxUrl, xscale: true, horizontalCenter: false);
			layout.AddCentered(_buttonReadFile, horizontalCenter: false);
			layout.AddCentered(_buttonSaveFile, horizontalCenter: false);
			layout.EndBeginHorizontal();
			layout.EndVertical();

            layout.AddRow(_textAreaBody);

            // bug in gtk2
            layout.ContextMenu = rightMenuBody;
            layout.MouseUp += (sender, e) =>
            {
                if (e.Buttons == MouseButtons.Alternate)
                {
                    layout.ContextMenu.Show(_textAreaBody);
                }
            };

			Content = layout;
		}