private void createAndSetButtonStyle(FunctionZontButtonInfo button, int posX, int posY) { GlassButton glassButton = new GlassButton(); glassButton.Location = new Point(posX, posY); glassButton.BackColor = Color.CornflowerBlue; glassButton.ShineColor = Color.CornflowerBlue; glassButton.GlowColor = Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); glassButton.Height = m_functionZontBaseInfo.buttonHeigth; glassButton.Width = m_functionZontBaseInfo.buttonWidth; glassButton.Text = button.text; glassButton.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); glassButton.TextAlign = ContentAlignment.MiddleRight; glassButton.Cursor = Cursors.Hand; glassButton.FadeOnFocus = true; glassButton.InnerBorderColor = Color.Transparent; glassButton.Name = button.name; glassButton.OuterBorderColor = Color.Transparent; glassButton.TabIndex = Convert.ToInt32(button.sequence); glassButton.Image = Image.FromFile(m_exeFileRelativePath + button.image); glassButton.ImageAlign = ContentAlignment.MiddleLeft; glassButton.Click += new System.EventHandler(this.ButtonFrom_Click); this.Controls.Add(glassButton); this.ResumeLayout(false); m_buttonList.Add(button.name, glassButton); }
private void readConfigFile() { XmlDocument XMLDoc = new XmlDocument(); m_exeFileFullPath = Application.ExecutablePath; m_exeFileRelativePath = m_exeFileFullPath.Substring(0, m_exeFileFullPath.LastIndexOf("\\") + 1); string fileFullPath = m_exeFileRelativePath + CONFIG_FILE_NAME; try { XMLDoc.Load(fileFullPath); XmlNodeList notes = XMLDoc.DocumentElement.ChildNodes; XmlElement baseInfo = (XmlElement)notes[0]; XmlElement functonZoneInfo = (XmlElement)notes[1]; XmlNodeList functionZoneButtons = (XmlNodeList)notes[1].ChildNodes; m_functionZontBaseInfo.backgroundImage = baseInfo.GetAttribute("backgroundImage"); m_functionZontBaseInfo.buttonWidth = Convert.ToInt32(baseInfo.GetAttribute("buttonWidth").ToString()); m_functionZontBaseInfo.buttonHeigth = Convert.ToInt32(baseInfo.GetAttribute("buttonHeigth").ToString()); m_functionZontBaseInfo.buttonStartPosX = Convert.ToInt32(baseInfo.GetAttribute("buttonStartPosX").ToString()); m_functionZontBaseInfo.buttonStartPosY = Convert.ToInt32(baseInfo.GetAttribute("buttonStartPosY").ToString()); m_functionZontBaseInfo.buttonInterval = Convert.ToInt32(baseInfo.GetAttribute("buttonInterval").ToString()); for (int i = 0; i < functionZoneButtons.Count; i++) { XmlElement button = (XmlElement)functionZoneButtons[i]; FunctionZontButtonInfo buttonInfo = new FunctionZontButtonInfo(); buttonInfo.name = button.GetAttribute("name"); buttonInfo.text = button.GetAttribute("text"); buttonInfo.sequence = button.GetAttribute("sequence"); buttonInfo.image = button.GetAttribute("image"); buttonInfo.mouseClick = button.GetAttribute("mouseClick"); buttonInfo.panelPageName = button.GetAttribute("panelPageName"); buttonInfo.reportPanelPageName = button.GetAttribute("reportPanelPageName"); buttonInfo.isVisable = isEnable(buttonInfo.text); m_functionZoneButtonList.Add(buttonInfo.name, buttonInfo); } } catch (Exception) { // .. error log } }