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


C# Gdk.GC类代码示例

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


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

示例1: RenderPlaceholderText

		internal static void RenderPlaceholderText (Gtk.Entry entry, Gtk.ExposeEventArgs args, string placeHolderText, ref Pango.Layout layout)
		{
			// The Entry's GdkWindow is the top level window onto which
			// the frame is drawn; the actual text entry is drawn into a
			// separate window, so we can ensure that for themes that don't
			// respect HasFrame, we never ever allow the base frame drawing
			// to happen
			if (args.Event.Window == entry.GdkWindow)
				return;

			if (entry.Text.Length > 0)
				return;

			if (layout == null) {
				layout = new Pango.Layout (entry.PangoContext);
				layout.FontDescription = entry.PangoContext.FontDescription.Copy ();
			}

			int wh, ww;
			args.Event.Window.GetSize (out ww, out wh);

			int width, height;
			layout.SetText (placeHolderText);
			layout.GetPixelSize (out width, out height);
			using (var gc = new Gdk.GC (args.Event.Window)) {
				gc.Copy (entry.Style.TextGC (Gtk.StateType.Normal));
				Color color_a = entry.Style.Base (Gtk.StateType.Normal).ToXwtValue ();
				Color color_b = entry.Style.Text (Gtk.StateType.Normal).ToXwtValue ();
				gc.RgbFgColor = color_b.BlendWith (color_a, 0.5).ToGtkValue ();

				args.Event.Window.DrawLayout (gc, 2, (wh - height) / 2 + 1, layout);
			}
		}
开发者ID:StEvUgnIn,项目名称:xwt,代码行数:33,代码来源:TextEntryBackendGtk2.cs

示例2: Render

		public override void Render (Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state)
		{
			Gdk.GC gc = new Gdk.GC (window);
	   		gc.RgbFgColor = (Gdk.Color) Value;
			window.DrawRectangle (gc, true, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);
			window.DrawRectangle (Container.Style.BlackGC, false, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:7,代码来源:Color.cs

示例3: 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

示例4: DrawContents

        protected override void DrawContents(Gdk.Drawable d)
        {
            Gdk.GC gc = new Gdk.GC(d);
            Cairo.Context g = Gdk.CairoHelper.Create(d);

            g.SelectFontFace("Lucida Console", FontSlant.Normal, FontWeight.Bold);
            g.SetFontSize(24);

            TextExtents te;

            string lvl, hp, hpm, mp, mpm;

            #region Character

            Character c = PHSList.Instance.Selection;

            if (c != null)
            {
                Graphics.DrawProfileSmall(d, gc, c.Name, X + x1, Y + yp);

                g.Color = new Color(.3, .8, .8);
                g.MoveTo(X + x3, Y + y0 + ya);
                g.ShowText("LV");
                g.MoveTo(X + x3, Y + y0 + yb);
                g.ShowText("HP");
                g.MoveTo(X + x3, Y + y0 + yc);
                g.ShowText("MP");
                g.Color = new Color(1, 1, 1);

                Color namec = new Color(1, 1, 1);
                if (c.Death)
                    namec = new Color(0.8, 0, 0);
                else if (c.NearDeath)
                    namec = new Color(.8, .8, 0);

                Graphics.ShadowedText(g, namec, c.Name, X + x3, Y + y0);

                lvl = c.Level.ToString();
                hp = c.HP.ToString() + "/";
                hpm = c.MaxHP.ToString();
                mp = c.MP.ToString() + "/";
                mpm = c.MaxMP.ToString();

                te = g.TextExtents(lvl);
                Graphics.ShadowedText(g, lvl, X + x4 - te.Width, Y + y0 + ya);
                te = g.TextExtents(hp);
                Graphics.ShadowedText(g, hp, X + x5 - te.Width, Y + y0 + yb);
                te = g.TextExtents(hpm);
                Graphics.ShadowedText(g, hpm, X + x6 - te.Width, Y + y0 + yb);
                te = g.TextExtents(mp);
                Graphics.ShadowedText(g, mp, X + x5 - te.Width, Y + y0 + yc);
                te = g.TextExtents(mpm);
                Graphics.ShadowedText(g, mpm, X + x6 - te.Width, Y + y0 + yc);
            }
            #endregion Character

            ((IDisposable)g.Target).Dispose();
            ((IDisposable)g).Dispose();
        }
开发者ID:skinitimski,项目名称:Reverence,代码行数:59,代码来源:PhsScreen.cs

示例5: CreateDashedLineGC

		Gdk.GC CreateDashedLineGC (Gdk.Color fg)
		{
			var gc = new Gdk.GC (Editor.GdkWindow);
			gc.RgbFgColor = fg;
			gc.SetLineAttributes (1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Bevel);
			gc.SetDashes (0, new sbyte[] { 1, 1 }, 2);
			return gc;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:8,代码来源:DashedLineMargin.cs

示例6: PlaceholderWindow

		public PlaceholderWindow (DockToolbarFrame frame): base (Gtk.WindowType.Toplevel)
		{
			SkipTaskbarHint = true;
			Decorated = false;
			TransientFor = frame.TopWindow;
			Realize ();
			redgc = new Gdk.GC (GdkWindow);
	   		redgc.RgbFgColor = new Gdk.Color (255, 0, 0);
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:9,代码来源:PlaceholderWindow.cs

示例7: Render

		public override void Render (Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state)
		{
			Gdk.GC gc = new Gdk.GC (window);
	   		gc.RgbFgColor = GetColor ();
	   		int yd = (bounds.Height - ColorBoxSize) / 2;
			window.DrawRectangle (gc, true, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
			window.DrawRectangle (Container.Style.BlackGC, false, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
			bounds.X += ColorBoxSize + ColorBoxSpacing;
			bounds.Width -= ColorBoxSize + ColorBoxSpacing;
			base.Render (window, bounds, state);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:11,代码来源:ColorEditorCell.cs

示例8: OnRealized

        protected virtual void OnRealized(object sender, System.EventArgs e)
        {
            whitegc = new Gdk.GC(GdkWindow);
            whitegc.Foreground = view.Style.White;

            darkgc = new Gdk.GC(GdkWindow);
            darkgc.Foreground = view.Style.Dark(StateType.Normal);

            view_pixmap = new Gdk.Pixmap(GdkWindow, Constants.ARENA_SIZE, Constants.ARENA_SIZE);
            view_graphics = Gtk.DotNet.Graphics.FromDrawable(view_pixmap);
        }
开发者ID:mcbodge,项目名称:robowarx,代码行数:11,代码来源:ArenaWidget.cs

示例9: OptionsChanged

		internal protected override void OptionsChanged ()
		{
			Pango.Layout layout = new Pango.Layout (Editor.PangoContext);
			layout.FontDescription = Editor.Options.Font;
			layout.SetText (".");
			int height;
			layout.GetPixelSize (out charWidth, out height);
			layout.Dispose ();
			bgGC = GetGC (Style.HexDigitBg);
			fgGC = GetGC (Style.HexDigit);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:11,代码来源:TextEditorMargin.cs

示例10: RenderInitialPixbuf

		protected override Gdk.Pixbuf RenderInitialPixbuf (Gdk.Window parentwindow, Gdk.Rectangle bounds)
		{
			//FIXME add a drop shadow on the pixmap, and expand the bounds to include this
			using (Gdk.Pixmap pixmap = new Gdk.Pixmap (parentwindow, bounds.Width, bounds.Height)) {
				using (var bgGc = new Gdk.GC(pixmap)) {
					bgGc.RgbFgColor = CairoExtensions.CairoColorToGdkColor (marker.colorMatrix[0, 0, 0, 0, 0]);
					pixmap.DrawRectangle (bgGc, true, 0, 0, bounds.Width, bounds.Height);
					pixmap.DrawLayout (marker.gc, 4, (bounds.Height - marker.Layouts[0].Height) / 2, marker.Layouts[0].Layout);
				}
				return Gdk.Pixbuf.FromDrawable (pixmap, Colormap, 0, 0, 0, 0, bounds.Width, bounds.Height);
			}
		}
开发者ID:acken,项目名称:monodevelop,代码行数:12,代码来源:MessageBubbleHighlightPopupWindow.cs

示例11: Render

		public override void Render (Gdk.Drawable window, Cairo.Context ctx, Gdk.Rectangle bounds, Gtk.StateType state)
		{
			using (Gdk.GC gc = new Gdk.GC (window)) {
				gc.RgbFgColor = GetColor ();
				int yd = (bounds.Height - ColorBoxSize) / 2;
				window.DrawRectangle (gc, true, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
				window.DrawRectangle (Container.GetNativeWidget<Gtk.Widget> ().Style.BlackGC, false, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1);
				bounds.X += ColorBoxSize + ColorBoxSpacing;
				bounds.Width -= ColorBoxSize + ColorBoxSpacing;
				base.Render (window, ctx, bounds, state);
			}
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:12,代码来源:ColorEditorCell.cs

示例12: OnExposeEvent

        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            if(bar_gc == null) {
                bar_gc = new Gdk.GC(GdkWindow);
                Gdk.Color color = Hyena.Gui.GtkUtilities.ColorBlend(Style.Background(StateType.Normal),
                    Style.Foreground(StateType.Normal));
                bar_gc.Background = color;
                bar_gc.Foreground = color;
            }

            DrawGdk();
            return false;
        }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:13,代码来源:LinearProgress.cs

示例13: OptionsChanged

		internal protected override void OptionsChanged ()
		{
			DisposeGCs ();
			
			foldDashedLineGC = CreateDashedLineGC (Style.DashedLineFg);
			foldDashedLineGC2 = CreateDashedLineGC (Style.DashedLineBg);
			bgGC = new Gdk.GC (Editor.GdkWindow) {
				RgbFgColor = Style.HexDigitBg
			};
			bgGC2 = new Gdk.GC (Editor.GdkWindow) {
				RgbFgColor = Style.HexDigit
			};
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:13,代码来源:DashedLineMargin.cs

示例14: CreateContext

        public static Cairo.Context CreateContext(Gdk.Drawable drawable)
        {
            IntPtr x_drawable = IntPtr.Zero;
            int x_off = 0, y_off = 0;

            int x, y, w, h, d;
            ((Gdk.Window)drawable).GetGeometry(out x, out y, out w, out h, out d);

            bool is_gdk_window = drawable is Gdk.Window;
            if (is_gdk_window)
                ((Gdk.Window)drawable).GetInternalPaintInfo(out drawable,
                                         out x_off, out y_off);

            Cairo.Surface surface;

            PlatformID os = Environment.OSVersion.Platform;
            if (os == PlatformID.Win32Windows || os == PlatformID.Win32NT ||
                os == PlatformID.Win32S || os == PlatformID.WinCE)
            {

                Gdk.GC gcc = new Gdk.GC(drawable);
                IntPtr windc = gdk_win32_hdc_get(drawable.Handle, gcc.Handle, 0);
                surface = new Win32Surface(windc);

                gdk_win32_hdc_release(drawable.Handle, gcc.Handle, 0);
            }
            else
            {
                x_drawable = drawable.Handle;
                IntPtr visual = gdk_drawable_get_visual(x_drawable);

                IntPtr Xdisplay = gdk_x11_drawable_get_xdisplay(x_drawable);
                IntPtr Xvisual = gdk_x11_visual_get_xvisual(visual);
                IntPtr Xdrawable = gdk_x11_drawable_get_xid(x_drawable);

                surface = new Cairo.XlibSurface(Xdisplay,
                                   Xdrawable,
                                   Xvisual,
                                   w, h);
            }

            Cairo.Context g = new Cairo.Context(surface);

            // this can be safely removed now, just keep it for a bit more
            //Cairo.Context g = new Cairo.Context (
            //                    gdk_cairo_create (x_drawable ));

            if (is_gdk_window)
                g.Translate(-(double)x_off, -(double)y_off);
            return g;
        }
开发者ID:djpnewton,项目名称:ddraw,代码行数:51,代码来源:sysdraw.cs

示例15: OptionsChanged

		internal protected override void OptionsChanged ()
		{
			backgroundGC = GetGC (Style.IconBarBg);
			separatorGC = GetGC (Style.IconBarSeperator);
			
			Pango.Layout layout = new Pango.Layout (Editor.PangoContext);
			layout.FontDescription = Editor.Options.Font;
			layout.SetText ("!");
			int tmp;
			layout.GetPixelSize (out tmp, out this.marginWidth);
			marginWidth *= 12;
			marginWidth /= 10;
			layout.Dispose ();
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:14,代码来源:IconMargin.cs


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