Comment amener (form_x) au premier plan. J'ai un usercontrol personnalisé qui s'ouvre (form_x) et j'utilise cette commande usercontrol pour tous mes formulaires. et maintenant le problème est que le contrôle usercontrol ouvre un nouveau (form_x) au lieu de bringing de (form_x) au front.custom usercontrol - Mettre un formulaire à l'avant
mon contrôle
namespace template
{
public partial class Background : UserControl
{
IniFile ini = new IniFile(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"\config.ini");
public Background()
{
InitializeComponent();
//Console.WriteLine(FilterNumbers("1.0.0.0. beta"));
//Console.WriteLine(FormatFileSize(125463));
}
private void lbl_About_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
frm_about formOptions = new frm_about();
bool isFormOpen = false;
foreach (Form frm in Application.OpenForms)
{
if (frm is frm_about)
{
frm.BringToFront();
isFormOpen = true;
break;
}
}
if (!isFormOpen)
formOptions.Show();
else
formOptions.Dispose();
}
private void ThisRefresh()
{
this.lbl_About.Visible = _About;
this.lbl_About.Enabled = _AboutE;
}
private bool _AboutE;
public bool AboutE
{
get { return _AboutE; }
set { _AboutE = value; ThisRefresh(); }
}
public static string FilterNumbers(string mightContainNumbers)
{
if (mightContainNumbers == null || mightContainNumbers.Length == 0) return "";
StringBuilder builder = new StringBuilder(mightContainNumbers.Length);
foreach (char c in mightContainNumbers)
if (Char.IsNumber(c))
builder.Append(c);
return builder.ToString();
}
public static string FormatFileSize(long fileSize)
{
if (fileSize < 0) throw new ArgumentOutOfRangeException("fileSize");
if (fileSize >= 1024 * 1024 * 1024) return string.Format("{0:########0.00} GB", ((double)fileSize)/(1024 * 1024 * 1024));
else if (fileSize >= 1024 * 1024) return string.Format("{0:####0.00} MB", ((double)fileSize)/(1024 * 1024));
else if (fileSize >= 1024) return string.Format("{0:####0.00} KB", ((double)fileSize)/1024);
else return string.Format("{0} bytes", fileSize);
}
}
}
//
Pouvez-vous poster le code que vous avez actuellement. – ChrisF
salut, quel code voulez-vous dire? Si vous demandez comment je fais (form_x) au devant je dois dire que je n'en ai pas encore. (Questions mises à jour). Merci pour l'entrée –