Hi Dennis,
Based on my understanding, you use the .Net HelpProvider class to provide
the help function for your control. You find that the help file was always
on the top of the main Form, you want to suppress this feature.
Actually, this is by the design of HelpProvider class. After show up the
help file window, the main window will intercept the help file window's
message and always keep the help file on the top of the main form.
I have provided a sample to prove this. In the sample, I use Win32 API
SetWindowPos function to make the main Form become the current top most
window of the Windows(through HWND_TOPMOST flag), like this:
private System.Windows.Forms.HelpProvider helpProvider1;
private System.Windows.Forms.TextBox textBox1;
private void Form1_Load(object sender, System.EventArgs e)
{
helpProvider1.HelpNamespace = "mspaint.chm";
helpProvider1.SetShowHelp(this.textBox1, true);
}
[DllImport("user32.dll")]
public static extern int SetWindowPos(IntPtr hwnd,IntPtr
hWndInsertAfter,int x,int y,int cx,int cy,int wFlags);
public IntPtr HWND_TOPMOST =(IntPtr)(-1);
public IntPtr HWND_NOTOPMOST =(IntPtr)(-2);
public int SWP_NOSIZE = 0x1;
private void button1_Click(object sender, System.EventArgs e)
{
SetWindowPos(this.Handle, HWND_TOPMOST, this.Left, this.Top, this.Left+
this.Width, this.Top+ this.Height, SWP_NOSIZE);
}
private void button2_Click(object sender, System.EventArgs e)
{
SetWindowPos(this.Handle, HWND_NOTOPMOST, this.Left, this.Top, this.Left+
this.Width, this.Top+ this.Height, SWP_NOSIZE);
}
The button2 will remove the top-most feature of the main form.
After press F1 in textBox1, the mspaint.chm is showed, then if you press
Button1 to make the main form top-most, you will find the main Form is
really on the top of the mspaint.chm window. But if you drag the main form
and then drop, you will find that the help file will on the top of the
main
form again(Even though the main form is "top-most").
So, you will know that the .Net will re-set the help file to the top of
the
main form, which means that .Net does not recommand you to move the main
form to the top of the help file.
Actually, the main form will intercept the messages of the help files
window, and ensure that if the main form is closed, the help file window
is
also closed. As I think, this is a reasonable design.
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.