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


C# Xwt.Button类代码示例

本文整理汇总了C#中Xwt.Button的典型用法代码示例。如果您正苦于以下问题:C# Button类的具体用法?C# Button怎么用?C# Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Button类属于Xwt命名空间,在下文中一共展示了Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ThemedImages

        public ThemedImages()
        {
            Context.RegisterStyles ("dark", "sel");

            var img = Image.FromResource ("zoom-in-16.png");
            var img_sel = Image.FromResource ("zoom-in-16.png").WithStyles("sel");
            var img_dark = Image.FromResource ("zoom-in-16.png").WithStyles("dark");
            var img_dark_sel = Image.FromResource ("zoom-in-16.png").WithStyles("dark", "sel");

            var img_row = new HBox ();
            ImageView imgv = new ImageView () { Image = img };
            ImageView imgv_sel = new ImageView () { Image = img_sel };
            ImageView imgv_dark = new ImageView () { Image = img_dark };
            ImageView imgv_dark_sel = new ImageView () { Image = img_dark_sel };
            img_row.PackStart (imgv);
            img_row.PackStart (imgv_sel);
            img_row.PackStart (imgv_dark);
            img_row.PackStart (imgv_dark_sel);
            PackStart (img_row);

            var btn_row = new HBox ();
            Button btn = new Button (img);
            Button btn_sel = new Button (img_sel);
            Button btn_dark = new Button (img_dark);
            Button btn_dark_sel = new Button (img_dark_sel);
            btn_row.PackStart (btn);
            btn_row.PackStart (btn_sel);
            btn_row.PackStart (btn_dark);
            btn_row.PackStart (btn_dark_sel);
            PackStart (btn_row);
        }
开发者ID:akrisiun,项目名称:xwt,代码行数:31,代码来源:ThemedImages.cs

示例2: ListView

		void IOptionsPanel.Initialize (OptionsDialog dialog, object dataObject)
		{
			this.ExpandHorizontal = true;
			this.ExpandVertical = true;
			this.HeightRequest = 400;
			list = new ListView ();
			store = new ListStore (language, completeOnSpace, completeOnChars);

			var languageColumn = list.Columns.Add (GettextCatalog.GetString ("Language"), language);
			languageColumn.CanResize = true;

			var checkBoxCellView = new CheckBoxCellView (completeOnSpace);
			checkBoxCellView.Editable = true;
			var completeOnSpaceColumn = list.Columns.Add (GettextCatalog.GetString ("Complete on space"), checkBoxCellView);
			completeOnSpaceColumn.CanResize = true;

			var textCellView = new TextCellView (completeOnChars);
			textCellView.Editable = true;
			var doNotCompleteOnColumn = list.Columns.Add (GettextCatalog.GetString ("Do complete on"), textCellView);
			doNotCompleteOnColumn.CanResize = true;
			list.DataSource = store;
			PackStart (list, true, true);

			var hbox = new HBox ();
			var button = new Button ("Reset to default");
			button.Clicked += delegate {
				FillStore (CompletionCharacters.GetDefaultCompletionCharacters ());
			};	
			hbox.PackEnd (button, false, false);
			PackEnd (hbox, false, true);
			FillStore (CompletionCharacters.GetCompletionCharacters ());
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:32,代码来源:CompletionCharactersPanel.cs

示例3: ListView1

		public ListView1 ()
		{
			PackStart (new Label ("The listview should have a red background"));
			ListView list = new ListView ();
			list.GridLinesVisible = GridLines.Both;
			ListStore store = new ListStore (name, icon, text, icon2, progress);
			list.DataSource = store;
			list.Columns.Add ("Name", icon, name);
			list.Columns.Add ("Text", icon2, text);
			list.Columns.Add ("Progress", new TextCellView () { TextField = text }, new CustomCell () { ValueField = progress });

			var png = Image.FromResource (typeof(App), "class.png");

			Random rand = new Random ();
			
			for (int n=0; n<100; n++) {
				var r = store.AddRow ();
				store.SetValue (r, icon, png);
				store.SetValue (r, name, "Value " + n);
				store.SetValue (r, icon2, png);
				store.SetValue (r, text, "Text " + n);
				store.SetValue (r, progress, new CellData { Value = rand.Next () % 100 });
			}
			PackStart (list, true);

			list.RowActivated += delegate(object sender, ListViewRowEventArgs e) {
				MessageDialog.ShowMessage ("Row " + e.RowIndex + " activated");
			};

			Menu contextMenu = new Menu ();
			contextMenu.Items.Add (new MenuItem ("Test menu"));
			list.ButtonPressed += delegate(object sender, ButtonEventArgs e) {
				int row = list.GetRowAtPosition(new Point(e.X, e.Y));
				if (e.Button == PointerButton.Right && row >= 0) {
					// Set actual row to selected
					list.SelectRow(row);
					contextMenu.Popup(list, e.X, e.Y);
				}
			};

			var but = new Button ("Scroll one line");
			but.Clicked += delegate {
				list.VerticalScrollControl.Value += list.VerticalScrollControl.StepIncrement;
			};
			PackStart (but);

			var spnValue = new SpinButton ();
			spnValue.MinimumValue = 0;
			spnValue.MaximumValue = 99;
			spnValue.IncrementValue = 1;
			spnValue.Digits = 0;
			var btnScroll = new Button ("Go!");
			btnScroll.Clicked += (sender, e) => list.ScrollToRow((int)spnValue.Value);

			HBox scrollActBox = new HBox ();
			scrollActBox.PackStart (new Label("Scroll to Value: "));
			scrollActBox.PackStart (spnValue);
			scrollActBox.PackStart (btnScroll);
			PackStart (scrollActBox);
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:60,代码来源:ListView1.cs

示例4: GenerateFrameContents

		VBox GenerateFrameContents (bool useMnemonics)
		{
			var statusText = useMnemonics ? "with mnemonic" : "without mnemonic";
			var vbox = new VBox ();

			var button = new Button ("_Button");
			button.UseMnemonic = useMnemonics;
			button.Clicked += (sender, e) => MessageDialog.ShowMessage (string.Format ("Button {0} clicked.", statusText));
			vbox.PackStart (button);

			var toggleButton = new ToggleButton ("_Toggle Button");
			toggleButton.UseMnemonic = useMnemonics;
			toggleButton.Clicked += (sender, e) => MessageDialog.ShowMessage (string.Format ("Toggle Button {0} clicked.", statusText));
			vbox.PackStart (toggleButton);

			var menuButton = new MenuButton ("_Menu Button");
			menuButton.UseMnemonic = useMnemonics;
			menuButton.Label = "_Menu Button";
			var firstMenuItem = new MenuItem ("_First");
			firstMenuItem.UseMnemonic = useMnemonics;
			firstMenuItem.Clicked += (sender, e) => MessageDialog.ShowMessage (string.Format ("First Menu Item {0} clicked.", statusText));
			var secondMenuItem = new MenuItem ("_Second");
			secondMenuItem.UseMnemonic = useMnemonics;
			secondMenuItem.Clicked += (sender, e) => MessageDialog.ShowMessage (string.Format ("Second Menu Item {0} clicked.", statusText));
			var menu = new Menu ();
			menu.Items.Add (firstMenuItem);
			menu.Items.Add (secondMenuItem);
			menuButton.Menu = menu;
			vbox.PackStart (menuButton);

			return vbox;
		}
开发者ID:m13253,项目名称:xwt,代码行数:32,代码来源:Mnemonics.cs

示例5: LoginView

        public LoginView(LauncherWindow window)
        {
            Window = window;
            this.MinWidth = 250;

            ErrorLabel = new Label("Username or password incorrect")
            {
                TextColor = Color.FromBytes(255, 0, 0),
                TextAlignment = Alignment.Center,
                Visible = false
            };
            UsernameText = new TextEntry();
            PasswordText = new PasswordEntry();
            LogInButton = new Button("Log In");
            RegisterButton = new Button("Register");
            RememberCheckBox = new CheckBox("Remember Me");
            UsernameText.Text = UserSettings.Local.Username;
            if (UserSettings.Local.AutoLogin)
            {
                PasswordText.Password = UserSettings.Local.Password;
                RememberCheckBox.Active = true;
            }

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.truecraft-logo.png"))
                TrueCraftLogoImage = new ImageView(Image.FromStream(stream));

            UsernameText.PlaceholderText = "Username";
            PasswordText.PlaceholderText = "Password";
            PasswordText.KeyReleased += (sender, e) =>
            {
                if (e.Key == Key.Return || e.Key == Key.NumPadEnter)
                    LogInButton_Clicked(sender, e);
            };
            UsernameText.KeyReleased += (sender, e) =>
            {
                if (e.Key == Key.Return || e.Key == Key.NumPadEnter)
                    LogInButton_Clicked(sender, e);
            };
            RegisterButton.Clicked += (sender, e) =>
            {
                if (RegisterButton.Label == "Register")
                    Window.WebView.Url = "http://truecraft.io/register";
                else
                {
                    Window.User.Username = UsernameText.Text;
                    Window.User.SessionId = "-";
                    Window.MainContainer.Remove(this);
                    Window.MainContainer.PackEnd(Window.MainMenuView = new MainMenuView(Window));
                }
            };
            LogInButton.Clicked += LogInButton_Clicked;

            this.PackStart(TrueCraftLogoImage);
            this.PackEnd(RegisterButton);
            this.PackEnd(LogInButton);
            this.PackEnd(RememberCheckBox);
            this.PackEnd(PasswordText);
            this.PackEnd(UsernameText);
            this.PackEnd(ErrorLabel);
        }
开发者ID:Luigifan,项目名称:TrueCraft,代码行数:60,代码来源:LoginView.cs

示例6: ListViewEntries

        public ListViewEntries()
        {
            ListView list = new ListView ();
            var editableTextField = new DataField<string> ();
            var nonEditableTextField = new DataField<string> ();

            ListStore store = new ListStore (editableTextField, nonEditableTextField);
            list.DataSource = store;
            list.GridLinesVisible = GridLines.Horizontal;

            var textCellView = new TextCellView { Editable = true, TextField = editableTextField };
            list.Columns.Add (new ListViewColumn ("Editable", textCellView));
            list.Columns.Add (new ListViewColumn ("Not Editable", new TextCellView { Editable = false, TextField = nonEditableTextField }));

            Random rand = new Random ();

            for (int n = 0; n < 10; n++) {
                var r = store.AddRow ();
                store.SetValue (r, editableTextField, "Editable value " + n);
                store.SetValue (r, nonEditableTextField, "Non-editable value " + n);
            }
            PackStart (list, true);
            var btn = new Button ("Add Row");
            btn.Clicked += delegate {
                var row = store.AddRow ();
                store.SetValues (row, editableTextField, "New editable text", nonEditableTextField, "New non-editable text");
                list.StartEditingCell (row, textCellView);
            };
            PackStart (btn, false, hpos: WidgetPlacement.Start);
        }
开发者ID:akrisiun,项目名称:xwt,代码行数:30,代码来源:ListViewEntries.cs

示例7: BuildGui

        void BuildGui()
        {
            this.Title = GettextCatalog.GetString("Select Work Item");
            VBox content = new VBox();
            HBox mainBox = new HBox();
            queryView.Columns.Add(new ListViewColumn(string.Empty, new TextCellView(titleField)));
            queryView.DataSource = queryStore;
            queryView.WidthRequest = 200;
            BuildQueryView();
            mainBox.PackStart(queryView);

            workItemList.WidthRequest = 400;
            workItemList.HeightRequest = 400;
            workItemList.ShowCheckboxes = true;

            mainBox.PackStart(workItemList, true, true);

            content.PackStart(mainBox, true, true);

            HBox buttonBox = new HBox();

            Button okButton = new Button(GettextCatalog.GetString("Ok"));
            okButton.WidthRequest = Constants.ButtonWidth;
            okButton.Clicked += (sender, e) => Respond(Command.Ok);
            buttonBox.PackEnd(okButton);

            content.PackStart(buttonBox);
            //this.Resizable = false;
            this.Content = content;

            AttachEvents();
        }
开发者ID:Indomitable,项目名称:monodevelop-tfs-addin,代码行数:32,代码来源:SelectWorkItemDialog.cs

示例8: HandleClicked

        void HandleClicked(object sender, EventArgs e)
        {
            if (popover == null) {
                popover = new Popover ();

                var table = new Table () { DefaultColumnSpacing = 20, DefaultRowSpacing = 10 };
            //					table.Margin.SetAll (60);
                table.Attach (new Label ("Font") { TextAlignment = Alignment.End }, 0, 0);
                table.Attach (new ComboBox (), 1, 0, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                table.Attach (new Label ("Family")  { TextAlignment = Alignment.End }, 0, 1);
                table.Attach (new ComboBox (), 1, 1, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                table.Attach (new Label ("Style")  { TextAlignment = Alignment.End }, 0, 2);
                table.Attach (new ComboBox (), 1, 2, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                table.Attach (new Label ("Size")  { TextAlignment = Alignment.End }, 0, 3);
                table.Attach (new SpinButton (), 1, 3, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand);

                var b = new Button ("Add more");
                table.Attach (b, 0, 4);
                int next = 5;
                b.Clicked += delegate {
                    table.Attach (new Label ("Row " + next), 0, next++);
                };

                table.Margin = 20;
                popover.Content = table;
            }
            //			popover.Padding.SetAll (20);
            popover.Show (Popover.Position.Top, (Button)sender);
        }
开发者ID:pabloescribano,项目名称:xwt,代码行数:32,代码来源:PopoverSample.cs

示例9: ListView1

        public ListView1()
        {
            PackStart (new Label ("The listview should have a red background"));
            ListView list = new ListView ();
            ListStore store = new ListStore (name, icon, text, icon2, progress);
            list.DataSource = store;
            list.Columns.Add ("Name", icon, name);
            list.Columns.Add ("Text", icon2, text);
            list.Columns.Add ("Progress", new CustomCell () { ValueField = progress });

            var png = Image.FromResource (typeof(App), "class.png");

            Random rand = new Random ();

            for (int n=0; n<100; n++) {
                var r = store.AddRow ();
                store.SetValue (r, icon, png);
                store.SetValue (r, name, "Value " + n);
                store.SetValue (r, icon2, png);
                store.SetValue (r, text, "Text " + n);
                store.SetValue (r, progress, rand.Next () % 100);
            }
            PackStart (list, true);

            list.RowActivated += delegate(object sender, ListViewRowEventArgs e) {
                MessageDialog.ShowMessage ("Row " + e.RowIndex + " activated");
            };

            var but = new Button ("Scroll one line");
            but.Clicked += delegate {
                list.VerticalScrollControl.Value += list.VerticalScrollControl.StepIncrement;
            };
            PackStart (but);
        }
开发者ID:nbros,项目名称:xwt,代码行数:34,代码来源:ListView1.cs

示例10: DragDrop

        public DragDrop()
        {
            HBox box = new HBox ();

            SimpleBox b1 = new SimpleBox (30);
            box.PackStart (b1, BoxMode.None);

            b2 = new Button ("Drop here");
            box.PackEnd (b2, BoxMode.None);

            b1.ButtonPressed += delegate {
                var d = b1.CreateDragOperation ();
                d.Data.AddValue ("Hola");
                var img = Image.FromResource (GetType(), "class.png");
                d.SetDragImage (img, (int)img.Size.Width, (int)img.Size.Height);
                d.AllowedActions = DragDropAction.All;
                d.Start ();
            };

            b2.SetDragDropTarget (TransferDataType.Text, TransferDataType.Uri);
            PackStart (box);

            b2.DragDrop += HandleB2DragDrop;
            b2.DragOver += HandleB2DragOver;
        }
开发者ID:RevolutionSmythe,项目名称:xwt,代码行数:25,代码来源:DragDrop.cs

示例11: ReportViewer

        public ReportViewer()
        {
            // Setup layout boxes
            vboxContents = new Xwt.VBox();
            vboxToolMenu = new Xwt.HBox();

            // Setup tool button menu
            Xwt.Button buttonExport = new Xwt.Button("Export");
            buttonExport.Clicked += delegate(object sender, EventArgs e) {
                SaveAs();
            };
            vboxToolMenu.PackStart(buttonExport);

            Xwt.Button buttonPrint = new Xwt.Button("Print");
            vboxToolMenu.PackStart(buttonPrint);

            // Add vboxContent widgets
            vboxPages = new Xwt.VBox();
            vboxContents.PackStart(vboxToolMenu);
            vboxContents.PackStart(vboxPages);

            // Setup Controls Contents
            scrollView = new Xwt.ScrollView();
            scrollView.Content = vboxContents;
            scrollView.VerticalScrollPolicy = ScrollPolicy.Automatic;
            scrollView.BorderVisible = true;
            this.PackStart(scrollView, BoxMode.FillAndExpand);

            Parameters = new ListDictionary();

            ShowErrors = false;
        }
开发者ID:kevindqc,项目名称:My-FyiReporting,代码行数:32,代码来源:ReportViewer.cs

示例12: SplashWindow

        public SplashWindow()
        {
            Icon = App.Icon;

            Width = 550;

            Title = "4Plug First Use";
            Resizable = false;

            VBox V = new VBox();
            Content = V;

            Label lbl;

            lbl = new Label("A small introduction.") { Font = Font.FromName("Segoe UI Light 24"), TextColor = PluginType.Vpk.GetColor() };
            V.PackStart(lbl);

            lbl = new Label("This tool allows you to quickly enable/disable mods as well as install new ones.");
            V.PackStart(lbl);

            lbl = new Label(""); V.PackStart(lbl);

            lbl = new Label("This is what a mod looks like in 4Plug!") { Font = Font.FromName("Segoe UI Light 24"), TextColor = PluginType.Unknown.GetColor() };
            V.PackStart(lbl);

            lbl = new Label("You can enable/disable mods by clicking on the image.");
            V.PackStart(lbl);

            //lbl = new Label("Uninstalled mods are saved in the \"custom_\" instead of the \"custom\" folder of you game.");
            //V.PackStart(lbl);

            lbl = new Label("");

            DummyPluginWidget dummy = new DummyPluginWidget(lbl);
            dummy.MarginTop += 16;
            dummy.MarginBottom += 8;
            V.PackStart(dummy);

            V.PackStart(lbl);

            lbl = new Label(""); V.PackStart(lbl);

            {
                HBox box = new HBox();
                Button btn;

                btn = new Button(" Got it! ");
                box.PackEnd(btn);
                btn.Clicked += (s, e) => { Close(); };

                Label lbl2;
                lbl2 = new Label(" Feel free to leave feedback (mainmenu -> submit feedback) later ");
                box.PackStart(lbl2);
                //btn.Clicked += (s, e) => { new SubmitFeedbackWindow("via Splash Window").Run(); };

                V.PackStart(box);
            }
        }
开发者ID:fourtf,项目名称:4Plug,代码行数:58,代码来源:SplashWindow.cs

示例13: PopoverSample

		public PopoverSample ()
		{
			var btn = new Button ("Click me");
			btn.Clicked += HandleClicked;
			PackStart (btn);
			var btn2 = new Button ("Click me");
			btn2.Clicked += HandleClicked2;
			PackEnd (btn2);
		}
开发者ID:m13253,项目名称:xwt,代码行数:9,代码来源:PopoverSample.cs

示例14: LogLevelChooser

        public LogLevelChooser(LogLevel selectedLogLevel)
        {
            SelectedLogLevel = selectedLogLevel;

            // prerender
            string[] logNames = Enum.GetNames(typeof(LogLevel));
            int length = logNames.Length;
            renderedImage = new Image[length];

            using (TextLayout text = new TextLayout()) {
                for (int i = 0; i < length; i++) {
                    text.Text = logNames[i];
                    Size size = text.GetSize();
                    using (ImageBuilder ib = new ImageBuilder(size.Width + size.Height*2 + 3, size.Height)) {
                        Color color = Color.FromName(Log.LevelToColorString((LogLevel) i));

                        Draw(ib.Context, (LogLevel) i, color);
                        renderedImage[i] = ib.ToBitmap();

                        Button button = new Button { Image = renderedImage[i], ImagePosition = ContentPosition.Left };
                        button.HorizontalPlacement = WidgetPlacement.Start;
                        button.Margin = 0;
                        button.ExpandHorizontal = true;
                        button.Style = ButtonStyle.Flat;
                        buttons.PackStart(button, true, true);

                        button.CanGetFocus = false;
                        button.Tag = i;
                        button.Clicked += OnLogChange;

                        windowHeight += size.Height * 2;
                    }
                }
            }

            // hide window on lost fokus
            buttons.CanGetFocus = true;
            buttons.LostFocus += delegate {
                if (menuHide != null) {
                    menuHide(this, EventArgs.Empty);
                }

                popupWindow.Hide();
            };
            buttons.ButtonPressed += delegate {
                // do nothing
                // workaround to propagate event to each button
            };

            buttons.Spacing = 0;

            popupWindow.Padding = 0;
            popupWindow.ShowInTaskbar = false;
            popupWindow.Decorated = false;
            popupWindow.Content = buttons;
        }
开发者ID:jfreax,项目名称:BAIMP,代码行数:56,代码来源:LogLevelChooser.cs

示例15: SubmitFeedbackWindow

        public SubmitFeedbackWindow(string category)
        {
            Icon = App.Icon;
            Title = "Thanks for your feedback!";

            Resizable = false;

            VBox vbox = new VBox();

            var text = new TextEntry()
            {
                MinWidth = 500,
                MinHeight = 200,
                MultiLine = true,
                Text = ""
            };

            vbox.PackStart(text);
            {
                HBox box = new HBox();

                Button btn;
                box.PackEnd(btn = new Button(" Cancel "));
                btn.Clicked += (s, e) => { Close(); };

                box.PackEnd(btn = new Button(" Submit "));
                btn.Clicked += (s, e) =>
                {
                    string feedback = text.Text;
                    new Task(() =>
                        {
                            if (feedback.Length > 10)
                            {
                                string URL = "http://yuhrney.square7.ch/4Plug/feedback.php";
                                WebClient webClient = new WebClient();
                                webClient.Proxy = null;

                                NameValueCollection formData = new NameValueCollection();

                                formData["feedback"] = string.Format("{3} - {1} {2}\n{5}\n{4}", App.WindowTitle, Environment.OSVersion.Platform, Xwt.Toolkit.CurrentEngine.Type, DateTime.Now.ToString("dd MMM HH:mm:ss", CultureInfo.InvariantCulture), feedback, category).Trim();

                                byte[] responseBytes = webClient.UploadValues(URL, "POST", formData);
                                string responsefromserver = Encoding.UTF8.GetString(responseBytes);
                                Console.WriteLine(responsefromserver);
                                webClient.Dispose();
                            }

                        }).Start();
                    Close();
                };

                vbox.PackStart(box);

                Content = vbox;
            }
        }
开发者ID:fourtf,项目名称:4Plug,代码行数:56,代码来源:SubmitFeedbackWindow.cs


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