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


C# Gtk.RenderIcon方法代码示例

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


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

示例1: LoadIcon

		public static Gdk.Pixbuf LoadIcon (Gtk.Widget widget, string name, Gtk.IconSize size)
		{
			Gdk.Pixbuf res = widget.RenderIcon (name, size, null);
			if ((res != null)) {
				return res;
			} else {
				int sz;
				int sy;
				global::Gtk.Icon.SizeLookup (size, out  sz, out  sy);
				try {
					return Gtk.IconTheme.Default.LoadIcon (name, sz, 0);
				} catch (System.Exception) {
					if ((name != "gtk-missing-image")) {
						return Stetic.IconLoader.LoadIcon (widget, "gtk-missing-image", size);
					} else {
						Gdk.Pixmap pmap = new Gdk.Pixmap (Gdk.Screen.Default.RootWindow, sz, sz);
						Gdk.GC gc = new Gdk.GC (pmap);
						gc.RgbFgColor = new Gdk.Color (255, 255, 255);
						pmap.DrawRectangle (gc, true, 0, 0, sz, sz);
						gc.RgbFgColor = new Gdk.Color (0, 0, 0);
						pmap.DrawRectangle (gc, false, 0, 0, (sz - 1), (sz - 1));
						gc.SetLineAttributes (3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
						gc.RgbFgColor = new Gdk.Color (255, 0, 0);
						pmap.DrawLine (gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), ((sz - 1) - (sz / 4)));
						pmap.DrawLine (gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)));
						return Gdk.Pixbuf.FromDrawable (pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz);
					}
				}
			}
		}
开发者ID:pacificIT,项目名称:mono-upnp,代码行数:30,代码来源:generated.cs

示例2: SetRecognizeIcon

 void SetRecognizeIcon(Gtk.Image img, float confidence)
 {
     if(confidence == 2) //Исправлено пользователем.
     {
         img.Pixbuf = img.RenderIcon(Stock.Apply, IconSize.Button, "");
         img.TooltipText =  String.Format("Исправлено.");
     }
     else if(confidence > 0.8)
     {
         img.Pixbuf = img.RenderIcon(Stock.Yes, IconSize.Button, "");
         img.TooltipText =  String.Format("ОК. Доверие: {0}", confidence);
     }
     else if(confidence == -1) //Распознования не проводилось
     {
         img.Pixbuf = img.RenderIcon(Stock.DialogQuestion, IconSize.Button, "");
         img.TooltipText =  String.Format("Распознование не проводилось.");
     }
     else if(confidence == -2) //Результат не прошел проверку.
     {
         img.Pixbuf = img.RenderIcon(Stock.No, IconSize.Button, "");
         img.TooltipText =  String.Format("Результат не прошёл проверку.");
     }
     else
     {
         img.Pixbuf = img.RenderIcon(Stock.DialogWarning, IconSize.Button, "");
         img.TooltipText =  String.Format("Не точно. Доверие: {0}", confidence);
     }
 }
开发者ID:QualitySolution,项目名称:earchive,代码行数:28,代码来源:InputDocs.cs

示例3: LoadStockIcon

 /// <summary>
 /// Loads the stock icon for a given name and size.
 /// </summary>
 /// <returns>The stock icon.</returns>
 /// <param name="widget">Widget to get the icon for. Themes can modify the stock icon for a specific widget.</param>
 /// <param name="name">Name.</param>
 /// <param name="size">Size as Gtk.IconSize.</param>
 public static Gdk.Pixbuf LoadStockIcon(Gtk.Widget widget, string name, Gtk.IconSize size)
 {
     Gdk.Pixbuf res = widget.RenderIcon (name, size, null);
     if ((res != null)) {
         return res;
     } else {
         return LoadMissingIcon (size);
     }
 }
开发者ID:GNOME,项目名称:longomatch,代码行数:16,代码来源:Misc.cs

示例4: Render

		protected override void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
		{
			int x;
			int y;
			int width;
			int height;
			
			Gdk.Pixbuf buf = widget.RenderIcon(_stockId, Gtk.IconSize.Menu, string.Empty);
			
			Gtk.StateType state = Gtk.StateType.Normal;
			
			if (Prelight)
			{
				state = Gtk.StateType.Prelight;
			}
			if (Active)
			{
				state = Gtk.StateType.Active;	
			}
			
			GetSize(widget, ref cell_area, out x, out y, out width, out height); 
			Gtk.Style.PaintBox(widget.Style, window, state,
			                      Gtk.ShadowType.In, cell_area, widget, "buttondefault",
			                      cell_area.X + x, cell_area.Y + y,
			                      width, height);
			
			Gdk.GC gc = new Gdk.GC(window);
			
			if (buf != null)
			{
				int xOffset = 2 + ((width - buf.Width) / 2) + cell_area.X;
				int yOffset = 2 + ((height - buf.Height) / 2) + cell_area.Y;
								
				window.DrawPixbuf(gc, buf, 0, 0, xOffset, yOffset, buf.Width, buf.Height, Gdk.RgbDither.None, 0, 0);	
			}
			
			_x = cell_area.X + x;
			_y = cell_area.Y + y;
		}
开发者ID:Bert6623,项目名称:Gedcom.Net,代码行数:39,代码来源:GtkCellRendererButton.cs

示例5: RenderDoc

        public void RenderDoc(Cairo.Context CairoContext, Gtk.Widget widget, int height)
        {
            Pixbuf icon = widget.RenderIcon (_IconName, _IconsSize, "");

            Pango.Layout Layout = Pango.CairoHelper.CreateLayout (CairoContext);
            Layout.FontDescription = _font;
            Layout.SetMarkup (_Text);

            int layout_x = icon.Width + 5;
            int layoutWidth, layoutHeight;
            Layout.GetPixelSize (out layoutWidth, out layoutHeight);

            int layout_y = (height - layoutHeight) / 2;
            CairoContext.MoveTo ((double) layout_x, (double) layout_y);
            Pango.CairoHelper.ShowLayout (CairoContext, Layout);

            Gdk.CairoHelper.SetSourcePixbuf (CairoContext, icon, 0, 0);
            CairoContext.Paint ();
            Layout.FontDescription.Dispose ();
            Layout.Dispose ();
        }
开发者ID:QualitySolution,项目名称:earchive,代码行数:21,代码来源:ImageListCellRenderer.cs


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