473,563 Members | 2,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'frmBaseForm' is not CLS-compliant because it derives from 'DockContent', which is not CLS-compliant.

Hi,

I have this Warning for several forms when using the DockPanel Suite of
Weifen Luo in VS.NET 2005. I read a lot about this CLS-compliant stuff, but
I don't now how to chech actually which part of the class is not
CSL-compliant? Any body knows what to look for? I just want to get rid of
these warnings :-)

Thanks a lot in advance,

Pieter


PS: The whole non CLS-compliant class, in case it can be usefull:

//
*************** *************** *************** *************** *************** **
//
// Copyright 2004, Weifen Luo
// All rights reserved. The software and associated documentation
// supplied hereunder are the proprietary information of Weifen Luo
// and are supplied subject to licence terms.
//
// WinFormsUI Library Version 1.0
//
*************** *************** *************** *************** *************** **

using System;
using System.Componen tModel;
using System.Drawing;
using System.Windows. Forms;
using System.Runtime. InteropServices ;

namespace WeifenLuo.WinFo rmsUI
{
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/ClassDef/*'/>
public class DockContent : Form
{
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Constructor[@name="()"]/*'/>
public DockContent()
{
RefreshMdiInteg ration();
}

/// <exclude/>
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (m_hiddenMdiChi ld != null)
{
m_hiddenMdiChil d.Close();
m_hiddenMdiChil d = null;
}

DockPanel = null;
if (AutoHideTab != null)
AutoHideTab.Dis pose();
if (DockPaneTab != null)
DockPaneTab.Dis pose();
}

base.Dispose(di sposing);
}

private bool m_allowRedockin g = true;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="AllowRed ocking"]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.AllowRedock ing.Description ")]
[DefaultValue(tr ue)]
public bool AllowRedocking
{
get { return m_allowRedockin g; }
set { m_allowRedockin g = value; }
}

private DockAreas m_allowedAreas = DockAreas.DockL eft |
DockAreas.DockR ight | DockAreas.DockT op | DockAreas.DockB ottom |
DockAreas.Docum ent | DockAreas.Float ;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="Dockable Areas"]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.DockableAre as.Description" )]
[DefaultValue(Do ckAreas.DockLef t|DockAreas.Doc kRight|DockArea s.DockTop|DockA reas.DockBottom |DockAreas.Docu ment|DockAreas. Float)]
public DockAreas DockableAreas
{
get { return m_allowedAreas; }
set
{
if (m_allowedAreas == value)
return;

if (!DockHelper.Is DockStateValid( DockState, value))
throw(new
InvalidOperatio nException(Reso urceHelper.GetS tring("DockCont ent.DockableAre as.InvalidValue ")));

m_allowedAreas = value;

if (!DockHelper.Is DockStateValid( ShowHint, m_allowedAreas) )
ShowHint = DockState.Unkno wn;
}
}

private double m_autoHidePorti on = 0.25;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="AutoHide Portion"]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.AutoHidePor tion.Descriptio n")]
[DefaultValue(0. 25)]
public double AutoHidePortion
{
get { return m_autoHidePorti on; }
set
{
if (value <= 0 || value > 1)
throw(new
ArgumentOutOfRa ngeException(Re sourceHelper.Ge tString("DockCo ntent.AutoHideP ortion.OutOfRan ge")));

if (m_autoHidePort ion == value)
return;

m_autoHidePorti on = value;

if (DockPanel == null)
return;

if (DockPanel.Acti veAutoHideConte nt == this)
DockPanel.Perfo rmLayout();
}
}

private string m_tabText = null;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="TabText"]/*'/>
[Localizable(tru e)]
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.TabText.Des cription")]
[DefaultValue(nu ll)]
public string TabText
{
get { return DesignMode ? m_tabText : (m_tabText==nul l ? this.Text :
m_tabText); }
set
{
if (m_tabText == value)
return;

m_tabText = value;
if (Pane != null)
Pane.RefreshCha nges();
}
}
private bool ShouldSerialize TabText()
{
return (m_tabText != null);
}

private bool m_closeButton = true;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="CloseBut ton"]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.CloseButton .Description")]
[DefaultValue(tr ue)]
public bool CloseButton
{
get { return m_closeButton; }
set
{
if (m_closeButton == value)
return;

m_closeButton = value;
if (Pane != null)
if (Pane.ActiveCon tent == this)
Pane.RefreshCha nges();
}
}

private DockPanel m_dockPanel = null;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="DockPane l"]/*'/>
[Browsable(false )]
public DockPanel DockPanel
{
get { return m_dockPanel; }
set
{
if (m_dockPanel == value)
return;

Pane = null;

if (m_dockPanel != null)
m_dockPanel.Rem oveContent(this );

if (m_dockPaneTab != null)
{
m_dockPaneTab.D ispose();
m_dockPaneTab = null;
}

if (m_autoHideTab != null)
{
m_autoHideTab.D ispose();
m_autoHideTab = null;
}

m_dockPanel = value;

if (m_dockPanel != null)
{

// ********** Changed By Pieter :
http://sourceforge.net/forum/message.php?msg_id=3180571 **********
//Size = Size.Empty; // To reduce the screen flicker
// ********** End Changed By Pieter

m_dockPanel.Add Content(this);
TopLevel = false;
FormBorderStyle = FormBorderStyle .None;
ShowInTaskbar = false;
Visible = true;
m_dockPaneTab = DockPanel.DockP aneTabFactory.C reateDockPaneTa b(this);
m_autoHideTab = DockPanel.AutoH ideTabFactory.C reateAutoHideTa b(this);
}

RefreshMdiInteg ration();
}
}

private DockState DefaultShowStat e
{
get
{
if (ShowHint != DockState.Unkno wn)
return ShowHint;

if ((DockableAreas & DockAreas.Docum ent) != 0)
return DockState.Docum ent;
if ((DockableAreas & DockAreas.DockR ight) != 0)
return DockState.DockR ight;
if ((DockableAreas & DockAreas.DockL eft) != 0)
return DockState.DockL eft;
if ((DockableAreas & DockAreas.DockB ottom) != 0)
return DockState.DockB ottom;
if ((DockableAreas & DockAreas.DockT op) != 0)
return DockState.DockT op;
if ((DockableAreas & DockAreas.Float ) != 0)
return DockState.Float ;

return DockState.Unkno wn;
}
}

private DockState DefaultDockStat e
{
get
{
if (ShowHint != DockState.Unkno wn && ShowHint != DockState.Hidde n &&
ShowHint != DockState.Float )
return ShowHint;

if ((DockableAreas & DockAreas.Docum ent) != 0)
return DockState.Docum ent;
if ((DockableAreas & DockAreas.DockR ight) != 0)
return DockState.DockR ight;
if ((DockableAreas & DockAreas.DockL eft) != 0)
return DockState.DockL eft;
if ((DockableAreas & DockAreas.DockB ottom) != 0)
return DockState.DockB ottom;
if ((DockableAreas & DockAreas.DockT op) != 0)
return DockState.DockT op;

return DockState.Unkno wn;
}
}

private DockState m_dockState = DockState.Unkno wn;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="DockStat e"]/*'/>
[Browsable(false )]
public DockState DockState
{
get { return m_dockState; }
set
{
if (m_dockState == value)
return;

if (value == DockState.Hidde n)
IsHidden = true;
else
SetDockState(fa lse, value, Pane);
}
}

/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="Pane"]/*'/>
public DockPane Pane
{
get { return IsFloat ? FloatPane : PanelPane; }
set
{
if (Pane == value)
return;

DockPane oldPane = Pane;

SuspendSetDockS tate();
FloatPane = (value == null ? null : (value.IsFloat ? value :
FloatPane));
PanelPane = (value == null ? null : (value.IsFloat ? PanelPane :
value));
ResumeSetDockSt ate(IsHidden, value != null ? value.DockState :
DockState.Unkno wn, oldPane);
}
}

private bool m_isHidden = false;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="IsHidden "]/*'/>
[Browsable(false )]
public bool IsHidden
{
get { return m_isHidden; }
set
{
if (m_isHidden == value)
return;

SetDockState(va lue, VisibleState, Pane);
}
}

private DockState m_visibleState = DockState.Unkno wn;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="VisibleS tate"]/*'/>
[Browsable(false )]
public DockState VisibleState
{
get { return m_visibleState; }
set
{
if (m_visibleState == value)
return;

SetDockState(Is Hidden, value, Pane);
}
}

private bool m_isFloat = false;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="IsFloat"]/*'/>
[Browsable(false )]
public bool IsFloat
{
get { return m_isFloat; }
set
{
DockState visibleState;

if (m_isFloat == value)
return;

DockPane oldPane = Pane;

if (value)
{
if (!IsDockStateVa lid(DockState.F loat))
throw new
InvalidOperatio nException(Reso urceHelper.GetS tring("DockCont ent.IsFloat.Inv alidValue"));
visibleState = DockState.Float ;
}
else
visibleState = (PanelPane != null) ? PanelPane.DockS tate :
DefaultDockStat e;

if (visibleState == DockState.Unkno wn)
throw new
InvalidOperatio nException(Reso urceHelper.GetS tring("DockCont ent.IsFloat.Inv alidValue"));

SetDockState(Is Hidden, visibleState, oldPane);
}
}

private DockPane m_panelPane = null;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="PanelPan e"]/*'/>
[Browsable(false )]
public DockPane PanelPane
{
get { return m_panelPane; }
set
{
if (m_panelPane == value)
return;

if (value != null)
{
if (value.IsFloat || value.DockPanel != DockPanel)
throw new
InvalidOperatio nException(Reso urceHelper.GetS tring("DockCont ent.DockPane.In validValue"));
}

DockPane oldPane = Pane;

if (m_panelPane != null)
m_panelPane.Rem oveContent(this );

m_panelPane = value;
if (m_panelPane != null)
{
m_panelPane.Add Content(this);
SetDockState(Is Hidden, IsFloat ? DockState.Float :
m_panelPane.Doc kState, oldPane);
}
else
SetDockState(Is Hidden, DockState.Unkno wn, oldPane);
}
}

private DockPane m_floatPane = null;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="FloatPan e"]/*'/>
[Browsable(false )]
public DockPane FloatPane
{
get { return m_floatPane; }
set
{
if (m_floatPane == value)
return;

if (value != null)
{
if (!value.IsFloat || value.DockPanel != DockPanel)
throw new
InvalidOperatio nException(Reso urceHelper.GetS tring("DockCont ent.FloatPane.I nvalidValue"));
}

DockPane oldPane = Pane;

if (m_floatPane != null)
m_floatPane.Rem oveContent(this );

m_floatPane = value;
if (m_floatPane != null)
{
m_floatPane.Add Content(this);
SetDockState(Is Hidden, IsFloat ? DockState.Float : VisibleState,
oldPane);
}
else
SetDockState(Is Hidden, DockState.Unkno wn, oldPane);
}
}

private int m_countSetDockS tate = 0;
private void SuspendSetDockS tate()
{
m_countSetDockS tate ++;
}

private void ResumeSetDockSt ate()
{
m_countSetDockS tate --;
if (m_countSetDock State < 0)
m_countSetDockS tate = 0;
}

private void ResumeSetDockSt ate(bool isHidden, DockState visibleState,
DockPane oldPane)
{
ResumeSetDockSt ate();
SetDockState(is Hidden, visibleState, oldPane);
}

internal void SetDockState(bo ol isHidden, DockState visibleState, DockPane
oldPane)
{
if (m_countSetDock State != 0)
return;

if (DockPanel == null && visibleState != DockState.Unkno wn)
throw new
InvalidOperatio nException(Reso urceHelper.GetS tring("DockCont ent.SetDockStat e.NullPanel"));

if (visibleState == DockState.Hidde n || (visibleState !=
DockState.Unkno wn && !IsDockStateVal id(visibleState )))
throw new
InvalidOperatio nException(Reso urceHelper.GetS tring("DockCont ent.SetDockStat e.InvalidState" ));

SuspendSetDockS tate();

DockState oldDockState = DockState;

if (m_isHidden != isHidden)
{
m_isHidden = isHidden;
Visible = !isHidden;
if (HiddenMdiChild != null)
HiddenMdiChild. Visible = (!IsHidden);
}
m_visibleState = visibleState;
m_dockState = isHidden ? DockState.Hidde n : visibleState;

if (visibleState != DockState.Unkno wn)
{
m_isFloat = (m_visibleState == DockState.Float );

if (Pane == null)
Pane = DockPanel.DockP aneFactory.Crea teDockPane(this , visibleState,
true);
else if (Pane.DockState != visibleState)
{
if (Pane.Contents. Count == 1)
Pane.SetDockSta te(visibleState );
else
Pane = DockPanel.DockP aneFactory.Crea teDockPane(this , visibleState,
true);
}
}
else
Pane = null;

SetParent(Pane) ;

if (oldPane != null && !oldPane.IsDisp osed && oldDockState ==
oldPane.DockSta te)
RefreshDockPane (oldPane);

if (Pane != null && DockState == Pane.DockState)
{
if ((Pane != oldPane) ||
(Pane == oldPane && oldDockState != oldPane.DockSta te))
RefreshDockPane (Pane);
}

if (oldDockState != DockState)
{
RefreshMdiInteg ration();
OnDockStateChan ged(EventArgs.E mpty);
}
ResumeSetDockSt ate();
}

private void RefreshDockPane (DockPane pane)
{
pane.RefreshCha nges();
pane.ValidateAc tiveContent();
}

internal string PersistString
{
get { return GetPersistStrin g(); }
}
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="GetPersi stString()"]/*'/>
protected virtual string GetPersistStrin g()
{
return GetType().ToStr ing();
}

private HiddenMdiChild m_hiddenMdiChil d = null;
internal HiddenMdiChild HiddenMdiChild
{
get { return m_hiddenMdiChil d; }
}

private bool m_hideOnClose = false;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="HideOnCl ose"]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.HideOnClose .Description")]
[DefaultValue(fa lse)]
public bool HideOnClose
{
get { return m_hideOnClose; }
set { m_hideOnClose = value; }
}

/// <exclude/>
public new MainMenu Menu
{
get { return HiddenMdiChild == null ? base.Menu : HiddenMdiChild. Menu; }
set
{
if (HiddenMdiChild == null)
base.Menu = value;
else
HiddenMdiChild. Menu = value;
}
}

private DockState m_showHint = DockState.Unkno wn;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="ShowHint "]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.ShowHint.De scription")]
[DefaultValue(Do ckState.Unknown )]
public DockState ShowHint
{
get { return m_showHint; }
set
{
if (!DockHelper.Is DockStateValid( value, DockableAreas))
throw (new
InvalidOperatio nException(Reso urceHelper.GetS tring("DockCont ent.ShowHint.In validValue")));

if (m_showHint == value)
return;

m_showHint = value;
}
}

private bool m_isActivated = false;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="IsActiva ted"]/*'/>
[Browsable(false )]
public bool IsActivated
{
get { return m_isActivated; }
}
internal void SetIsActivated( bool value)
{
if (m_isActivated == value)
return;

m_isActivated = value;
}

/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="IsDockSt ateValid(DockSt ate)"]/*'/>
public bool IsDockStateVali d(DockState dockState)
{
return DockHelper.IsDo ckStateValid(do ckState, DockableAreas);
}

private ContextMenu m_tabPageContex tMenu = null;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="TabPageC ontextMenu"]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.TabPageCont extMenu.Descrip tion")]
[DefaultValue(nu ll)]
public ContextMenu TabPageContextM enu
{
get { return m_tabPageContex tMenu; }
set { m_tabPageContex tMenu = value; }
}

private string m_toolTipText = null;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="ToolTipT ext"]/*'/>
[Localizable(tru e)]
[Category("Appea rance")]
[LocalizedDescri ption("DockCont ent.ToolTipText .Description")]
[DefaultValue(nu ll)]
public string ToolTipText
{
get { return m_toolTipText; }
set { m_toolTipText = value; }
}

/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="Activate ()"]/*'/>
public new void Activate()
{
if (DockPanel == null)
base.Activate() ;
else if (Pane == null)
Show(DockPanel) ;
else
{
IsHidden = false;
Pane.ActiveCont ent = this;
Pane.Activate() ;
}
}

/// <exclude/>
public new void Hide()
{
IsHidden = true;
}

internal void SetParent(Contr ol value)
{
if (Parent == value)
return;

Control oldParent = Parent;

//!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!
// Workaround for .Net Framework bug: removing control from Form may
cause form
// unclosable. Set focus to another dummy control.
//!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!
Form form = null;
if (Parent is DockPane)
form = ((DockPane)Pare nt).FindForm();
if (ContainsFocus)
{
if (form is FloatWindow)
{
((FloatWindow)f orm).DummyContr ol.Focus();
form.ActiveCont rol = ((FloatWindow)f orm).DummyContr ol;
}
else if (DockPanel != null)
{
DockPanel.Dummy Control.Focus() ;
if (form != null)
form.ActiveCont rol = DockPanel.Dummy Control;
}
}
//!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!

// ********** Changed By Pieter :
http://sourceforge.net/forum/message.php?msg_id=3180571 **********
//Size = Size.Empty; // To reduce the screen flicker
// ********** End Changed By Pieter

Parent = value;
}

/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="Show"]/*'/>
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="Show()"]/*'/>
public new void Show()
{
if (DockPanel == null)
base.Show();
else
Show(DockPanel) ;
}

/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="Show(Doc kPanel)"]/*'/>
public void Show(DockPanel dockPanel)
{
if (dockPanel == null)
throw(new
ArgumentNullExc eption(Resource Helper.GetStrin g("DockContent. Show.NullDockPa nel")));

if (DockState == DockState.Unkno wn)
Show(dockPanel, DefaultShowStat e);
else
Activate();
}

/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="Show(Doc kPanel,
DockState)"]/*'/>
public void Show(DockPanel dockPanel, DockState dockState)
{
if (dockPanel == null)
throw(new
ArgumentNullExc eption(Resource Helper.GetStrin g("DockContent. Show.NullDockPa nel")));

if (dockState == DockState.Unkno wn || dockState == DockState.Hidde n)
throw(new
ArgumentExcepti on(ResourceHelp er.GetString("D ockContent.Show .InvalidDockSta te")));

DockPanel = dockPanel;

if (dockState == DockState.Float && FloatPane == null)
Pane = DockPanel.DockP aneFactory.Crea teDockPane(this , DockState.Float ,
true);
else if (PanelPane == null)
{
DockPane paneExisting = null;
foreach (DockPane pane in DockPanel.Panes )
if (pane.DockState == dockState)
{
paneExisting = pane;
break;
}

if (paneExisting == null)
Pane = DockPanel.DockP aneFactory.Crea teDockPane(this , dockState, true);
else
Pane = paneExisting;
}

DockState = dockState;
Activate();
}

/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="Show(Doc kPanel,
Rectangle)"]/*'/>
public void Show(DockPanel dockPanel, Rectangle floatWindowBoun ds)
{
if (dockPanel == null)
throw(new
ArgumentNullExc eption(Resource Helper.GetStrin g("DockContent. Show.NullDockPa nel")));

DockPanel = dockPanel;
if (FloatPane == null)
{
IsHidden = true; // to reduce the screen flicker
FloatPane = DockPanel.DockP aneFactory.Crea teDockPane(this ,
DockState.Float , false);
FloatPane.Float Window.StartPos ition = FormStartPositi on.Manual;
}

FloatPane.Float Window.Bounds = floatWindowBoun ds;

Show(dockPanel, DockState.Float );
Activate();
}

/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="Show(Doc kPane,
DockContent)"]/*'/>
public void Show(DockPane pane, DockContent beforeContent)
{
if (pane == null)
throw(new
ArgumentNullExc eption(Resource Helper.GetStrin g("DockContent. Show.NullPane") ));

if (beforeContent != null && pane.Contents.I ndexOf(beforeCo ntent) == -1)
throw(new
ArgumentExcepti on(ResourceHelp er.GetString("D ockContent.Show .InvalidBeforeC ontent")));

DockPanel = pane.DockPanel;
Pane = pane;
pane.SetContent Index(this, pane.Contents.I ndexOf(beforeCo ntent));
Show();
}

/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="Show(Doc kPane,
DockAlignment, double)"]/*'/>
public void Show(DockPane prevPane, DockAlignment alignment, double
proportion)
{
if (prevPane == null)
throw(new
ArgumentExcepti on(ResourceHelp er.GetString("D ockContent.Show .InvalidPrevPan e")));

if (DockHelper.IsD ockStateAutoHid e(prevPane.Dock State))
throw(new
ArgumentExcepti on(ResourceHelp er.GetString("D ockContent.Show .InvalidPrevPan e")));

DockPanel = prevPane.DockPa nel;
DockPanel.DockP aneFactory.Crea teDockPane(this , prevPane, alignment,
proportion, true);
Show();
}

/// <exclude/>
protected override void OnClosed(EventA rgs e)
{
//!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!!
// Workaround of .Net Framework bug to avoid main form unclosable
//!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!!

// ********** Changed By Pieter :
http://sourceforge.net/forum/forum.p...orum_id=402316
**********
//if (Environment.Ve rsion.Major == 1)
if (Environment.Ve rsion.Major >= 1)
// ********** End Changed By Pieter

{
if (DockPanel != null)
DockPanel = null;
}

base.OnClosed (e);
}

/// <exclude/>
protected override void OnTextChanged(E ventArgs e)
{
if (m_hiddenMdiChi ld != null)
m_hiddenMdiChil d.Text = this.Text;
if (DockHelper.IsD ockStateAutoHid e(DockState))
DockPanel.Refre shAutoHideStrip ();
else if (Pane != null)
{
if (Pane.FloatWind ow != null)
Pane.FloatWindo w.SetText();
Pane.RefreshCha nges();
}

base.OnTextChan ged(e);
}

internal void RefreshMdiInteg ration()
{
Form mdiParent = GetMdiParentFor m();

if (mdiParent == null)
{
if (HiddenMdiChild != null)
{
m_hiddenMdiChil d.Close();
m_hiddenMdiChil d = null;
}
}
else
{
if (HiddenMdiChild == null)
m_hiddenMdiChil d = new HiddenMdiChild( this);

m_hiddenMdiChil d.SetMdiParent( mdiParent);
}

if (DockPanel != null)
if (DockPanel.Acti veDocument != null)
if (DockPanel.Acti veDocument.Hidd enMdiChild != null)
DockPanel.Activ eDocument.Hidde nMdiChild.Activ ate();
}
private Form GetMdiParentFor m()
{
if (DockPanel == null)
return null;

if (!DockPanel.Mdi Integration)
return null;

if (DockState != DockState.Docum ent)
return null;

Form parentMdi = DockPanel.FindF orm();
if (parentMdi != null)
if (!parentMdi.IsM diContainer)
parentMdi = null;

return parentMdi;
}

private DockPaneTab m_dockPaneTab = null;
internal DockPaneTab DockPaneTab
{
get { return m_dockPaneTab; }
}

private AutoHideTab m_autoHideTab = null;
internal AutoHideTab AutoHideTab
{
get { return m_autoHideTab; }
}

#region Events
private static readonly object DockStateChange dEvent = new object();
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Event[@name="DockStat eChanged"]/*'/>
[LocalizedCatego ry("Category.Pr opertyChanged")]
[LocalizedDescri ption("Pane.Doc kStateChanged.D escription")]
public event EventHandler DockStateChange d
{
add { Events.AddHandl er(DockStateCha ngedEvent, value); }
remove { Events.RemoveHa ndler(DockState ChangedEvent, value); }
}
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Method[@name="OnDockSt ateChanged(Even tArgs)"]/*'/>
protected virtual void OnDockStateChan ged(EventArgs e)
{
EventHandler handler = (EventHandler)E vents[DockStateChange dEvent];
if (handler != null)
handler(this, e);
}
#endregion
}
}
Nov 17 '05 #1
1 3907
Unfortunately, I do not have time to check all of the code. In general, the
most common CLS errors are either naming (current and Current are two
different names in CE#, not in VB.NET, so it is not CLS compliant) and typing
(using language specific data types).

You can set the CLS Compliant Attribute and compile the code in C#. That
will give you a great idea of what bombs:
http://msdn.microsoft.com/library/en...pliantcode.asp

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************
"Pieter" wrote:
Hi,

I have this Warning for several forms when using the DockPanel Suite of
Weifen Luo in VS.NET 2005. I read a lot about this CLS-compliant stuff, but
I don't now how to chech actually which part of the class is not
CSL-compliant? Any body knows what to look for? I just want to get rid of
these warnings :-)

Thanks a lot in advance,

Pieter


PS: The whole non CLS-compliant class, in case it can be usefull:

//
*************** *************** *************** *************** *************** **
//
// Copyright 2004, Weifen Luo
// All rights reserved. The software and associated documentation
// supplied hereunder are the proprietary information of Weifen Luo
// and are supplied subject to licence terms.
//
// WinFormsUI Library Version 1.0
//
*************** *************** *************** *************** *************** **

using System;
using System.Componen tModel;
using System.Drawing;
using System.Windows. Forms;
using System.Runtime. InteropServices ;

namespace WeifenLuo.WinFo rmsUI
{
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/ClassDef/*'/>
public class DockContent : Form
{
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Constructor[@name="()"]/*'/>
public DockContent()
{
RefreshMdiInteg ration();
}

/// <exclude/>
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (m_hiddenMdiChi ld != null)
{
m_hiddenMdiChil d.Close();
m_hiddenMdiChil d = null;
}

DockPanel = null;
if (AutoHideTab != null)
AutoHideTab.Dis pose();
if (DockPaneTab != null)
DockPaneTab.Dis pose();
}

base.Dispose(di sposing);
}

private bool m_allowRedockin g = true;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="AllowRed ocking"]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.AllowRedock ing.Description ")]
[DefaultValue(tr ue)]
public bool AllowRedocking
{
get { return m_allowRedockin g; }
set { m_allowRedockin g = value; }
}

private DockAreas m_allowedAreas = DockAreas.DockL eft |
DockAreas.DockR ight | DockAreas.DockT op | DockAreas.DockB ottom |
DockAreas.Docum ent | DockAreas.Float ;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="Dockable Areas"]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.DockableAre as.Description" )]
[DefaultValue(Do ckAreas.DockLef t|DockAreas.Doc kRight|DockArea s.DockTop|DockA reas.DockBottom |DockAreas.Docu ment|DockAreas. Float)]
public DockAreas DockableAreas
{
get { return m_allowedAreas; }
set
{
if (m_allowedAreas == value)
return;

if (!DockHelper.Is DockStateValid( DockState, value))
throw(new
InvalidOperatio nException(Reso urceHelper.GetS tring("DockCont ent.DockableAre as.InvalidValue ")));

m_allowedAreas = value;

if (!DockHelper.Is DockStateValid( ShowHint, m_allowedAreas) )
ShowHint = DockState.Unkno wn;
}
}

private double m_autoHidePorti on = 0.25;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="AutoHide Portion"]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.AutoHidePor tion.Descriptio n")]
[DefaultValue(0. 25)]
public double AutoHidePortion
{
get { return m_autoHidePorti on; }
set
{
if (value <= 0 || value > 1)
throw(new
ArgumentOutOfRa ngeException(Re sourceHelper.Ge tString("DockCo ntent.AutoHideP ortion.OutOfRan ge")));

if (m_autoHidePort ion == value)
return;

m_autoHidePorti on = value;

if (DockPanel == null)
return;

if (DockPanel.Acti veAutoHideConte nt == this)
DockPanel.Perfo rmLayout();
}
}

private string m_tabText = null;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="TabText"]/*'/>
[Localizable(tru e)]
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.TabText.Des cription")]
[DefaultValue(nu ll)]
public string TabText
{
get { return DesignMode ? m_tabText : (m_tabText==nul l ? this.Text :
m_tabText); }
set
{
if (m_tabText == value)
return;

m_tabText = value;
if (Pane != null)
Pane.RefreshCha nges();
}
}
private bool ShouldSerialize TabText()
{
return (m_tabText != null);
}

private bool m_closeButton = true;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="CloseBut ton"]/*'/>
[LocalizedCatego ry("Category.Do cking")]
[LocalizedDescri ption("DockCont ent.CloseButton .Description")]
[DefaultValue(tr ue)]
public bool CloseButton
{
get { return m_closeButton; }
set
{
if (m_closeButton == value)
return;

m_closeButton = value;
if (Pane != null)
if (Pane.ActiveCon tent == this)
Pane.RefreshCha nges();
}
}

private DockPanel m_dockPanel = null;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="DockPane l"]/*'/>
[Browsable(false )]
public DockPanel DockPanel
{
get { return m_dockPanel; }
set
{
if (m_dockPanel == value)
return;

Pane = null;

if (m_dockPanel != null)
m_dockPanel.Rem oveContent(this );

if (m_dockPaneTab != null)
{
m_dockPaneTab.D ispose();
m_dockPaneTab = null;
}

if (m_autoHideTab != null)
{
m_autoHideTab.D ispose();
m_autoHideTab = null;
}

m_dockPanel = value;

if (m_dockPanel != null)
{

// ********** Changed By Pieter :
http://sourceforge.net/forum/message.php?msg_id=3180571 **********
//Size = Size.Empty; // To reduce the screen flicker
// ********** End Changed By Pieter

m_dockPanel.Add Content(this);
TopLevel = false;
FormBorderStyle = FormBorderStyle .None;
ShowInTaskbar = false;
Visible = true;
m_dockPaneTab = DockPanel.DockP aneTabFactory.C reateDockPaneTa b(this);
m_autoHideTab = DockPanel.AutoH ideTabFactory.C reateAutoHideTa b(this);
}

RefreshMdiInteg ration();
}
}

private DockState DefaultShowStat e
{
get
{
if (ShowHint != DockState.Unkno wn)
return ShowHint;

if ((DockableAreas & DockAreas.Docum ent) != 0)
return DockState.Docum ent;
if ((DockableAreas & DockAreas.DockR ight) != 0)
return DockState.DockR ight;
if ((DockableAreas & DockAreas.DockL eft) != 0)
return DockState.DockL eft;
if ((DockableAreas & DockAreas.DockB ottom) != 0)
return DockState.DockB ottom;
if ((DockableAreas & DockAreas.DockT op) != 0)
return DockState.DockT op;
if ((DockableAreas & DockAreas.Float ) != 0)
return DockState.Float ;

return DockState.Unkno wn;
}
}

private DockState DefaultDockStat e
{
get
{
if (ShowHint != DockState.Unkno wn && ShowHint != DockState.Hidde n &&
ShowHint != DockState.Float )
return ShowHint;

if ((DockableAreas & DockAreas.Docum ent) != 0)
return DockState.Docum ent;
if ((DockableAreas & DockAreas.DockR ight) != 0)
return DockState.DockR ight;
if ((DockableAreas & DockAreas.DockL eft) != 0)
return DockState.DockL eft;
if ((DockableAreas & DockAreas.DockB ottom) != 0)
return DockState.DockB ottom;
if ((DockableAreas & DockAreas.DockT op) != 0)
return DockState.DockT op;

return DockState.Unkno wn;
}
}

private DockState m_dockState = DockState.Unkno wn;
/// <include file='CodeDoc\D ockContent.xml'
path='//CodeDoc/Class[@name="DockCont ent"]/Property[@name="DockStat e"]/*'/>
[Browsable(false )]
public DockState DockState
{
get { return m_dockState; }
set
{
if (m_dockState == value)
return;

if (value == DockState.Hidde n)
IsHidden = true;

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
387
by: Edward Diener | last post by:
Is the default 'false' for the CLSCompliant attribute at the assembly level ? Are there any tools to check for CLS compliance for the various NET languages ?
1
271
by: Cindy Liu | last post by:
Hi, I want to use CodeDome to create a class that derives from MarshalByRefObject. Currently the only thing I can do is: oClass=new CodeTypeDeclaration("MyClass"); oClass.IsClass = true; oClass.Attributes = MemberAttributes.Public; How to let my class derive from
2
13532
by: Brett Romero | last post by:
I'd like to mark an entire assembly as CLS compliant. The examples I have seen say to put this reference just outside of any class under "using System;". Can this go into any file outside of class declarations? References: http://www.devarticles.com/c/a/C-Sharp/Making-Your-Code-CLS-Compliant/
2
2120
by: Joe | last post by:
I want to bind to the property Caption but can't. I get the exception: "Cannot bind to property or column Caption on DataSource. Parameter name: dataMember" public class Test : CollectionBase { private string caption; public string Caption {
8
2370
by: bonk | last post by:
When I have an instance of an object wich is of type System.Type, how can I find out if it directly or indirecly derives from another type? myTypeInstance == typeof(AnotherType) only seems to check if they are ultimately the same type (at the very bottom of the inheritance hirarchy) but in case myTypeInstance is...
0
1605
by: ntabb | last post by:
I'm attempting to use DockPanel Suite with an application I'm building. Is there a way to use the designer to create content for the DockContent panes? I attempted to cast a form onto DockContent - no go. Any ideas? Thanks!
2
7280
by: jesus4gaveme03 | last post by:
I ceated a automatic split form from a table called "Master NSN List." I then added 2 buttons "cmdShowHide" which toggles between showing and hiding the form section giving more room for the datasheet and "cmdFixNSN" which takes a portion of the NSN and puts it in another field then removes all of the dashes. The form loads fine until i add...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.