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


C# Entry.ModifyText方法代码示例

本文整理汇总了C#中Gtk.Entry.ModifyText方法的典型用法代码示例。如果您正苦于以下问题:C# Entry.ModifyText方法的具体用法?C# Entry.ModifyText怎么用?C# Entry.ModifyText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Entry的用法示例。


在下文中一共展示了Entry.ModifyText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Build

		void Build ()
		{
			BorderWidth = 0;
			WidthRequest = 901;
			HeightRequest = 632;

			Modal = true;
			Name = "wizard_dialog";
			Title = GettextCatalog.GetString ("New Protobuild Module");
			WindowPosition = WindowPosition.CenterOnParent;
			TransientFor = IdeApp.Workbench.RootWindow;

            projectConfigurationWidget = new GtkProtobuildModuleConfigurationWidget();
			projectConfigurationWidget.Name = "projectConfigurationWidget";

            creationWidget = new GtkProtobuildModuleCreationWidget ();
		    creationWidget.Name = "creationWidget";

			// Top banner of dialog.
			var topLabelEventBox = new EventBox ();
			topLabelEventBox.Name = "topLabelEventBox";
			topLabelEventBox.HeightRequest = 52;
			topLabelEventBox.ModifyBg (StateType.Normal, bannerBackgroundColor);
			topLabelEventBox.ModifyFg (StateType.Normal, whiteColor);
			topLabelEventBox.BorderWidth = 0;

			var topBannerTopEdgeLineEventBox = new EventBox ();
			topBannerTopEdgeLineEventBox.Name = "topBannerTopEdgeLineEventBox";
			topBannerTopEdgeLineEventBox.HeightRequest = 1;
			topBannerTopEdgeLineEventBox.ModifyBg (StateType.Normal, bannerLineColor);
			topBannerTopEdgeLineEventBox.BorderWidth = 0;

			var topBannerBottomEdgeLineEventBox = new EventBox ();
			topBannerBottomEdgeLineEventBox.Name = "topBannerBottomEdgeLineEventBox";
			topBannerBottomEdgeLineEventBox.HeightRequest = 1;
			topBannerBottomEdgeLineEventBox.ModifyBg (StateType.Normal, bannerLineColor);
			topBannerBottomEdgeLineEventBox.BorderWidth = 0;

			topBannerLabel = new Label ();
			topBannerLabel.Name = "topBannerLabel";
			Pango.FontDescription font = topBannerLabel.Style.FontDescription.Copy ();
			font.Size = (int)(font.Size * 1.8);
			topBannerLabel.ModifyFont (font);
			topBannerLabel.ModifyFg (StateType.Normal, whiteColor);
			var topLabelHBox = new HBox ();
			topLabelHBox.Name = "topLabelHBox";
			topLabelHBox.PackStart (topBannerLabel, false, false, 20);

            topSearchBox = new Entry();
            topSearchBox.Text = "";
            var normalText = topSearchBox.Style.Text(StateType.Normal);
            topSearchBox.FocusInEvent += (o, args) =>
            {
                topSearchBox.ModifyText(StateType.Normal, normalText);
                if (topSearchBox.Text == "Search online...")
                {
                    topSearchBox.Text = "";
                }
            };
		    topSearchBox.FocusOutEvent += (o, args) => {
                topSearchBox.ModifyText(StateType.Normal, new Color(128, 128, 128));
                if (topSearchBox.Text == "")
                {
                    topSearchBox.Text = "Search online...";
                }
		    };
            topLabelHBox.PackEnd(topSearchBox, false, false, 20);

			topLabelEventBox.Add (topLabelHBox);

			VBox.PackStart (topBannerTopEdgeLineEventBox, false, false, 0);
			VBox.PackStart (topLabelEventBox, false, false, 0);
			VBox.PackStart (topBannerBottomEdgeLineEventBox, false, false, 0);

			// Main templates section.
			centreVBox = new VBox ();
			centreVBox.Name = "centreVBox";
			VBox.PackStart (centreVBox, true, true, 0);
			templatesHBox = new HBox ();
			templatesHBox.Name = "templatesHBox";
			centreVBox.PackEnd (templatesHBox, true, true, 0);

			// Template categories.
			var templateCategoriesVBox = new VBox ();
			templateCategoriesVBox.Name = "templateCategoriesVBox";
			templateCategoriesVBox.BorderWidth = 0;
			templateCategoriesVBox.WidthRequest = 220;
			var templateCategoriesScrolledWindow = new ScrolledWindow ();
			templateCategoriesScrolledWindow.Name = "templateCategoriesScrolledWindow";
			templateCategoriesScrolledWindow.HscrollbarPolicy = PolicyType.Never;

			// Template categories tree view.
			templateCategoriesTreeView = new TreeView ();
			templateCategoriesTreeView.Name = "templateCategoriesTreeView";
			templateCategoriesTreeView.BorderWidth = 0;
			templateCategoriesTreeView.HeadersVisible = false;
			templateCategoriesTreeView.Model = templateCategoriesListStore;
			templateCategoriesTreeView.ModifyBase (StateType.Normal, categoriesBackgroundColor);
			templateCategoriesTreeView.AppendColumn (CreateTemplateCategoriesTreeViewColumn ());
			templateCategoriesScrolledWindow.Add (templateCategoriesTreeView);
//.........这里部分代码省略.........
开发者ID:Protobuild,项目名称:Protobuild.IDE.MonoDevelop,代码行数:101,代码来源:GtkNewProtobuildModuleDialogBackend.UI.cs


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