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


C# GC.SetLineAttributes方法代码示例

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


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

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

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

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

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

示例5: OnExposeEvent

		protected override bool OnExposeEvent (Gdk.EventExpose ev)
		{
			int w, h;
			this.GdkWindow.GetSize (out w, out h);
			
			if (fill == BoxFill.Box) {
				this.GdkWindow.DrawRectangle (this.Style.WhiteGC, true, 0, 0, w, h);
				this.GdkWindow.DrawRectangle (this.Style.BlackGC, false, 0, 0, w-1, h-1);
			} else if (fill == BoxFill.HLine) {
				using (Gdk.GC gc = new Gdk.GC (this.GdkWindow)) {
					gc.SetDashes (0, new sbyte [] { 1, 1 }, 2);
					gc.SetLineAttributes (SelectionHandleBox.selectionLineWidth, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
					gc.Foreground = this.Style.Black;
					this.GdkWindow.DrawLine (gc, 0, h / 2, w, h / 2);
					gc.Foreground = this.Style.White;
					this.GdkWindow.DrawLine (gc, 1, h/2, w, h/2);
				}
			} else {
				using (Gdk.GC gc = new Gdk.GC (this.GdkWindow)) {
					gc.SetDashes (0, new sbyte [] { 1, 1 }, 2);
					gc.SetLineAttributes (SelectionHandleBox.selectionLineWidth, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
					gc.Foreground = this.Style.Black;
					this.GdkWindow.DrawLine (gc, w / 2, 0, w / 2, h);
					gc.Foreground = this.Style.White;
					this.GdkWindow.DrawLine (gc, w / 2, 1, w/2, h);
				}
			}
			
			return true;
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:30,代码来源:WidgetDesignerBackend.cs

示例6: RealizeHanlder

	void RealizeHanlder (object o, EventArgs sender)
        {
                white_gc = Style.WhiteGC;

                bkgr_gc = Style.BackgroundGC (StateType.Normal);

                selection_gc = new Gdk.GC (GdkWindow);
                selection_gc.Copy (Style.BackgroundGC (StateType.Normal));
                Gdk.Color fgcol = new Gdk.Color ();
                fgcol.Pixel = 0x000077ee;
                selection_gc.Foreground = fgcol;
                selection_gc.SetLineAttributes (3, LineStyle.Solid, CapStyle.NotLast, JoinStyle.Round);
        }
开发者ID:emtees,项目名称:old-code,代码行数:13,代码来源:IconList.cs

示例7: event_execute_configureColors

    //Gdk.GC pen_blanco;
    void event_execute_configureColors()
    {
        Gdk.Color rojo = new Gdk.Color(0xff,0,0);
        Gdk.Color azul  = new Gdk.Color(0,0,0xff);
        Gdk.Color negro = new Gdk.Color(0,0,0);
        Gdk.Color green = new Gdk.Color(0,0xff,0);
        Gdk.Color gris = new Gdk.Color(0x66,0x66,0x66);
        Gdk.Color beige = new Gdk.Color(0x99,0x99,0x99);
        Gdk.Color brown = new Gdk.Color(0xd6,0x88,0x33);
        Gdk.Color violet = new Gdk.Color(0xc4,0x20,0xf3);
        //Gdk.Color blanco = new Gdk.Color(0xff,0xff,0xff);

        Gdk.Colormap colormap = Gdk.Colormap.System;
        colormap.AllocColor (ref rojo, true, true);
        colormap.AllocColor (ref azul,true,true);
        colormap.AllocColor (ref negro,true,true);
        colormap.AllocColor (ref green,true,true);
        colormap.AllocColor (ref gris,true,true);
        colormap.AllocColor (ref beige,true,true);
        colormap.AllocColor (ref brown,true,true);
        colormap.AllocColor (ref violet,true,true);
        //colormap.AllocColor (ref blanco,true,true);

        //-- Configurar los contextos graficos (pinceles)
        pen_rojo = new Gdk.GC(event_execute_drawingarea.GdkWindow);
        pen_azul = new Gdk.GC(event_execute_drawingarea.GdkWindow);
        pen_rojo_discont = new Gdk.GC(event_execute_drawingarea.GdkWindow);
        pen_azul_discont = new Gdk.GC(event_execute_drawingarea.GdkWindow);
        //pen_negro = new Gdk.GC(event_execute_drawingarea.GdkWindow);
        //pen_blanco= new Gdk.GC(event_execute_drawingarea.GdkWindow);
        pen_negro_discont = new Gdk.GC(event_execute_drawingarea.GdkWindow);
        pen_green_discont = new Gdk.GC(event_execute_drawingarea.GdkWindow);
        pen_gris = new Gdk.GC(event_execute_drawingarea.GdkWindow);
        pen_beige_discont = new Gdk.GC(event_execute_drawingarea.GdkWindow);
        pen_brown_bold = new Gdk.GC(event_execute_drawingarea.GdkWindow);
        pen_violet_bold = new Gdk.GC(event_execute_drawingarea.GdkWindow);

        pen_rojo.Foreground = rojo;
        pen_azul.Foreground = azul;

        pen_rojo_discont.Foreground = rojo;
        pen_azul_discont.Foreground = azul;
        pen_rojo_discont.SetLineAttributes(1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.Butt, Gdk.JoinStyle.Round);
        pen_azul_discont.SetLineAttributes(1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.Butt, Gdk.JoinStyle.Round);

        pen_negro_discont.Foreground = negro;
        pen_negro_discont.SetLineAttributes(1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.Butt, Gdk.JoinStyle.Round);
        pen_green_discont.Foreground = green;
        pen_green_discont.SetLineAttributes(1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.Butt, Gdk.JoinStyle.Round);

        pen_gris.Foreground = gris;

        pen_beige_discont.Foreground = beige;
        pen_beige_discont.SetLineAttributes(1, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.Butt, Gdk.JoinStyle.Round);

        pen_brown_bold.Foreground = brown;
        pen_brown_bold.SetLineAttributes(2, Gdk.LineStyle.Solid, Gdk.CapStyle.Butt, Gdk.JoinStyle.Round);
        pen_violet_bold.Foreground = violet;
        pen_violet_bold.SetLineAttributes(2, Gdk.LineStyle.Solid, Gdk.CapStyle.Butt, Gdk.JoinStyle.Round);
    }
开发者ID:dineshkummarc,项目名称:chronojump,代码行数:61,代码来源:eventExecute.cs

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

示例9: prepareEncoderGraphs

    void prepareEncoderGraphs(bool eraseBars, bool eraseSignal)
    {
        LogB.Debug("prepareEncoderGraphs() start (should be on first thread: GTK)");

        if(eraseBars && encoder_capture_curves_bars_pixmap != null)
            UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea, encoder_capture_curves_bars_pixmap);

        if(eraseSignal && encoder_capture_signal_pixmap != null)
            UtilGtk.ErasePaint(encoder_capture_signal_drawingarea, encoder_capture_signal_pixmap);

        layout_encoder_capture_signal = new Pango.Layout (encoder_capture_signal_drawingarea.PangoContext);
        layout_encoder_capture_signal.FontDescription = Pango.FontDescription.FromString ("Courier 10");

        layout_encoder_capture_curves_bars = new Pango.Layout (encoder_capture_curves_bars_drawingarea.PangoContext);
        layout_encoder_capture_curves_bars.FontDescription = Pango.FontDescription.FromString ("Courier 10");

        layout_encoder_capture_curves_bars_text = new Pango.Layout (encoder_capture_curves_bars_drawingarea.PangoContext);
        layout_encoder_capture_curves_bars_text.FontDescription = Pango.FontDescription.FromString ("Courier 10");

        //defined as encoder_capture_curves_bars_drawingarea instead of encoder_capture_signal_drawingarea
        //because the 2nd is null if config.EncoderCaptureShowOnlyBars == TRUE
        pen_black_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_gray = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_red_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_red_light_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_green_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_blue_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_white_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_selected_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_red_light_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_red_dark_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_green_light_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_green_dark_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_blue_dark_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_blue_light_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);
        pen_yellow_encoder_capture = new Gdk.GC(encoder_capture_curves_bars_drawingarea.GdkWindow);

        Gdk.Colormap colormap = Gdk.Colormap.System;
        colormap.AllocColor (ref UtilGtk.BLACK,true,true);
        colormap.AllocColor (ref UtilGtk.GRAY,true,true);
        colormap.AllocColor (ref UtilGtk.RED_PLOTS,true,true);
        colormap.AllocColor (ref UtilGtk.RED_DARK,true,true);
        colormap.AllocColor (ref UtilGtk.RED_LIGHT,true,true);
        colormap.AllocColor (ref UtilGtk.GREEN_PLOTS,true,true);
        colormap.AllocColor (ref UtilGtk.GREEN_DARK,true,true);
        colormap.AllocColor (ref UtilGtk.GREEN_LIGHT,true,true);
        colormap.AllocColor (ref UtilGtk.BLUE_PLOTS,true,true);
        colormap.AllocColor (ref UtilGtk.BLUE_DARK,true,true);
        colormap.AllocColor (ref UtilGtk.BLUE_LIGHT,true,true);
        colormap.AllocColor (ref UtilGtk.YELLOW,true,true);
        colormap.AllocColor (ref UtilGtk.WHITE,true,true);
        colormap.AllocColor (ref UtilGtk.SELECTED,true,true);

        pen_black_encoder_capture.Foreground = UtilGtk.BLACK;
        pen_gray.Foreground = UtilGtk.GRAY;
        pen_red_encoder_capture.Foreground = UtilGtk.RED_PLOTS;
        pen_red_dark_encoder_capture.Foreground = UtilGtk.RED_DARK;
        pen_red_light_encoder_capture.Foreground = UtilGtk.RED_LIGHT;
        pen_green_encoder_capture.Foreground = UtilGtk.GREEN_PLOTS;
        pen_green_dark_encoder_capture.Foreground = UtilGtk.GREEN_DARK;
        pen_green_light_encoder_capture.Foreground = UtilGtk.GREEN_LIGHT;
        pen_blue_encoder_capture.Foreground = UtilGtk.BLUE_PLOTS;
        pen_blue_dark_encoder_capture.Foreground = UtilGtk.BLUE_DARK;
        pen_blue_light_encoder_capture.Foreground = UtilGtk.BLUE_LIGHT;
        pen_yellow_encoder_capture.Foreground = UtilGtk.YELLOW;
        pen_white_encoder_capture.Foreground = UtilGtk.WHITE;
        pen_selected_encoder_capture.Foreground = UtilGtk.SELECTED;

        pen_black_encoder_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
        pen_selected_encoder_capture.SetLineAttributes (2, Gdk.LineStyle.Solid, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);

        LogB.Debug("prepareEncoderGraphs() end");
    }
开发者ID:GNOME,项目名称:chronojump,代码行数:73,代码来源:encoder.cs

示例10: OnTableTabsExposeEvent

	protected void OnTableTabsExposeEvent (object o, ExposeEventArgs args) {
		
		Color fore = Style.Foreground(StateType.Normal);

		Drawable draw = args.Event.Window;
		Gdk.GC gc = new Gdk.GC(draw);

		try {
			Rectangle tabRect;
			switch (notebook.CurrentPage) {
				case 0: // WiFi
					tabRect = imageTabWiFi.Allocation;
					break;
				case 1: // Clock
					tabRect = imageTabClock.Allocation;
					break;
				case 2: // Radio
					tabRect = imageTabRadio.Allocation;
					break;
				case 3: // weather
					tabRect = imageTabWeather.Allocation;
					break;
				default:
					tabRect = imageTabIntercom.Allocation;
					break;
			}

			Rectangle rect = notebook.Allocation;
			rect.Inflate(4, 4);
			tabRect.Inflate(4, 4);

			List<Gdk.Point> points = new List<Gdk.Point>();
			points.Add(new Point(rect.Left, rect.Top));
			points.Add(new Point(rect.Right, rect.Top));
			points.Add(new Point(rect.Right, tabRect.Top));
			points.Add(new Point(tabRect.Right, tabRect.Top));
			points.Add(new Point(tabRect.Right, tabRect.Bottom));
			points.Add(new Point(rect.Right, tabRect.Bottom));
			points.Add(new Point(rect.Right, rect.Bottom));
			points.Add(new Point(rect.Left, rect.Bottom));
			points.Add(new Point(rect.Left, rect.Top));

			gc.Foreground = fore;
			gc.Background = fore;
			gc.SetLineAttributes(4, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
			draw.DrawLines(gc, points.ToArray());

		} catch (Exception ex) {
			Console.WriteLine(ex.Source);
			Console.WriteLine(ex.StackTrace);
		}

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

示例11: OnDrawClockExposeEvent

        protected void OnDrawClockExposeEvent(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;

            Point start;
            Point stop;
            double xMax;
            double yMax;
            double angle = 0;

            int size = width < height ? width : height;
            size -= Spacing;
            Point center = new Point(width / 2, height / 2);
            Rectangle rect = new Rectangle((width - size) / 2, (height - size) / 2, size, size);

            if (clockFace != null && (clockFace.Width != width || clockFace.Height != height)) {
                clockFace.Dispose();
                clockFace = null;
            }

            if (clockFace == null) {

                draw.DrawPixbuf(gc, clockFace, 0, 0, 0, 0, width, height, RgbDither.None, 0, 0);

                draw.DrawRectangle(gc, true, 0, 0, width, height);

                gc.Foreground = fore;

                gc.SetLineAttributes(4, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
                draw.DrawArc(gc, false, rect.Left, rect.Top, size, size, 0, 360 * 64);
                gc.SetLineAttributes(1, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);

                for (int index = 0; index < 60; index++, angle += Math.PI / 30.0) {
                    xMax = Math.Cos(angle) * size / 2;
                    yMax = Math.Sin(angle) * size / 2;
                    start = center;
                    stop = center;
                    if ((index % 5) == 0) {
                        int hour = ((index / 5) + 3) % 12;
                        if (hour == 0) hour = 12;

                        start.Offset((int)(xMax / 1.30), (int)(yMax / 1.30));

                        Pango.FontDescription font = Pango.FontDescription.FromString("Serif 10");
                        Pango.Layout layout = CreatePangoLayout(hour.ToString());
                        layout.FontDescription = font;
                        layout.Width = Pango.Units.FromPixels(100);

                        int textWidth;
                        int textHeight;
                        layout.GetPixelSize(out textWidth, out textHeight);

                        start.Offset(-textWidth / 2, -textHeight / 2);

                        draw.DrawLayoutWithColors(gc, start.X, start.Y, layout, fore, back);
                        layout.Dispose();

                        start = center;
                        gc.SetLineAttributes(4, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
                        start.Offset((int)(xMax / 1.05), (int)(yMax / 1.05));
                        stop.Offset((int)xMax, (int)yMax);
                        draw.DrawLine(gc, start.X, start.Y, stop.X, stop.Y);
                        gc.SetLineAttributes(1, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
                    } else {
                        start.Offset((int)(xMax / 1.05), (int)(yMax / 1.05));
                        stop.Offset((int)xMax, (int)yMax);
                        draw.DrawLine(gc, start.X, start.Y, stop.X, stop.Y);
                    }
                }
                clockFace = Pixbuf.FromDrawable(draw, draw.Colormap, 0, 0, 0, 0, width, height);

            } else {

                draw.DrawPixbuf(gc, clockFace, 0, 0, 0, 0, width, height, RgbDither.None, 0, 0);

            }

            gc.Foreground = fore;

            double startAngle = 1.5 * Math.PI;
            double secondAngle;
            double minuteAngle;
            double hourAngle;

            if (AnalogMovement) {

                double value = (CurrentTime.Second * 1000) + CurrentTime.Millisecond;
                double divisor = 60000.0;
                secondAngle = 2.0 * Math.PI * value / divisor + startAngle;
//.........这里部分代码省略.........
开发者ID:peter-gregory,项目名称:ClockRadio,代码行数:101,代码来源:AnalogClock.cs

示例12: DrawMove

        private void DrawMove(Gdk.Window window)
        {
            Gdk.GC gc = Style.ForegroundGC (StateType.Normal);

            if (info.stage == MoveStage.Start)
              {
                  int x = start_x +
                      info.start.x * (space + size);
                  int y = start_y +
                      info.start.y * (space + size);

                  window.DrawRectangle (gc, false, x, y,
                            size, size);
              }

            if (info.cursorVisible)
              {
                  Gdk.GC tempGC = new Gdk.GC (window);
                  tempGC.Copy (gc);
                  tempGC.SetLineAttributes (1,
                                LineStyle.
                                OnOffDash, 0, 0);

                  int x = start_x +
                      info.cursor.x * (space + size);
                  int y = start_y +
                      info.cursor.y * (space + size);

                  window.DrawRectangle (tempGC, false, x, y,
                            size, size);

              }

            return;
        }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:35,代码来源:Board.cs

示例13: DrawLastMove

        protected virtual void DrawLastMove(Gdk.Window window)
        {
            if (lastMove == null)
                return;

            int i = -1, j = -1;
            string letters = "abcdefgh";
            string numbers = "87654321";

            int k = lastMove.Length - 2;
            while (k >= 0)
              {
                  i = letters.IndexOf (lastMove[k]);
                  j = numbers.IndexOf (lastMove[k + 1]);
                  if (i >= 0 && j >= 0)
                      break;
                  k--;
              }

            if (i == -1 || j == -1)
                return;

            Gdk.GC gc = Style.ForegroundGC (StateType.Normal);
            Gdk.GC tempGC = new Gdk.GC (window);
            tempGC.Copy (gc);
            tempGC.SetLineAttributes (2, LineStyle.OnOffDash,
                          CapStyle.Round, 0);

            if (side)
              {
                  i = 7 - i;
                  j = 7 - j;
              }

            int x = start_x + i * (space + size);
            int y = start_y + j * (space + size);

            window.DrawRectangle (tempGC, false, x, y, size,
                          size);
        }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:40,代码来源:Board.cs

示例14: OnTableWeatherExposeEvent

        protected void OnTableWeatherExposeEvent(object o, ExposeEventArgs args)
        {
            Color fore = Style.Foreground(StateType.Normal);

            Drawable draw = args.Event.Window;
            Gdk.GC gc = new Gdk.GC(draw);

            Rectangle rect;
            switch (SelectedForecast) {
                case 0:
                    rect = imageMorning1.Allocation;
                    break;
                case 1:
                    rect = imageDay1.Allocation;
                    break;
                case 2:
                    rect = imageMorning2.Allocation;
                    break;
                case 3:
                    rect = imageDay2.Allocation;
                    break;
                case 4:
                    rect = imageMorning3.Allocation;
                    break;
                case 5:
                    rect = imageDay3.Allocation;
                    break;
                case 6:
                    rect = imageMorning4.Allocation;
                    break;
                default:
                    rect = imageDay4.Allocation;
                    break;
            }

            gc.Foreground = fore;
            gc.Background = fore;
            gc.SetLineAttributes(4, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
            draw.DrawRectangle(gc, false, rect);

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

示例15: LoadMissingIcon

 /// <summary>
 /// Loads the missing icon for a given size in pixels.
 /// </summary>
 /// <returns>The missing icon. This function uses a cache internally.</returns>
 /// <param name="sz">Size in pixels.</param>
 public static Gdk.Pixbuf LoadMissingIcon(int sz)
 {
     if (!missingIcons.ContainsKey (sz)) {
         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)));
         missingIcons [sz] = Gdk.Pixbuf.FromDrawable (pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz);
     }
     return (Gdk.Pixbuf)missingIcons [sz];
 }
开发者ID:GNOME,项目名称:longomatch,代码行数:22,代码来源:Misc.cs


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