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


C# Gdk.GC.Copy方法代码示例

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


在下文中一共展示了Gdk.GC.Copy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: RefreshGC

            private void RefreshGC()
            {
                if(text_window == null) {
                    return;
                }

                text_gc = new Gdk.GC(text_window);
                text_gc.Copy(Style.TextGC(StateType.Normal));
                Gdk.Color color_a = parent.Style.Base(StateType.Normal);
                Gdk.Color color_b = parent.Style.Text(StateType.Normal);
                text_gc.RgbFgColor = Hyena.Gui.GtkUtilities.ColorBlend(color_a, color_b);
            }
开发者ID:mono-soc-2011,项目名称:banshee,代码行数:12,代码来源:SearchEntry.cs

示例3: RefreshGC

            private void RefreshGC()
            {
                if(text_window == null) {
                    return;
                }

                text_gc = new Gdk.GC(text_window);
                text_gc.Copy(Style.TextGC(StateType.Normal));
                Gdk.Color color_a = parent.Style.Base(StateType.Normal);
                Gdk.Color color_b = parent.Style.Text(StateType.Normal);
                text_gc.RgbFgColor = DockServices.Drawing.ColorBlend(color_a, color_b);
            }
开发者ID:Aurora-and-Equinox,项目名称:docky,代码行数:12,代码来源:SearchEntry.cs

示例4: OnExposeEvent

			protected override bool OnExposeEvent (Gdk.EventExpose evnt)
			{
				// 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 (evnt.Window == GdkWindow) {
					return true;
				}
				
				bool ret = base.OnExposeEvent (evnt);
				
				if (text_gc == null) {
					text_gc = new Gdk.GC (evnt.Window);
					text_gc.Copy (Style.TextGC (StateType.Normal));
					Gdk.Color color_a = parent.Style.Base (StateType.Normal);
					Gdk.Color color_b = parent.Style.Text (StateType.Normal);
					text_gc.RgbFgColor = ColorBlend (color_a, color_b);
				}
				
				if (Text.Length > 0 || HasFocus || parent.EmptyMessage == null) {
					return ret;
				}
				
				if (layout == null) {
					layout = new Pango.Layout (PangoContext);
					layout.FontDescription = PangoContext.FontDescription.Copy ();
				}
				
				int width, height;
				layout.SetMarkup (parent.EmptyMessage);
				layout.GetPixelSize (out width, out height);
				evnt.Window.DrawLayout (text_gc, 2, (SizeRequest ().Height - height) / 2, layout);
				
				return ret;
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:37,代码来源:SearchEntry.cs

示例5: Render

        protected override void Render(Gdk.Drawable drawable, Widget widget,
		                                Gdk.Rectangle background_area, Gdk.Rectangle cell_area,
		                                Gdk.Rectangle expose_area, CellRendererState flags)
        {
            Pango.Layout layout = GetLayout (widget);

            // FIXME: If this code is ever built into its own library,
            // the call to Tomboy will definitely have to change
            layout.SetText (Utilities.GetPrettyPrintDate (date, show_time));

            int x, y, w, h;
            CalculateSize (layout, out x, out y, out w, out h);

            StateType state = RendererStateToWidgetState(flags);

            Gdk.GC gc;
            if (state.Equals(StateType.Selected)) {
                // Use the proper Gtk.StateType so text appears properly when selected
                gc = new Gdk.GC(drawable);
                gc.Copy(widget.Style.TextGC(state));
                gc.RgbFgColor = widget.Style.Foreground(state);
            } else
                gc = widget.Style.TextGC(Gtk.StateType.Normal);

            drawable.DrawLayout (
                    gc,
                    cell_area.X + (int)Xalign + (int)Xpad,
                    cell_area.Y + ((cell_area.Height - h) / 2),
                    layout);
        }
开发者ID:GNOME,项目名称:tasque,代码行数:30,代码来源:CellRendererDate.cs

示例6: HandleWidgetExposeEvent

        void HandleWidgetExposeEvent(object o, Gtk.ExposeEventArgs args)
        {
            // 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 == Widget.GdkWindow)
                return;

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

            if (layout == null) {
                layout = new Pango.Layout (Widget.PangoContext);
                layout.FontDescription = Widget.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);
            Gdk.GC gc = new Gdk.GC (args.Event.Window);
            gc.Copy (Widget.Style.TextGC (Gtk.StateType.Normal));
            Color color_a = Util.ToXwtColor (Widget.Style.Base (Gtk.StateType.Normal));
            Color color_b = Util.ToXwtColor (Widget.Style.Text (Gtk.StateType.Normal));
            gc.RgbFgColor = Util.ToGdkColor (color_b.BlendWith (color_a, 0.5));

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

示例7: OnExposeEvent

		protected override bool OnExposeEvent (Gdk.EventExpose evnt)
		{
			bool res = base.OnExposeEvent (evnt);
			if (Text.Length == 0 && !string.IsNullOrEmpty (EmptyMessage)) {
				if (text_gc == null) {
					text_gc = new Gdk.GC (evnt.Window);
					text_gc.Copy (Style.TextGC (Gtk.StateType.Normal));
					Gdk.Color color_a = Style.Base (Gtk.StateType.Normal);
					Gdk.Color color_b = Style.Text (Gtk.StateType.Normal);
					text_gc.RgbFgColor = ColorBlend (color_a, color_b);
				}
				
				if (layout == null) {
					layout = new Pango.Layout (PangoContext);
					layout.FontDescription = PangoContext.FontDescription.Copy ();
				}
				
				int width, height;
				layout.SetMarkup (EmptyMessage);
				layout.GetPixelSize (out width, out height);
				evnt.Window.DrawLayout (text_gc, 2, 2, layout);
			}
			return res;
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:24,代码来源:FeedbackDialog.cs

示例8: RefreshGC

            private void RefreshGC()
            {
                if(text_window == null) {
                    return;
                }

                text_gc = new Gdk.GC(text_window);
                text_gc.Copy(Style.TextGC(StateType.Normal));
                Gdk.Color color_a = parent.Style.Foreground(StateType.Normal);
                Gdk.Color color_b = parent.Style.Background(StateType.Normal);
                text_gc.RgbFgColor = DrawingUtilities.ColorBlend(color_a, color_b, 0.5);
            }
开发者ID:codebutler,项目名称:meshwork,代码行数:12,代码来源:SearchEntry.cs


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