-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomMessageBoxForm.cs
More file actions
51 lines (46 loc) · 1.71 KB
/
CustomMessageBoxForm.cs
File metadata and controls
51 lines (46 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Drawing;
using System.Windows.Forms;
using ClearCacheIcons.Helpers;
namespace ClearCacheIcons
{
public partial class CustomMessageBoxForm : Form
{
public CustomMessageBoxForm(string message, string title)
{
InitializeComponent();
this.Text = title;
this.labelMessage.Text = message;
// Apply localization to the close button
LocalizationManager.ApplyLocalization(this);
// Apply custom styles
this.BackColor = System.Drawing.ColorTranslator.FromHtml("#023047");
this.labelMessage.ForeColor = Color.White;
this.buttonClose.ForeColor = Color.White;
this.buttonClose.Font = new Font("Comic Sans MS", 10, FontStyle.Bold);
// Load and apply button background image from embedded resources
try
{
Image? buttonImage = ImageUtils.CargarImagenDesdeRecurso("boton.png");
if (buttonImage != null)
{
this.buttonClose.BackgroundImage = buttonImage;
this.buttonClose.BackgroundImageLayout = ImageLayout.Stretch;
}
else
{
Logger.Log($"Error: Embedded button image 'boton.png' not found for CustomMessageBoxForm.", true);
}
}
catch (Exception ex)
{
Logger.Log("Error loading button image for custom message box: " + ex.Message, true);
}
}
private void buttonClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}