/// <summary> /// The GetCaption /// </summary> /// <param name="source">The source<see cref="Source"/></param> private void SetCaptionImages(Source source) { try { AppSettingsReader path = new AppSettingsReader(); string[] images = Directory.GetFiles((string)path.GetValue("SourceImages", typeof(string))); foreach (string i in images) { string p = Path.GetFileNameWithoutExtension(i); if (p.Equals(source.ToString(), StringComparison.CurrentCultureIgnoreCase)) { Bitmap b = new Bitmap(i); CaptionImage ci = new CaptionImage(); ci.Image = b; ci.BackColor = Color.Black; ci.Size = new Size(45, 15); ci.Location = new Point(10, 5); CaptionImages.Add(ci); } } } catch (Exception e) { Console.WriteLine(e); throw; } }
private void ServiceterminView_SizeChanged(object sender, EventArgs e) { int x = this.Width; CaptionImages.FindByName("imgClose").Location = new System.Drawing.Point(x - 40, 3); CaptionImages.FindByName("imgMaxRestore").Location = new System.Drawing.Point(x - 80, 3); CaptionImages.FindByName("imgMinimize").Location = new System.Drawing.Point(x - 120, 3); }