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


C# Gdk.Color类代码示例

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


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

示例1: GetVisualizerWidget

		public override Control GetVisualizerWidget (ObjectValue val)
		{
			string value = val.Value;
			Gdk.Color col = new Gdk.Color (85, 85, 85);

			if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]"))
				value = '"' + GetString (val) + '"';
			if (DebuggingService.HasInlineVisualizer (val))
				value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);

			var label = new Gtk.Label ();
			label.Text = value;
			var font = label.Style.FontDescription.Copy ();

			if (font.SizeIsAbsolute) {
				font.AbsoluteSize = font.Size - 1;
			} else {
				font.Size -= (int)(Pango.Scale.PangoScale);
			}

			label.ModifyFont (font);
			label.ModifyFg (StateType.Normal, col);
			label.SetPadding (4, 4);

			if (label.SizeRequest ().Width > 500) {
				label.WidthRequest = 500;
				label.Wrap = true;
				label.LineWrapMode = Pango.WrapMode.WordChar;
			} else {
				label.Justify = Gtk.Justification.Center;
			}

			if (label.Layout.GetLine (1) != null) {
				label.Justify = Gtk.Justification.Left;
				var line15 = label.Layout.GetLine (15);
				if (line15 != null) {
					label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…";
				}
			}

			label.Show ();

			return label;
		}
开发者ID:michaelc37,项目名称:monodevelop,代码行数:44,代码来源:GenericPreviewVisualizer.cs

示例2: ColorBlend

        // Copied from Banshee.Hyena.Gui.GtkUtilities
        // Copyright (C) 2007 Aaron Bockover <[email protected]>
        public static Gdk.Color ColorBlend(Gdk.Color a, Gdk.Color b)
        {
            // at some point, might be nice to allow any blend?
            double blend = 0.5;

            if (blend < 0.0 || blend > 1.0) {
                throw new ApplicationException ("blend < 0.0 || blend > 1.0");
            }

            double blendRatio = 1.0 - blend;

            int aR = a.Red >> 8;
            int aG = a.Green >> 8;
            int aB = a.Blue >> 8;

            int bR = b.Red >> 8;
            int bG = b.Green >> 8;
            int bB = b.Blue >> 8;

            double mR = aR + bR;
            double mG = aG + bG;
            double mB = aB + bB;

            double blR = mR * blendRatio;
            double blG = mG * blendRatio;
            double blB = mB * blendRatio;

            Gdk.Color color = new Gdk.Color ((byte)blR, (byte)blG, (byte)blB);
            Gdk.Colormap.System.AllocColor (ref color, true, true);

            return color;
        }
开发者ID:pulb,项目名称:basenji,代码行数:34,代码来源:Util.cs

示例3: GetGdkTextMidColor

 public static Gdk.Color GetGdkTextMidColor (Widget widget)
 {
     Cairo.Color color = GetCairoTextMidColor (widget);
     Gdk.Color gdk_color = new Gdk.Color ((byte)(color.R * 255), (byte)(color.G * 255), (byte)(color.B * 255));
     Gdk.Colormap.System.AllocColor (ref gdk_color, true, true);
     return gdk_color;
 }
开发者ID:fatman2021,项目名称:gnome-apps,代码行数:7,代码来源:GtkTheme.cs

示例4: GtkProtobuildModuleConfigurationWidget

        public GtkProtobuildModuleConfigurationWidget()
		{
			this.Build ();

			var separatorColor = new Gdk.Color (176, 178, 181);
			solutionNameSeparator.ModifyBg (StateType.Normal, separatorColor);
			locationSeparator.ModifyBg (StateType.Normal, separatorColor);

			eventBox.ModifyBg (StateType.Normal, new Gdk.Color (255, 255, 255));

			var leftHandBackgroundColor = new Gdk.Color (225, 228, 232);
			leftBorderEventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor);
			projectConfigurationRightBorderEventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor);
			projectConfigurationTopEventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor);
			projectConfigurationTableEventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor);
			projectConfigurationBottomEventBox.ModifyBg (StateType.Normal, leftHandBackgroundColor);

			moduleNameTextBox.ActivatesDefault = true;
			locationTextBox.ActivatesDefault = true;

            moduleNameTextBox.TruncateMultiline = true;
			locationTextBox.TruncateMultiline = true;

			RegisterEvents ();
		}
开发者ID:Protobuild,项目名称:Protobuild.IDE.MonoDevelop,代码行数:25,代码来源:GtkProtobuildModuleConfigurationWidget.cs

示例5: RowStyle

 /// <summary>
 /// Initializes a new instance of the RowStyle class with default settings
 /// </summary>
 public RowStyle()
 {
     this.backColor = Color.Empty;
     this.foreColor = Color.Empty;
     this.font = null;
     this.alignment = RowAlignment.Center;
 }
开发者ID:tizianomanni,项目名称:holly-gtk-widgets,代码行数:10,代码来源:RowStyle.cs

示例6: SparkleLink

        public SparkleLink(string title, string url)
            : base()
        {
            Label label = new Label () {
                Ellipsize = Pango.EllipsizeMode.Middle,
                UseMarkup = true,
                Markup = title,
                Xalign    = 0
            };

            Add (label);

            Gdk.Color color = new Gdk.Color ();

            // Only make links for files that exist
            if (!url.StartsWith ("http://") && !File.Exists (url)) {

                // Use Tango Aluminium for the links
                Gdk.Color.Parse ("#2e3436", ref color);
                label.ModifyFg (StateType.Normal, color);
                return;

            }

            // Use Tango Sky Blue for the links
            Gdk.Color.Parse ("#3465a4", ref color);
            label.ModifyFg (StateType.Normal, color);

            // Open the URL when it is clicked
            ButtonReleaseEvent += delegate {

                Process process = new Process ();
                process.StartInfo.FileName  = "gnome-open";
                process.StartInfo.Arguments = url.Replace (" ", "\\ "); // Escape space-characters
                process.Start ();

            };

            // Add underline when hovering the link with the cursor
            EnterNotifyEvent += delegate {

                label.Markup = "<u>" + title + "</u>";
                ShowAll ();
                Realize ();
                GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Hand2);

            };

            // Remove underline when leaving the link with the cursor
            LeaveNotifyEvent += delegate {

                label.Markup = title;
                ShowAll ();
                Realize ();
                GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Arrow);

            };
        }
开发者ID:kristi,项目名称:SparkleShare,代码行数:58,代码来源:SparkleLink.cs

示例7: RotatedTextExposeEvent

		void RotatedTextExposeEvent (object sender, ExposeEventArgs a)
		{
			DrawingArea drawingArea = sender as DrawingArea;

			int width = drawingArea.Allocation.Width;
			int height = drawingArea.Allocation.Height;

			double deviceRadius;

			// Get the default renderer for the screen, and set it up for drawing 
			Gdk.PangoRenderer renderer = Gdk.PangoRenderer.GetDefault (drawingArea.Screen);
			renderer.Drawable = drawingArea.GdkWindow;
			renderer.Gc = drawingArea.Style.BlackGC;

			// Set up a transformation matrix so that the user space coordinates for
			// the centered square where we draw are [-RADIUS, RADIUS], [-RADIUS, RADIUS]
			// We first center, then change the scale
			deviceRadius = Math.Min (width, height) / 2;
			Matrix matrix = Pango.Matrix.Identity;
			matrix.Translate (deviceRadius + (width - 2 * deviceRadius) / 2, deviceRadius + (height - 2 * deviceRadius) / 2);
			matrix.Scale (deviceRadius / RADIUS, deviceRadius / RADIUS);

			// Create a PangoLayout, set the font and text
			Context context = drawingArea.CreatePangoContext ();
			Pango.Layout layout = new Pango.Layout (context);
			layout.SetText ("Text");
			FontDescription desc = FontDescription.FromString ("Sans Bold 27");
			layout.FontDescription = desc;

			// Draw the layout N_WORDS times in a circle
			for (int i = 0; i < N_WORDS; i++)
			{
				Gdk.Color color = new Gdk.Color ();
				Matrix rotatedMatrix = matrix;
				int w, h;
				double angle = (360 * i) / N_WORDS;

				// Gradient from red at angle == 60 to blue at angle == 300
				color.Red = (ushort) (65535 * (1 + Math.Cos ((angle - 60) * Math.PI / 180)) / 2);
				color.Green = 0;
				color.Blue = (ushort) (65535 - color.Red);

				renderer.SetOverrideColor (RenderPart.Foreground, color);

				rotatedMatrix.Rotate (angle);
				context.Matrix = rotatedMatrix;

				// Inform Pango to re-layout the text with the new transformation matrix
				layout.ContextChanged ();
				layout.GetSize (out w, out h);
				renderer.DrawLayout (layout, - w / 2, (int) (- RADIUS * Pango.Scale.PangoScale));
			}

			// Clean up default renderer, since it is shared
			renderer.SetOverrideColor (RenderPart.Foreground, Gdk.Color.Zero);
			renderer.Drawable = null;
			renderer.Gc = null;
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:58,代码来源:DemoRotatedText.cs

示例8: TerminalPad

        public TerminalPad()
        {
            //FIXME look up most of these in GConf
            term = new Terminal ();
            term.ScrollOnKeystroke = true;
            term.CursorBlinks = true;
            term.MouseAutohide = true;
            term.FontFromString = "monospace 10";
            term.Encoding = "UTF-8";
            term.BackspaceBinding = TerminalEraseBinding.Auto;
            term.DeleteBinding = TerminalEraseBinding.Auto;
            term.Emulation = "xterm";

            Gdk.Color fgcolor = new Gdk.Color (0, 0, 0);
            Gdk.Color bgcolor = new Gdk.Color (0xff, 0xff, 0xff);
            Gdk.Colormap colormap = Gdk.Colormap.System;
            colormap.AllocColor (ref fgcolor, true, true);
            colormap.AllocColor (ref bgcolor, true, true);
            term.SetColors (fgcolor, bgcolor, fgcolor, 16);

            //FIXME: whats a good default here
            //term.SetSize (80, 5);

            // seems to want an array of "variable=value"
                    string[] envv = new string [Environment.GetEnvironmentVariables ().Count];
                    int i = 0;
            foreach (DictionaryEntry e in Environment.GetEnvironmentVariables ())
            {
                if (e.Key == "" || e.Value == "")
                    continue;
                envv[i] = String.Format ("{0}={1}", e.Key, e.Value);
                i ++;
            }

            term.ForkCommand (Environment.GetEnvironmentVariable ("SHELL"), Environment.GetCommandLineArgs (), envv, Environment.GetEnvironmentVariable ("HOME"), false, true, true);

            term.ChildExited += new EventHandler (OnChildExited);

            VScrollbar vscroll = new VScrollbar (term.Adjustment);

            HBox hbox = new HBox ();
            hbox.PackStart (term, true, true, 0);
            hbox.PackStart (vscroll, false, true, 0);

            frame.ShadowType = Gtk.ShadowType.In;
            ScrolledWindow sw = new ScrolledWindow ();
            sw.Add (hbox);
            frame.Add (sw);

            Control.ShowAll ();

            /*			Runtime.TaskService.CompilerOutputChanged += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (SetOutput));
            projectService.StartBuild += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (SelectMessageView));
            projectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClosed));
            projectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineOpen));
            */
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:57,代码来源:TerminalPad.cs

示例9: OnButtonOkClicked

		/// <summary>
		/// Raises the button ok clicked event.
		/// </summary>
		/// <param name="sender">Sender.</param>
		/// <param name="e">E.</param>
		protected void OnButtonOkClicked (object sender, EventArgs e)
		{
			Application.Invoke(delegate 
			                       {
				progressbar3.Text = Mono.Unix.Catalog.GetString("Verifying...");			
			});

			bool bAreAllSettingsOK = true;
			Config.SetGameName (GameName_entry.Text);

			ESystemTarget SystemTarget = Utilities.ParseSystemTarget (combobox_SystemTarget.ActiveText);
			if (SystemTarget != ESystemTarget.Invalid)
			{
				Config.SetSystemTarget (SystemTarget);
			}
			else
			{
				bAreAllSettingsOK = false;
			}

			if (FTPURL_entry.Text.StartsWith ("ftp://"))
			{
				Config.SetBaseFTPUrl (FTPURL_entry.Text);
			} 
			else
			{
				bAreAllSettingsOK = false;
				Gdk.Color col = new Gdk.Color(255, 128, 128);
				FTPURL_entry.ModifyBase(StateType.Normal, col);
				FTPURL_entry.TooltipText = Mono.Unix.Catalog.GetString("The URL needs to begin with \"ftp://\". Please correct the URL.");
			}

			Config.SetFTPPassword (FTPPassword_entry.Text);
			Config.SetFTPUsername (FTPUsername_entry.Text);


			if (bAreAllSettingsOK)
			{
				if (Checks.CanConnectToFTP ())
				{
					Destroy ();
				}
				else
				{
					MessageDialog dialog = new MessageDialog (
						null, DialogFlags.Modal, 
						MessageType.Warning, 
						ButtonsType.Ok, 
						Mono.Unix.Catalog.GetString("Failed to connect to the FTP server. Please check your FTP settings."));

					dialog.Run ();
					dialog.Destroy ();
				}
			}

			progressbar3.Text = Mono.Unix.Catalog.GetString("Idle");
		}
开发者ID:furesoft,项目名称:Launchpad,代码行数:62,代码来源:SettingsDialog.cs

示例10: ToGdkColor

        public static Gdk.Color ToGdkColor(this Cairo.Color color)
        {
            Gdk.Color c = new Gdk.Color ();
                c.Blue = (ushort)(color.B * ushort.MaxValue);
                c.Red = (ushort)(color.R * ushort.MaxValue);
                c.Green = (ushort)(color.G * ushort.MaxValue);

                return c;
        }
开发者ID:moscrif,项目名称:ide,代码行数:9,代码来源:ImageHelp.cs

示例11: HDateEdit

        public HDateEdit()
        {
            this.Build();

            CurrentDate = DateTime.Now;
            NormalColor = comboBox.Entry.Style.Text( Gtk.StateType.Normal );
            //
            comboBox.Entry.Changed       += new EventHandler( OnTxtDateChanged );
            comboBox.PopupButton.Clicked += new EventHandler( OnBtnShowCalendarClicked );
        }
开发者ID:tizianomanni,项目名称:holly-gtk-widgets,代码行数:10,代码来源:HDateEdit.cs

示例12: CreateAbout

        private void CreateAbout() {
            Gdk.Color fgcolor = new Gdk.Color();
            Gdk.Color.Parse("red", ref fgcolor);
            Label version = new Label() {
                Markup = string.Format(
                    "<span font_size='small' fgcolor='#729fcf'>{0}</span>",
                    string.Format(
                    Properties_Resources.Version,
                    this.Controller.RunningVersion,
                    this.Controller.CreateTime.GetValueOrDefault().ToString("d"))),
                Xalign = 0
            };

            Label credits = new Label() {
                LineWrap = true,
                LineWrapMode = Pango.WrapMode.Word,
                Markup = "<span font_size='small' fgcolor='#729fcf'>" +
                "Copyright © 2013–" + DateTime.Now.Year.ToString() + " GRAU DATA AG, Aegif and others.\n" +
                "\n" + Properties_Resources.ApplicationName +
                " is Open Source software. You are free to use, modify, " +
                "and redistribute it under the GNU General Public License version 3 or later." +
                "</span>",
                WidthRequest = 330,
                Wrap = true,
                Xalign = 0
            };

            LinkButton website_link = new LinkButton(this.Controller.WebsiteLinkAddress, Properties_Resources.Website);
            website_link.ModifyFg(StateType.Active, fgcolor);
            LinkButton credits_link = new LinkButton(this.Controller.CreditsLinkAddress, Properties_Resources.Credits);
            LinkButton report_problem_link = new LinkButton(this.Controller.ReportProblemLinkAddress, Properties_Resources.ReportProblem);

            HBox layout_links = new HBox(false, 0);
            layout_links.PackStart(website_link, false, false, 0);
            layout_links.PackStart(credits_link, false, false, 0);
            layout_links.PackStart(report_problem_link, false, false, 0);

            VBox layout_vertical = new VBox(false, 0);
            layout_vertical.PackStart(new Label(string.Empty), false, false, 42);
            layout_vertical.PackStart(version, false, false, 0);
            layout_vertical.PackStart(credits, false, false, 9);
            layout_vertical.PackStart(new Label(string.Empty), false, false, 0);
            layout_vertical.PackStart(layout_links, false, false, 0);

            HBox layout_horizontal = new HBox(false, 0) {
                BorderWidth   = 0,
                HeightRequest = 260,
                WidthRequest  = 640
            };
            layout_horizontal.PackStart(new Label(string.Empty), false, false, 150);
            layout_horizontal.PackStart(layout_vertical, false, false, 0);

            this.Add(layout_horizontal);
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:54,代码来源:About.cs

示例13: frmFriendManager

		public frmFriendManager () :
			base (Gtk.WindowType.Toplevel)
		{
			this.Build ();

			Gdk.Color fontcolor = new Gdk.Color(255,255,255);
			label1.ModifyFg(StateType.Normal, fontcolor);
			label2.ModifyFg(StateType.Normal, fontcolor);
			label3.ModifyFg(StateType.Normal, fontcolor);
			label4.ModifyFg(StateType.Normal, fontcolor);
			label5.ModifyFg(StateType.Normal, fontcolor);


			Gdk.Color col = new Gdk.Color ();
			Gdk.Color.Parse ("#3b5998", ref col);

			ModifyBg (StateType.Normal, col);


			FriendManager.CampaignStopLogevents.addToLogger += new EventHandler (CampaignnameLog);
			txtUseSingleMessage.Visible = false;


			try
			{
				chkUseSingleItem.Label = "Use Single Keyword";
				btnFriendsLoadKeywords.Sensitive = true;
				btnLoadProfileUrlFriendManager.Sensitive = false;
				btnFridendProfileUrl.Sensitive = false;
				btn_LoadUrlsMessage.Sensitive = false;
				btnFriendsLoadPicture.Sensitive = false;			


				chkUseUploadedProfileUrls.Sensitive=true;
				txt_noOfFriendsCount.Sensitive=true;
				cmbFriendsInput.Active=0;
				chkFriendsManagerSendWithTxtMessage.Sensitive=false;
				chk_ExportDataFriendsManager.Sensitive=true;
				btnStopProcessFriendManager.Sensitive=false;

				btn_LoadSingleImage.Visible=false;
				chk_UseSingleImage.Sensitive=false;
				//chkFriendsManagerSendWithTxtMessage.Visible=false;
				chk_ExportDataFriendsManager.Visible=false;
				btn_loadFanpageUrls.Sensitive=false;


			}
			catch (Exception ex)
			{
				Console.WriteLine (ex.StackTrace);
			}
		}
开发者ID:sumitglobussoft,项目名称:pinDominator-3.0,代码行数:53,代码来源:frmFriendManager.cs

示例14: DPin

 /// <summary>
 /// Initializes a new instance of the <see cref="PrototypeBackend.DPin"/> class.
 /// </summary>
 /// <param name="info">Info.</param>
 /// <param name="context">Context.</param>
 public DPin(SerializationInfo info, StreamingContext context)
 {
     Type = (PinType)info.GetByte ("Type");
     Mode = (PinMode)info.GetByte ("Mode");
     Name = info.GetString ("Name");
     Number = info.GetUInt32 ("Number");
     AnalogNumber = info.GetInt32 ("AnalogNumber");
     SDA = info.GetBoolean ("SDA");
     SCL = info.GetBoolean ("SCL");
     RX = info.GetBoolean ("RX");
     TX = info.GetBoolean ("TX");
     PlotColor = new Gdk.Color (info.GetByte ("RED"), info.GetByte ("GREEN"), info.GetByte ("BLUE"));
 }
开发者ID:Onkeliroh,项目名称:DSA,代码行数:18,代码来源:DPin.cs

示例15: ConvertStringToColor

        public static Gdk.Color ConvertStringToColor(string color)
        {
            string[] rgba = color.Split(char.Parse(Constants.COLOR_SEPARATOR));

             Gdk.Color clr = new Gdk.Color(0,0,0);

            clr.Red = ushort.Parse(rgba[0]);
            clr.Green = ushort.Parse(rgba[1]);
            clr.Blue = ushort.Parse(rgba[2]);
            clr.Pixel = uint.Parse(rgba[3]);

             return clr;
        }
开发者ID:joshball,项目名称:astrogrep,代码行数:13,代码来源:Common.cs


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