Click here to Skip to main content
15,904,655 members
Home / Discussions / C#
   

C#

 
GeneralRe: float representation Pin
Colin Angus Mackay18-Jun-08 3:34
Colin Angus Mackay18-Jun-08 3:34 
GeneralRe: float representation Pin
George_George18-Jun-08 3:46
George_George18-Jun-08 3:46 
AnswerRe: float representation Pin
CPallini18-Jun-08 3:32
mveCPallini18-Jun-08 3:32 
GeneralRe: float representation Pin
George_George18-Jun-08 3:43
George_George18-Jun-08 3:43 
GeneralRe: float representation Pin
Dan Neely18-Jun-08 3:46
Dan Neely18-Jun-08 3:46 
QuestionHow to Start FolderBrowserDialog to the middle of the screen ? Pin
Yanshof18-Jun-08 1:50
Yanshof18-Jun-08 1:50 
QuestionNot able to accomodate more number of lables Bar chart X-axix . It drops some of the labels :( ? Pin
BoboPupper18-Jun-08 1:48
BoboPupper18-Jun-08 1:48 
QuestionSending meeting request using Smtp Mail Pin
alok_2k318-Jun-08 1:29
alok_2k318-Jun-08 1:29 
AnswerRe: Sending meeting request using Smtp Mail Pin
vmtv28-Jun-10 0:43
vmtv28-Jun-10 0:43 
GeneralRe: Sending meeting request using Smtp Mail Pin
Mathew Chandy2-Feb-11 19:13
Mathew Chandy2-Feb-11 19:13 
Questionasp.net 3.5 case study Pin
arkiboys18-Jun-08 1:28
arkiboys18-Jun-08 1:28 
Question[Message Deleted] Pin
Kanthi.Adatrao18-Jun-08 1:28
Kanthi.Adatrao18-Jun-08 1:28 
AnswerRe: Kanthi Test PinPopular
J4amieC18-Jun-08 2:26
J4amieC18-Jun-08 2:26 
QuestionDllImport [modified] Pin
half-life18-Jun-08 0:49
half-life18-Jun-08 0:49 
AnswerRe: DllImport Pin
Alan Balkany18-Jun-08 3:20
Alan Balkany18-Jun-08 3:20 
GeneralRe: DllImport Pin
half-life18-Jun-08 4:00
half-life18-Jun-08 4:00 
Question.NET Remoting : 1 Client -> X Server Pin
stancrm18-Jun-08 0:33
stancrm18-Jun-08 0:33 
AnswerRe: .NET Remoting : 1 Client -> X Server Pin
joemonvarghese80@yahoo.co.in18-Jun-08 2:14
joemonvarghese80@yahoo.co.in18-Jun-08 2:14 
QuestionWhy Won't My MainForm Focus/Activate? Pin
Rafferty Uy18-Jun-08 0:30
Rafferty Uy18-Jun-08 0:30 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
Simon P Stevens18-Jun-08 0:47
Simon P Stevens18-Jun-08 0:47 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
ajtunbridge18-Jun-08 3:43
ajtunbridge18-Jun-08 3:43 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
Karthik Kalyanasundaram18-Jun-08 4:21
Karthik Kalyanasundaram18-Jun-08 4:21 
AnswerRe: Why Won't My MainForm Focus/Activate? Pin
Rafferty Uy18-Jun-08 15:21
Rafferty Uy18-Jun-08 15:21 
Hi all,

Thanks to everyone who replied. I tried calling this.BringToFront() in the MainForm's constructor and Load event but it still didn't work.
Here are some code:

Program.cs
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
  Application.EnableVisualStyles();
  Application.SetCompatibleTextRenderingDefault(false);
  Application.Run(new MainForm());
}


MainForm.cs
/// <summary>
/// Initializes a new instance of the <see cref="MainForm" /> class.
/// </summary>
public MainForm()
{
  Splasher.Show(typeof (ProgressSplashForm));
            
  Splasher.Status = "Initializing components...";
  InitializeComponent();

  Splasher.ProgressValue = 80;
  ApplicationSession.Instance.PercentHoursBeforeAlert =
    Properties.Settings.Default.PercentHoursBeforeAlert;
  ApplicationSession.Instance.PercentHoursBeforeHighAlert =
    Properties.Settings.Default.PercentHoursBeforeHighAlert;

  Splasher.ProgressValue = 85;
  ApplicationSession.Instance.DbManager = new MsAccessDbManager(Application.StartupPath);
  RefreshAvailableFunctions(false);
            
  Splasher.Status = "Initialization completed.";
  Splasher.ProgressValue = 100;
  Splasher.Close();

  this.BringToFront();
  this.Activate();
}

/// <summary>
/// Handles the Load event of the MainForm control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs" /> instance containing the event data.</param>
private void MainForm_Load(object sender, EventArgs e)
{
  this.BringToFront();
  this.Activate();
}


I also noticed that the this.IsHandleCreated and this.CanFocus properties are false in both the constructor and the load event.

*Note: The Splasher class is inspired by cncx's article[^] about splash screens. Sufficed to say, the Splasher.Show() method displays the splash screen by running a new application (Application.Run(_splashForm)).

Any ideas?

Rafferty

GeneralRe: Why Won't My MainForm Focus/Activate? Pin
Rafferty Uy18-Jun-08 15:45
Rafferty Uy18-Jun-08 15:45 
GeneralRe: Why Won't My MainForm Focus/Activate? [modified] Pin
Simon P Stevens18-Jun-08 22:16
Simon P Stevens18-Jun-08 22:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.