Profile Picture

Background color in NUIDocuments

Posted By Tomas Vera 14 Years Ago
Author
Message
Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Tomas,

When DocumentManager’s is in SingleDocument view, NUIDocument resides in NSingleDocumentHost.

NSingleDocumentHost is ContainerControl which Controls[0] is the Panel that NUIDocument wraps.

To be able to make NSingleDocumentHost therefore NUIPanel transparent you should set its ControlStyle.SupportTransparentBackColor with conjunction with ControlStyle.UserPaint to true using SetStyle method in order to be able to set NSingleDocumentHost.BackColor to be transparent. Otherwise you will get an ArgumentException which said that control does not support transparent background color.

Sinse SetStyle is protected method, you should override it or call it in some place in the class, so you should create a new class that derives from NSignleDocumentHost, but this is not possible because NSingleDocumentHost is internal. So I am afraid that you cannot achieve the desired state.



Best Regards,
Nevron Support Team



Tomas Vera
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 6, Visits: 1
My application has a DocumentManager that displays document in SingleDocument mode.
(DockManager.DocumentStyle.DocumentViewStyle = SingleDocument).

I want all my child NUIDocuments to display a background image. But I want to set the image on my main form, so I only have to set it once, and all the child documents allow the background image to show through.

I can set the background image programmatically using this code:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
nDockManager1.RootContainer.Parent = nuiPanel3; // where I want my docs displayed
nDockManager1.RootContainer.BackgroundImage = Resource1.globe_bkgd; // my background image in a Resource file
nDockManager1.RootContainer.BackgroundImageLayout = ImageLayout.Stretch;
nDockManager1.RootContainer.BackColor = Color.Transparent; // needed to show the background image. not sure why.
}

I can successfully see my image if my document style is set to "MdiTabbed".

But if I set my image to "SingleDocument" or "MdiStandard" I can only see the background color (and Color.Transparent does not work; it needs to be Color.Red, Color.Green or any other non-transparent color).


I am adding documents with this code:
NUIDocument doc = new NUIDocument("My Control Title", -1, new UserControl2());
nDockManager1.DocumentManager.AddDocument(doc);

it adds the controls properly. And if DocumentStyle=MdiTabbed everything works well. But I need to use MdiSingle for display purposes.

Any suggestions?

-tomas



Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Tomas,

From your description I am not sure I understood what exactly you want to achieve.

In NDockManager.DocumentManager you can add only NUIDocuments. These NUIDocument are actually wrapped Panel controls.

Do you want to make these Panels transparent?

If yes, please note that even if you make them transparent you still won't display the image set as a Background image of the form, because NDockManager has other containers created dynamically below the documents.

Could you describe in more details what do you trying to achieve?

Thanks.

 



Best Regards,
Nevron Support Team



Tomas Vera
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 6, Visits: 1
Hello All (newbie),
I want child controls added to my Document manager to have a transparent background.

My main form has a background image that I want to show through when I add child controls using the DocumentManager.

On a windows form I can simply state "BackgroundColor = Color.Transparent".

What's the equivalent operation to documents added to my document manager?

Thanks in advance,
-tomas




Similar Topics


Reading This Topic