public void Fill(Point point) { Color regionColor = _img.GetPixel(point.X, point.Y); if ((point.X == 0 || _img.GetPixel(point.X - 1, point.Y).ToArgb() == ForegroundColor.ToArgb()) && (point.Y == 0 || _img.GetPixel(point.X, point.Y - 1).ToArgb() == ForegroundColor.ToArgb()) && (point.X == _img.Width - 1 || _img.GetPixel(point.X + 1, point.Y).ToArgb() == ForegroundColor.ToArgb()) && (point.Y == _img.Height - 1 || _img.GetPixel(point.X, point.Y + 1).ToArgb() == ForegroundColor.ToArgb())) { return; } int[,] flags = new int[_img.Width, _img.Height]; Fill(point, regionColor, flags); for (int y = 0; y < _img.Height; y++) { for (int x = 0; x < _img.Width; x++) { if (flags[x, y] > 0) { _img.SetPixel(x, y, ForegroundColor); } } } this.Invalidate(); }
public static bool Save() { bool returnValue; try { using (RegistryKey registryKey = OpenRegistryKey()) { registryKey.SetValue(BACKGROUND_COLOR, BackgroundColor.ToArgb(), RegistryValueKind.DWord); registryKey.SetValue(BACKGROUND_IMAGE, BackgroundImage, RegistryValueKind.String); registryKey.SetValue(BORDER_COLOR, BorderColor.ToArgb(), RegistryValueKind.DWord); registryKey.SetValue(FADE_DELAY, FadeDelay, RegistryValueKind.DWord); registryKey.SetValue(FADESPEED, FadeSpeed, RegistryValueKind.DWord); registryKey.SetValue(FOREGROUND_COLOR, ForegroundColor.ToArgb(), RegistryValueKind.DWord); registryKey.SetValue(MAXIMUM_CACHE_ITEMS, MaximumCacheItems, RegistryValueKind.DWord); registryKey.SetValue(RANDOM_VERSE, RandomVerse.ToString(), RegistryValueKind.String); registryKey.SetValue(TEXT_FONT, TextFont.ToStringEx()); registryKey.SetValue(TITLE_FONT, TitleFont.ToStringEx()); registryKey.Close(); } returnValue = true; } catch (Exception e) { Logging.LogException(e); returnValue = false; } return(returnValue); }
public void AppendRtf(StringBuilder r, Dictionary <int, int> colorTable, Dictionary <string, int> fontTable) { var a = false; if (FontName != null && FontName.Length > 0) { var ci = fontTable[FontName]; r.AppendFormat(@"\f{0}", ci); a = true; } if (FontSize > 1) { r.AppendFormat(@"\fs{0}", (int)(2 * FontSize + 0.5f)); a = true; } if (ForegroundColor != null) { var ci = colorTable[ForegroundColor.ToArgb()]; r.AppendFormat(@"\cf{0}", ci); a = true; } if (BackgroundColor != null) { var ci = colorTable[BackgroundColor.ToArgb()]; r.AppendFormat(@"\highlight{0}", ci); a = true; } if (UnderlineStyle != UnderlineStyle.None) { var ci = colorTable[UnderlineColor.ToArgb()]; r.AppendFormat(@"\ulc{0}\ulwave", ci); a = true; } if (!string.IsNullOrEmpty(Link)) { //r.AppendFormat (@"{{{{\field{{\*\fldinst{{HYPERLINK ""{0}"" }}}}{{\fldrslt{{\ul ", Link.Replace ('\"', ' ')); r.Append(@"\ul"); a = true; } if (a) { r.Append(' '); } }