Windows Develop Bookmark and Share   
 index > Windows Forms General > Problem with windows themes and child forms
 

Problem with windows themes and child forms

Hi,

First of all, forgive me if I don't use the correct terms, I'm quite new with windows forms and all (and I'm not english ^^)

I have a main windows form. Inside, I want to have 2 other forms. I want those forms to be "cropped" to the main windows (I don't want MDI windows, I want the child forms to stay inside the main form)

I somehow managed to do that, but now, I have a weird problem with the windows themes : when a child window is minimized, the theme is correctly applied to its header bar, but when it's maximize or normal, then the theme is not applied. Here is a screenshot to show what happens :

http://paicky.free.fr/prob_theme.jpg

Thanks in advance for any help.

PS: If you need to see some piece of code that I used, ask and I'll post it.

Paic Citron  Thursday, January 26, 2006 9:27 AM

No one has an idea ?

I spent the morning reading docs, trying to find articles on the web, but with no success :( Anybody has a link / book to recommend ? I would really like to learn about windows forms, but there's so much stuff going on, that I don't know where to start.

I really need help ^^

Paic Citron  Thursday, January 26, 2006 2:41 PM

You shouldn't be having problems if you've done it correctly.

http://www.dotnetrix.co.uk/misc.html --> Add forms as user controls.

Is that a custom theme or an ownerdraw nonclient area?

Mick Doherty  Thursday, January 26, 2006 5:49 PM
Hi,
I'm just using WindowBlinds which is a sort of theme manager for windows (replace the default windows themes of the windows, the windows toolbars, etc.) I didn't check if the same hapens if I disable WindowBlinds.

I'll check your link, and try to disable WindowBlinds to see what hapens. Thx for the help.
Paic Citron  Friday, January 27, 2006 8:12 AM
Ok, the problem seems to come from WindowBlinds : when I unload it, and use the standard Window XP themes, all works fine. But I'd still like to make it works with windowblinds, so here is a little details about the implementation, in case I forgot something important / did a mystake :

<pre>
// this is in the void InitializeComponent(void) of the SGE_OptionForm form :

this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(133, 272);
this->Name = L"SGE_OptionForm";

// this is in the constructor of the SGE_MainForm form :

m_OptionForm = gcnew SGE_OptionForm;
m_OptionForm->Dock = System::Windows::Forms::DockStyle::Right;
m_OptionForm->Owner = this;
m_OptionForm->TopLevel = false;
m_OptionForm->Show();

// this line is the only way I found to make my option form NOT overrlap my menu
this->toolStripContainer->ContentPanel->Controls->Add(m_OptionForm);
</pre>


Now, if I replace the last part by :

<pre>
m_OptionForm = gcnew SGE_OptionForm;
m_OptionForm->Show(this);
</pre>

The theme is correctly applied.

Is there anything wrong with my code ? Some parameters I should set ? ??

Thx for any help
Paic Citron  Friday, January 27, 2006 8:51 AM

I'm not a user of windowblinds so I can't help there, but you're code looks OK to me. Maybe WindowBlinds does not skin forms when they are used as controls rather than as MDIChildren.

Did you try the example from my site?

I did find this link on the stardock site, but I don't know how helpful it'll be:

http://stardock.helpserve.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=156&nav=0,1,37,42

Mick Doherty  Friday, January 27, 2006 6:11 PM
Ok, thx for the link. I'll try that later.
But I think it really comes from WindowBlind, so I think I'll leave it like that. And if the solution given in the link works, then it'd be perfect ^^

Thx again, have a good day.
Paic Citron  Monday, January 30, 2006 8:37 AM

You can use google to search for other answers

Custom Search

More Threads

• Seting Cell Format to Datagridview control
• VERY simple question about fonts.
• Problem with ToolBar in PocketPC
• MenuStrip shifts down in MDI-application ???
• Adding a code to an existing form
• Converting 1.2E+7 (textbox) to a long causes exception
• FormClosing e.Cancel always true
• Document Outline
• Paint over Child controls
• Form IsInitializing