Profile Picture

NForm in Panel on XP

Posted By Brad Swearingen 13 Years Ago
Author
Message
Brad Swearingen
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3
I've been trying to take an NForm and get it to work inside a docking panel (using Nevron 11.1.17.12).  Things work as expected on Win7 but I'm having issues on WinXP.  I've got code like the following which modifies an existing NForm to prepare it:
 

private void prepFormForPanel(NForm frm)

{

frm.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;

frm.FormBorderStyle = FormBorderStyle.None;

frm.TopLevel = false;

frm.MaximizeBox = false;

frm.MinimizeBox = false;

frm.StartPosition = FormStartPosition.Manual;

frm.Location = new Point(0, 0);

// FrameAppearance has to be set for XP to not show border

NFrameAppearance frameAppearance = new NFrameAppearance();

frameAppearance.BottomBorder = 0;

frameAppearance.LeftBorder = 0;

frameAppearance.RightBorder = 0;

frameAppearance.CaptionHeight = 0;

frameAppearance.ButtonSize = Size.Empty;

frm.FrameAppearance = frameAppearance;

frm.Visible = true;

}

On XP, though the frame is not showing (due to the frm.FrameAppearance change which I found via the forum on another thread) the NForm layout is not utilizing the space where the frame was completely.  There's lots of extra white space on the bottom and the right inside the panel instead of the controls on the form filling the space through their anchor layout property.
 
If I instead use a Form (instead of an NForm) I don't have this problem but I lose the skin/palette/frame customizations that the NForm receives.
 
What's the recommended properties on an NForm being added to a docking panel for any OS?
 

 



Nevron Support
Posted 13 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 Brad,

I've tried the settings that you posted on XP machine and I couldn't replicate the extra space that you described.
However, you can try to dock the form to fill the docking panel instead of using anchoring.

frm.Dock = DockStyle.Fill;

Please, let us know if the problem persist.

Best Regards,
Nevron Support Team



Brad Swearingen
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3

As a followup related issue:

1) On Win7 right click the desktop and select Personalize

2) Select the "Windows 7 Basic" theme.

3) Start a program that puts an NForm in a docking panel

4) Set any of the skins provided (e.g. "MacOS")

5) The NForm on the panel now will show its border and title bar

6) I also have an NListView on the NForm within the panel and when changing skins its horizontal scroll bar gets messed up.  Painting problems and usability issues.

Also, this problem exists on WinXP straight away.  No need to change the desktop parameters in any way.  Surely this has been noticed on that platform for some time, right?

I'd appreciate any advice.  I expected to be able to create docking panel and document clients separately in an NForm.  I need to know if there is a workaround for this as its a shop stopper for using the skins feature altogether for me.



Nevron Support
Posted 13 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 Brad,

The form frame appears despite your FrameAppearance settings because when skin is applied the form has its skin related predefined FrameAppearance, which has priority over your custom defined skin.

To overcome this you need to create and then host into NDockingPanel new Form type which derives from NForm and overrides CurrentFrameAppearance property as follows:

public class MyForm : NForm
{
   public MyForm()
   {
      m_CustomFrameAppearance = CurrentFrameAppearance;
   }

   public override NFrameAppearance CurrentFrameAppearance
   {
      get
      {
         return m_CustomFrameAppearance;
      }
   }

   public NFrameAppearance CustomFrameAppearance
   {
      get
      {
         return m_CustomFrameAppearance;
      }
      set
      {
         m_CustomFrameAppearance = value;
      }
   }

   NFrameAppearance m_CustomFrameAppearance;
}

Then all you need is to set this new CustomFrameAppearance to the desired one.

Regarding NListView scroll bars problem. The way of the system scroll bars appears in Windows 7 does not allow us to paint correctly our scroll bars.
Unfortunately, the only advice regarding this problem I can give you is to use default scroll bars by setting UseCustomScrollBars to false.

Best Regards,
Nevron Support Team



Brad Swearingen
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3

Thanks for the tip about trying DockStyle.Fill.  It didn't have any affect, however.  Maybe it requires other changes with it?  I noticed in your docs that it said:

"The docking layout system however will work as the sizes of the controls are calculated on the fly. So, there is a simple way to prevent the non-desired anchoring behavior – simply drop a Panel with DockStyle.Fill on the form and build your layout on it (or rely entirely on Dock values)." 

Given this I tried creating my form inside a UIPanel and then it worked as expected on XP.  I'll go with that for now.  Sorry I didn't see that before.



Brad Swearingen
Posted 13 Years Ago
View Quick Profile
Forum Guru

Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)Forum Guru (53 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 53, Visits: 3
Thank you so much.  Both of those tips helped fix the problems I was seeing.  Very helpful.  I appreciate your prompt attention to the forum and for putting up with some of my new user issues.



Similar Topics


Reading This Topic