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


C# Gdk.GC类代码示例

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


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

示例1: Preview

        public Preview(Drawable drawable, SliceData sliceData)
        {
            MaxSize = drawable.Dimensions;

              ExposeEvent += delegate {sliceData.Draw(Renderer);};
              Realized += delegate
            {
              var gc = new Gdk.GC(GdkWindow);
              Renderer = new PreviewRenderer(this, gc, drawable.Dimensions);
              Draw(drawable);
            };
              SizeAllocated += delegate {Draw(drawable);};

              Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask |
            EventMask.PointerMotionHintMask | EventMask.PointerMotionMask |
            EventMask.LeaveNotifyMask;

              ButtonPressEvent += (o, args) =>
            {
              var c = new IntCoordinate((int) args.Event.X, (int) args.Event.Y);
              Func.GetActualFunc(c).OnButtonPress(o, args);
            };

              MotionNotifyEvent += (o, args) =>
            {
              GdkWindow.Cursor = Func.GetCursor(GetXY(args));
            };

              Func = new SelectFunc(sliceData, this);
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:30,代码来源:Preview.cs

示例2: drawTileset

        //level must be declared prior to calling this
        public void drawTileset()
        {
            _tilesetCache = new Gdk.Pixbuf(_editLevel.tilesetPath);

            Pixmap pMap, mask;
            _tilesetCache.RenderPixmapAndMask (out pMap, out mask, 0);

            int imgWidth = _tilesetCache.Width,
            imgHeight = _tilesetCache.Height;

            _tilesetEventBox.SetSizeRequest (imgWidth, imgHeight);
            tilesetDrawPane.SetSizeRequest (imgWidth, imgHeight);

            if (_tilesetGrid) {
                //get the context we're drawing in
                Gdk.GC gc = new Gdk.GC (levelDrawPane.GdkWindow);

                //draw the grid
                for (int x = 0; x < imgWidth; x += _editLevel._tileWidth)
                    pMap.DrawLine (gc, x, 0, x, imgHeight);
                for (int y = 0; y < imgHeight; y += _editLevel._tileHeight)
                    pMap.DrawLine (gc, 0, y, imgWidth, y);
            }

            tilesetDrawPane.SetFromPixmap (pMap, mask);

            //----------------------
        }
开发者ID:dufresnep,项目名称:gs2emu-googlecode,代码行数:29,代码来源:MainWindow.cs

示例3: Paint

        public override void Paint(Gdk.Drawable wnd, System.Drawing.Rectangle rect)
        {
            int one_width = (int) textArea.TextView.GetWidth ('w');

            using (Gdk.GC gc = new Gdk.GC (wnd)) {
            using (Pango.Layout ly = new Pango.Layout (TextArea.PangoContext)) {
                ly.FontDescription = FontContainer.DefaultFont;
                ly.Width = drawingPosition.Width;
                ly.Alignment = Pango.Alignment.Right;

                HighlightColor lineNumberPainterColor = textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers");

                gc.RgbBgColor = new Gdk.Color (lineNumberPainterColor.BackgroundColor);
                gc.RgbFgColor = TextArea.Style.White;
                wnd.DrawRectangle (gc, true, drawingPosition);

                gc.RgbFgColor = new Gdk.Color (lineNumberPainterColor.Color);
                gc.SetLineAttributes (1, LineStyle.OnOffDash, CapStyle.NotLast, JoinStyle.Miter);
                wnd.DrawLine (gc, drawingPosition.X + drawingPosition.Width, drawingPosition.Y, drawingPosition.X + drawingPosition.Width, drawingPosition.Height);

                //FIXME: This doesnt allow different fonts and what not
                int fontHeight = TextArea.TextView.FontHeight;

                for (int y = 0; y < (DrawingPosition.Height + textArea.TextView.VisibleLineDrawingRemainder) / fontHeight + 1; ++y) {
                    int ypos = drawingPosition.Y + fontHeight * y  - textArea.TextView.VisibleLineDrawingRemainder;

                    int curLine = y + textArea.TextView.FirstVisibleLine;
                    if (curLine < textArea.Document.TotalNumberOfLines) {
                        ly.SetText ((curLine + 1).ToString ());
                        wnd.DrawLayout (gc, drawingPosition.X + drawingPosition.Width - one_width, ypos, ly);
                    }
                }
            }}
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:34,代码来源:GutterMargin.cs

示例4: TileRenderer

        public TileRenderer(Gtk.Image draw, int pixelWidth, int pixelHeight)
        {
            _renderTo = draw;
            _tileCache = "null";
            _levelPMap = new Pixmap(_renderTo.GdkWindow, pixelWidth, pixelHeight);

            _graphicsContext = new Gdk.GC(_renderTo.GdkWindow);
        }
开发者ID:Guthius,项目名称:gs2emu-googlecode,代码行数:8,代码来源:TileRenderer.cs

示例5: GetDarkenedGC

        public static Gdk.GC GetDarkenedGC(Gdk.Window window,
						    Gdk.Color color,
						    int darken_count)
        {
            DarkenColor (ref color, darken_count);
            Gdk.GC gc = new Gdk.GC (window);
            gc.RgbFgColor = color;
            return gc;
        }
开发者ID:codebutler,项目名称:meshwork,代码行数:9,代码来源:GtkHelper.cs

示例6: CreateGC

        public Gdk.GC CreateGC(Gdk.Color foregroundColor)
        {
            var gc = new Gdk.GC(GdkWindow);
            gc.RgbFgColor = foregroundColor;
            gc.RgbBgColor = new Gdk.Color(255, 255, 255);
            gc.Background = new Gdk.Color(255, 255, 255);
            gc.SetLineAttributes(1, LineStyle.OnOffDash, CapStyle.Projecting, JoinStyle.Round);

            return gc;
        }
开发者ID:denisbarboni,项目名称:Projeto-AG,代码行数:10,代码来源:SampleContext.cs

示例7: drawStatsArea

        protected virtual void drawStatsArea(object o, Gtk.ExposeEventArgs args)
        {
            Gdk.GC red = new Gdk.GC (statsArea.GdkWindow);
            red.RgbFgColor = new Gdk.Color (255, 0, 0);
            Gdk.GC blue = new Gdk.GC (statsArea.GdkWindow);
            blue.RgbFgColor = new Gdk.Color (0, 0, 255);

            statsArea.GdkWindow.DrawPoints(blue, speedPoints);
            statsArea.GdkWindow.DrawPoints(red, accelPoints);
        }
开发者ID:joebain,项目名称:MagnumHouse,代码行数:10,代码来源:PhysicsAdjuster.cs

示例8: drawWidgetRect

        public static void drawWidgetRect(Widget w, Pixbuf widgetBuffer, int offsetX, int offsetY, int drawX, int drawY, int drawW, int drawH)
        {
            Gdk.GC gc = new Gdk.GC(w.GdkWindow);
            w.GdkWindow.DrawPixbuf (gc, widgetBuffer, 0, 0, offsetX, offsetY, -1, -1, Gdk.RgbDither.None, 0, 0);
            w.GdkWindow.DrawRectangle(gc, false, new Rectangle (drawX + offsetX, drawY + offsetY, drawW, drawH));

            //set colour to white
            gc.RgbFgColor = new Color (255, 255, 255);

            w.GdkWindow.DrawRectangle(gc, false, new Rectangle (drawX + offsetX + 1, drawY + offsetY + 1, drawW, drawH));
        }
开发者ID:dufresnep,项目名称:gs2emu-googlecode,代码行数:11,代码来源:GtkHelpFuncs.cs

示例9: OnDrawingareaExposeEvent

        protected virtual void OnDrawingareaExposeEvent(object o, Gtk.ExposeEventArgs args)
        {
            int width, height;
            this.DrawingArea.GdkWindow.GetSize(out width, out height);

            using(Gdk.GC g = new Gdk.GC(DrawingArea.GdkWindow))
            {
                g.SetLineAttributes(2, LineStyle.Solid, CapStyle.Round, JoinStyle.Miter);
                DrawingArea.GdkWindow.DrawRectangle(g, false, new Rectangle(0, 0, width, height));
            }
        }
开发者ID:physalis,项目名称:MeeGen,代码行数:11,代码来源:ColorSelectButton.cs

示例10: PreviewRenderer

        public PreviewRenderer(Preview preview, Gdk.GC gc, Dimensions dimensions)
        {
            _window = preview.GdkWindow;
              _gc = gc;
              _width = dimensions.Width - 1;
              _height = dimensions.Height - 1;

              var colormap = Colormap.System;
              _inactive = new Gdk.Color(0xff, 0, 0);
              _active = new Gdk.Color(0, 0xff, 0);
              colormap.AllocColor(ref _inactive, true, true);
              colormap.AllocColor(ref _active, true, true);
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:13,代码来源:PreviewRenderer.cs

示例11: PlaceholderWindow

		public PlaceholderWindow (DockFrame frame): base (Gtk.WindowType.Popup)
		{
			SkipTaskbarHint = true;
			Decorated = false;
			TransientFor = (Gtk.Window) frame.Toplevel;
			TypeHint = WindowTypeHint.Utility;
			
			// Create the mask for the arrow
			
			Realize ();
			redgc = new Gdk.GC (GdkWindow);
	   		redgc.RgbFgColor = frame.Style.Background (StateType.Selected);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:13,代码来源:PlaceholderWindow.cs

示例12: OnDrawVolumeExposeEvent

        protected void OnDrawVolumeExposeEvent(object o, Gtk.ExposeEventArgs args)
        {
            Gdk.Color back = Style.Background(StateType.Normal);
            Gdk.Color fore = Style.Foreground(StateType.Normal);

            Drawable draw = args.Event.Window;

            int width;
            int height;
            draw.GetSize(out width, out height);

            Gdk.GC gc = new Gdk.GC(draw);

            gc.Foreground = back;
            gc.Background = back;
            draw.DrawRectangle(gc, true, 0, 0, width, height);

            //Color lightSlateGray = new Color(119,136,153);

            //gc.Colormap.AllocColor(ref lightSlateGray, false, true);

            int outside = height * 8 / 10;
            int middle = height * 6 / 10;
            int inside = height * 4 / 10;

            int startOut = 24;
            int startMiddle = 30;
            int startInside = 36;

            int endOut = width - 24;
            int endMiddle = width - 30;
            int endInside = width - 36;

            gc.Foreground = fore;
            gc.Foreground = fore;
            gc.SetLineAttributes(outside, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
            draw.DrawLine(gc, startOut, height / 2, endOut, height / 2);

            gc.Foreground = back;
            gc.Background = back;
            gc.SetLineAttributes(middle, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
            draw.DrawLine(gc, startMiddle, height / 2, endMiddle, height / 2);

            int endX = (endInside - startInside) * Percentage / 100 + startInside;
            gc.Foreground = fore;
            gc.Foreground = fore;
            gc.SetLineAttributes(inside, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
            draw.DrawLine(gc, startInside, height / 2, endX, height / 2);

            gc.Dispose();
        }
开发者ID:peter-gregory,项目名称:ClockRadio,代码行数:51,代码来源:Volume.cs

示例13: DrawGrid

        public static void DrawGrid(Gdk.Drawable wnd, int Size)
        {
            int Width, Height;
            var gc = new Gdk.GC (wnd);

            Gdk.Color line_color = new Gdk.Color (0, 255, 255);
            gc.RgbFgColor = line_color;

            wnd.GetSize (out Width, out Height);
            for (int i = 0; i < Width; i += Size)
                wnd.DrawLine (gc, i, 0, i, Height);
            for (int i = 0; i < Height; i += Size)
                wnd.DrawLine (gc, 0, i, Width, i);
        }
开发者ID:astarasikov,项目名称:HuffmanArchiver,代码行数:14,代码来源:TreeGraphics.cs

示例14: OptionsChanged

		internal protected override void OptionsChanged ()
		{
			DisposeGCs ();
			backgroundGC = new Gdk.GC (editor.GdkWindow);
			backgroundGC.RgbFgColor = editor.ColorStyle.IconBarBg;
			
			separatorGC = new Gdk.GC (editor.GdkWindow);
			separatorGC.RgbFgColor = editor.ColorStyle.IconBarSeperator;
			
			layout.FontDescription = editor.Options.Font;
			layout.SetText ("!");
			int tmp;
			layout.GetPixelSize (out tmp, out this.marginWidth);
			marginWidth *= 12;
			marginWidth /= 10;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:16,代码来源:IconMargin.cs

示例15: CreateMissingImage

        // From MonoDevelop:
        // https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/gtk-gui/generated.cs
        private static Pixbuf CreateMissingImage(int size)
        {
            var pmap = new Gdk.Pixmap (Gdk.Screen.Default.RootWindow, size, size);
            var gc = new Gdk.GC (pmap);

            gc.RgbFgColor = new Gdk.Color (255, 255, 255);
            pmap.DrawRectangle (gc, true, 0, 0, size, size);
            gc.RgbFgColor = new Gdk.Color (0, 0, 0);
            pmap.DrawRectangle (gc, false, 0, 0, (size - 1), (size - 1));

            gc.SetLineAttributes (3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
            gc.RgbFgColor = new Gdk.Color (255, 0, 0);
            pmap.DrawLine (gc, (size / 4), (size / 4), ((size - 1) - (size / 4)), ((size - 1) - (size / 4)));
            pmap.DrawLine (gc, ((size - 1) - (size / 4)), (size / 4), (size / 4), ((size - 1) - (size / 4)));

            return Gdk.Pixbuf.FromDrawable (pmap, pmap.Colormap, 0, 0, 0, 0, size, size);
        }
开发者ID:jobernolte,项目名称:Pinta,代码行数:19,代码来源:ResourceManager.cs


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