private void UpdateTarget() { KrentoRing ring = new KrentoRing(fileName); edtTarget.Text = ring.Caption; if (!string.IsNullOrEmpty(ring.Description)) { edtDescription.Text = ring.Description; } else { edtDescription.Text = ring.Caption; } if (!string.IsNullOrEmpty(ring.LogoFile)) { if (FileOperations.FileExists(ring.LogoFile)) { if (imgLogo.Image != null) { imgLogo.Image.Dispose(); } imgLogo.Image = FastBitmap.FromFile(FileOperations.StripFileName(ring.LogoFile)); customIcon = ring.LogoFile; } else { AssignDefaultImage(); } } else { AssignDefaultImage(); } ring.Dispose(); }
internal void BuildItems() { for (int i = 0; i < items.Count; i++) { if (items[i] != null) { items[i].Dispose(); } } items.Clear(); KrentoRing ring; for (int i = 0; i < manager.HistoryCount; i++) { ring = new KrentoRing(manager.History[i].IniFile); items.Add(ring); } if (!inplace) { items.Add(null); } places = new Rectangle[items.Count]; }
public void FillList() { KrentoRing ring; string[] rings = Directory.GetFiles(GlobalConfig.RollingStonesFolder, "*.circle"); foreach (string fileName in rings) { ring = new KrentoRing(fileName); lstRings.Items.Add(ring); } }
private static Bitmap GetLogoFromRing(string ringName) { if (!FileOperations.FileExists(ringName)) { return(null); } KrentoRing ring = new KrentoRing(ringName); Bitmap result = BitmapPainter.ConvertToRealColors(ring.Logo, false); ring.Dispose(); return(result); }
public void Save() { ring = new KrentoRing(FileName); try { ring.Description = edtDescription.Text; ring.LogoFile = logoFile; ring.Save(); } finally { ring.Dispose(); ring = null; } }
private void lstRings_DrawItem(object sender, DrawItemEventArgs e) { StringFormat sr; //e.DrawBackground(); //e.Graphics.FillRectangle(backBrush, e.Bounds); using (Bitmap background = new Bitmap(e.Bounds.Width, e.Bounds.Height, PixelFormat.Format32bppPArgb)) { using (Graphics g = Graphics.FromImage(background)) { g.SmoothingMode = SmoothingMode.HighQuality; g.InterpolationMode = GlobalConfig.InterpolationMode; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.CompositingQuality = CompositingQuality.HighQuality; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; //Brush backBrush; if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { g.DrawImage(buttonBg, new Rectangle(0, 0, background.Width, background.Height)); //backBrush = SystemBrushes.Highlight; // g.FillRectangle(backBrush, new Rectangle(0, 0, background.Width, background.Height)); } else { using (Brush b = new SolidBrush(e.BackColor)) { g.FillRectangle(b, new Rectangle(0, 0, background.Width, background.Height)); } } if (e.Index > -1) { sr = StringFormat.GenericDefault; KrentoRing ring = (KrentoRing)lstRings.Items[e.Index]; Brush brush = ((e.State & DrawItemState.Selected) == DrawItemState.Selected ? Brushes.Black : SystemBrushes.WindowText); Font headerFont = new Font(SystemFonts.DialogFont.FontFamily, 12, FontStyle.Bold, GraphicsUnit.Pixel); g.DrawImage(ring.Logo, new Rectangle(2, 2, 48, 48)); g.DrawString(ring.Caption, headerFont, brush, new Rectangle(52, 2, background.Width - 52, (int)Math.Ceiling((double)headerFont.GetHeight(g)) + 4), sr); sr.Trimming = StringTrimming.EllipsisWord; sr.FormatFlags = StringFormatFlags.LineLimit; string desc = ring.Description; if (string.IsNullOrEmpty(desc)) { desc = SR.CircleDefaultDescription; } else { desc = desc.Replace(Environment.NewLine, " "); } g.DrawString(desc, e.Font, brush, new Rectangle(52, 6 + headerFont.Height, background.Width - 52, background.Height - (int)Math.Ceiling((double)headerFont.GetHeight(g)) - 8), sr); sr.Dispose(); headerFont.Dispose(); } } e.Graphics.DrawImage(background, e.Bounds); } // e.DrawFocusRectangle(); }