Click here to Skip to main content
16,006,605 members
Home / Discussions / C#
   

C#

 
AnswerRe: Drawing the focus rectangle for a button Pin
Josh Smith1-May-06 7:23
Josh Smith1-May-06 7:23 
QuestionDesign Question Pin
student_rhr1-May-06 6:00
student_rhr1-May-06 6:00 
AnswerRe: Design Question Pin
Dave Kreskowiak1-May-06 6:42
mveDave Kreskowiak1-May-06 6:42 
QuestionSystem Modal Form in .NET Pin
Lav Pathak1-May-06 5:37
Lav Pathak1-May-06 5:37 
AnswerRe: System Modal Form in .NET Pin
Josh Smith1-May-06 6:09
Josh Smith1-May-06 6:09 
GeneralRe: System Modal Form in .NET Pin
Lav Pathak1-May-06 6:22
Lav Pathak1-May-06 6:22 
GeneralRe: System Modal Form in .NET Pin
Josh Smith1-May-06 7:11
Josh Smith1-May-06 7:11 
AnswerRe: System Modal Form in .NET Pin
Ravi Bhavnani1-May-06 7:23
professionalRavi Bhavnani1-May-06 7:23 
Apparently[^], MS doesn't want us to create system modal dialogs.

I tried adding the DS_SYSMODAL style to the underlying Win32 window when the form is initialized, but that didn't work. See below:

private void OnLoad(object sender, EventArgs e)
{
  Int32 nStyle = GetWindowLong (this.Handle, (-16));  // GWL_STYLE
  nStyle |= 0x02;  // DS_SYSMODAL
  nStyle = SetWindowLong (this.Handle, (-16), nStyle);
}

[DllImport("User32.dll", SetLastError=true)]
private static extern Int32 GetWindowLong
 (IntPtr hWnd, int nIndex);

[DllImport("User32.dll", SetLastError=true)]
private static extern Int32 SetWindowLong
 (IntPtr hWnd, int nIndex, Int32 nNewStyle);
I then resorted to this (extremely) cheesy solution which works:
public Form1()
{
  InitializeComponent ();

  Timer timer = new Timer();
  timer.Interval = 1;
  timer.Tick += new EventHandler (timer_Tick);
  timer.Start();
}

void timer_Tick(object sender, EventArgs e)
{
  this.TopMost = true;
  this.Activate();
}
/ravi

My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com

GeneralRe: System Modal Form in .NET Pin
Dan Neely1-May-06 7:48
Dan Neely1-May-06 7:48 
AnswerRe: System Modal Form in .NET Pin
S. Senthil Kumar1-May-06 6:56
S. Senthil Kumar1-May-06 6:56 
QuestionConverting the XML form of resultset to string in C# Pin
PrashantJ1-May-06 5:11
PrashantJ1-May-06 5:11 
AnswerRe: Converting the XML form of resultset to string in C# Pin
Guffa1-May-06 5:23
Guffa1-May-06 5:23 
GeneralRe: Converting the XML form of resultset to string in C# Pin
PrashantJ1-May-06 5:27
PrashantJ1-May-06 5:27 
AnswerRe: Converting the XML form of resultset to string in C# Pin
Guffa2-May-06 11:08
Guffa2-May-06 11:08 
QuestionHow to determine what encoding a file has Pin
WCup1-May-06 4:11
WCup1-May-06 4:11 
AnswerRe: How to determine what encoding a file has Pin
Dan Neely1-May-06 4:39
Dan Neely1-May-06 4:39 
GeneralRe: How to determine what encoding a file has Pin
WCup1-May-06 4:48
WCup1-May-06 4:48 
GeneralRe: How to determine what encoding a file has Pin
Dave Kreskowiak1-May-06 6:41
mveDave Kreskowiak1-May-06 6:41 
QuestionC# Dialer Application Pin
Ashwani_kumar1-May-06 3:49
Ashwani_kumar1-May-06 3:49 
QuestionC# GDI+ Pin
codebala1-May-06 3:31
codebala1-May-06 3:31 
AnswerRe: C# GDI+ Pin
Josh Smith1-May-06 4:03
Josh Smith1-May-06 4:03 
GeneralRe: C# GDI+ Pin
codebala1-May-06 5:29
codebala1-May-06 5:29 
GeneralRe: C# GDI+ Pin
codebala1-May-06 7:08
codebala1-May-06 7:08 
AnswerRe: C# GDI+ Pin
kasik1-May-06 5:13
kasik1-May-06 5:13 
GeneralRe: C# GDI+ Pin
codebala1-May-06 5:22
codebala1-May-06 5:22 

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.