<xs:enumeration value="CtrlShiftI"/>
<xs:enumeration value="CtrlShiftJ"/>
<xs:enumeration value="CtrlShiftK"/>
<xs:enumeration value="CtrlShiftL"/>
<xs:enumeration value="CtrlShiftM"/>
<xs:enumeration value="CtrlShiftN"/>
<xs:enumeration value="CtrlShiftO"/>
<xs:enumeration value="CtrlShiftP"/>
<xs:enumeration value="CtrlShiftQ"/>
<xs:enumeration value="CtrlShiftR"/>
<xs:enumeration value="CtrlShiftS"/>
<xs:enumeration value="CtrlShiftT"/>
<xs:enumeration value="CtrlShiftU"/>
<xs:enumeration value="CtrlShiftV"/>
<xs:enumeration value="CtrlShiftW"/>
<xs:enumeration value="CtrlShiftX"/>
<xs:enumeration value="CtrlShiftY"/>
<xs:enumeration value="CtrlShiftZ"/>
<xs:enumeration value="ShiftIns"/>
<xs:enumeration value="ShiftF1"/>
<xs:enumeration value="ShiftF2"/>
<xs:enumeration value="ShiftF3"/>
<xs:enumeration value="ShiftF4"/>
<xs:enumeration value="ShiftF5"/>
<xs:enumeration value="ShiftF6"/>
<xs:enumeration value="ShiftF7"/>
<xs:enumeration value="ShiftF8"/>
<xs:enumeration value="ShiftF9"/>
<xs:enumeration value="ShiftF10"/>
<xs:enumeration value="ShiftF11"/>
<xs:enumeration value="ShiftF12"/>
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
3。定义一个类来加载菜单
public class MenuLoad
{
private PluginCollection m_plugins = null;
public MenuBar _menbar = new MenuBar();
public ToolStrip _toolbar = new ToolStrip();
private OutlookBar bar = new OutlookBar();
private ImageList imglist = new ImageList();
private StringBuilder builder = new StringBuilder();
public MenuLoad()
{
bar = _menbar.outlookBar;
}
private TabControl tabCtrl;
public TabControl TabCtrl
{
set
{
tabCtrl = value;
}
}
private void ValidationEventHandler(object sender, ValidationEventArgs e)
{
builder.AppendLine("验证XML文档的时候发生错误:");
builder.AppendLine("严重级别:" e.Severity);
builder.AppendLine("错误信息:" e.Message);
builder.AppendLine("------ -------- ------- ------ -------- ------- ------ -------- ------- ");
builder.AppendLine();
}
/**//// <summary>
/// 验证XML文件是否是合乎规范的文件
/// </summary>
/// <param name="xmlfile">文件名称</param>
/// <returns>是则返回true,否则返回false</returns>
private bool ValidateXml(string xmlfile)
{
bool validXml = false;
string spath = "";
spath = Application.StartupPath "\\configurations\\XMLSMenu.xsd";
if(!System.IO.File.Exists(spath))
{
throw new System.IO.FileNotFoundException(String.Format(Resources.StringFileNotFound, spath));
}
XmlReaderSettings settings = new XmlReaderSettings();
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add(null, spath);
settings.Schemas.Add(schemaSet);
settings.ValidationType = ValidationType.Schema;
settings.ValidationEventHandler = new ValidationEventHandler(ValidationEventHandler);
settings.ValidationFlags = settings.ValidationFlags | XmlSchemaValidationFlags.ReportValidationWarnings;
XmlReader reader = XmlReader.Create(xmlfile, settings);
while(reader.Read())
{
}
if(builder.Length > 0)
{
validXml = false;
}
else
{
validXml = true;
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!



