-
February 1st, 2009, 04:47 PM
#1
Adding NoActivate to a New Form
If I create a new windows form application, and just plop the following in:
private const int WS_EX_TOOLWINDOW = 0x00000080;
private const int WS_EX_NOACTIVATE = 0x08000000;
private const int WS_EX_TOPMOST = 0x00000008;
protected override CreateParams CreateParams
{
get
{
CreateParams p = base.CreateParams;
p.ExStyle |= (WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST);
p.Parent = IntPtr.Zero;
return p;
}
}
and compile, the application will not be "activated" or focused on when clicked on.
This is exactly what I need it to do for that form, but I need the same to apply to a new form.
So suppose I do this:
public void makeNewForm()
{
Form newForm = new Form();
newForm.TopMost = true;
newForm.Show();
}
How get newForm to have the same NoActivate style as the original form?
-
February 4th, 2009, 05:18 PM
#2
Re: Adding NoActivate to a New Form
Simple give your Form containing the code you wrote a name like InactiveForm and then derive from that form
Code:
public void makeNewForm(){
InactiveForm newForm = new InactiveForm();
newForm.TopMost = true;
newForm.Show();
}
And thats all. And please use code Tags as you can see in the bottom of my post s you dont loose Codeformat.
Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|