Click here to Skip to main content
15,921,716 members
Home / Discussions / C#
   

C#

 
GeneralRe: Keeping the record on hold Pin
Serge Lobko-Lobanovsky28-Jun-04 23:51
Serge Lobko-Lobanovsky28-Jun-04 23:51 
GeneralMultiple Forms Pin
Jon_Slaughter28-Jun-04 6:44
Jon_Slaughter28-Jun-04 6:44 
GeneralRe: Multiple Forms Pin
Heath Stewart28-Jun-04 6:56
protectorHeath Stewart28-Jun-04 6:56 
GeneralRe: Multiple Forms Pin
Jon_Slaughter28-Jun-04 8:21
Jon_Slaughter28-Jun-04 8:21 
GeneralRe: Multiple Forms Pin
Heath Stewart28-Jun-04 8:57
protectorHeath Stewart28-Jun-04 8:57 
GeneralRe: Multiple Forms Pin
Jon_Slaughter28-Jun-04 9:16
Jon_Slaughter28-Jun-04 9:16 
GeneralRe: Multiple Forms Pin
Heath Stewart28-Jun-04 9:34
protectorHeath Stewart28-Jun-04 9:34 
GeneralRe: Multiple Forms Pin
Jon_Slaughter28-Jun-04 11:14
Jon_Slaughter28-Jun-04 11:14 
What I'm saying is, that because I am using layered windows(setting the WS_EX_LAYERED flag and using UpdateLayeredWindow WinAPI call to display form), I it is causing problems with the multiple forms and also the inherited forms.

If I used layered forms(setting the WS_EX_LAYERED flag), then when I do multiple forms, and set form2.ShowInTaskbar = false; form2 does not show up at all(but when I do not set WS_EX_LAYERED, it works like it suppose(taskbar icon does not show up, but for does). Also, if I set that flag and try to design an inheritted form, it gives me an error about creating a windows handle, again, it works if I don't use the WS_EX_LAYERED flag.

I have setup my code so I can say if I am going to use layering techniques or not, and this solves the designer problem. But I still have the taskbar problem... I want to use layering, but need for both forms to show up and only one taskbar icon.

Heres the code that will demonstrate part of the problem(just comment out the cp.ExStyle |= 0x00080000; to get the designer to work on FormB)

FormB.cs
using System;<br />
using System.Windows.Forms;<br />
<br />
public class FormB : FormA<br />
{<br />
	public FormB() { }<br />
}


FormA.cs
using System;<br />
using System.Windows.Forms;<br />
<br />
public class FormA : System.Windows.Forms.Form<br />
{<br />
	public FormA() { }<br />
<br />
	protected override CreateParams CreateParams<br />
	{<br />
		get <br />
		{<br />
			CreateParams cp = base.CreateParams;<br />
			cp.ExStyle |= 0x00080000; <br />
			return cp;<br />
			<br />
		}<br />
	}<br />
}



Test.cs
using System;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
<br />
<br />
	class MyApplicationContext : ApplicationContext <br />
	{<br />
		FormA form1;<br />
		FormB form2;<br />
<br />
		private MyApplicationContext() <br />
		{<br />
<br />
<br />
			Application.ApplicationExit += new EventHandler(this.OnApplicationExit);<br />
<br />
			form1 = new FormA();<br />
			form1.Closed += new EventHandler(OnFormClosed);            <br />
			form1.Closing += new CancelEventHandler(OnFormClosing);            <br />
			form1.Show();<br />
<br />
			form2 = new FormB();<br />
			form2.Closed += new EventHandler(OnFormClosed);            <br />
			form2.Closing += new CancelEventHandler(OnFormClosing);     <br />
<br />
			form2.ShowInTaskbar = false;<br />
			form2.Show();<br />
			<br />
<br />
			<br />
			<br />
		}<br />
<br />
		private void OnApplicationExit(object sender, EventArgs e) { }<br />
<br />
		private void OnFormClosing(object sender, CancelEventArgs e) { }<br />
<br />
		private void OnFormClosed(object sender, EventArgs e) { ExitThread(); }<br />
		      <br />
		[STAThread]<br />
		static void Main(string[] args) <br />
		{<br />
			MyApplicationContext context = new MyApplicationContext();<br />
			Application.Run(context);<br />
		}<br />
	}



Now, if you test this, you will see that you get an error when trying to design FormB(but not FormA). You can't see the problem with the taskbar because to draw the forms I would need to include a lot more code(have to call UpdateLayeredWindow in the Win32 API). I'll mess around with that part of the problem and maybe can fix it.
GeneralRe: Multiple Forms Pin
Heath Stewart28-Jun-04 11:27
protectorHeath Stewart28-Jun-04 11:27 
GeneralMulticast Programming Pin
goodpilot28-Jun-04 6:25
goodpilot28-Jun-04 6:25 
GeneralRe: Multicast Programming Pin
Heath Stewart28-Jun-04 6:47
protectorHeath Stewart28-Jun-04 6:47 
GeneralRe: Multicast Programming Pin
goodpilot28-Jun-04 7:35
goodpilot28-Jun-04 7:35 
GeneralGetting a ConfigurationException and I dont know why Pin
Flack28-Jun-04 6:18
Flack28-Jun-04 6:18 
GeneralRe: Getting a ConfigurationException and I dont know why Pin
Heath Stewart28-Jun-04 6:25
protectorHeath Stewart28-Jun-04 6:25 
GeneralRe: Getting a ConfigurationException and I dont know why Pin
Flack28-Jun-04 6:35
Flack28-Jun-04 6:35 
Questionhow to retrieve the ProductCode? Pin
econnor28-Jun-04 6:15
econnor28-Jun-04 6:15 
AnswerRe: how to retrieve the ProductCode? Pin
Heath Stewart28-Jun-04 6:21
protectorHeath Stewart28-Jun-04 6:21 
GeneralRe: how to retrieve the ProductCode? Pin
econnor29-Jun-04 3:53
econnor29-Jun-04 3:53 
GeneralEnumerations (design question) Pin
mealnumberone28-Jun-04 5:44
mealnumberone28-Jun-04 5:44 
GeneralRe: Enumerations (design question) Pin
Heath Stewart28-Jun-04 6:33
protectorHeath Stewart28-Jun-04 6:33 
Questionneed to send within the current connection ..? Pin
Adel83k28-Jun-04 5:18
Adel83k28-Jun-04 5:18 
AnswerRe: need to send within the current connection ..? Pin
Heath Stewart28-Jun-04 6:29
protectorHeath Stewart28-Jun-04 6:29 
GeneralWindows Service App Pin
japanreddy28-Jun-04 4:37
japanreddy28-Jun-04 4:37 
GeneralRe: Windows Service App Pin
Heath Stewart28-Jun-04 4:55
protectorHeath Stewart28-Jun-04 4:55 
GeneralRe: Windows Service App Pin
Xiangyang Liu 刘向阳28-Jun-04 5:17
Xiangyang Liu 刘向阳28-Jun-04 5:17 

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.