Exemple #1
0
 private void navBarControl1_CustomDrawLink(object sender, CustomDrawNavBarElementEventArgs e)
 {
     DevExpress.XtraNavBar.NavBarItemLink link = ((NavLinkInfoArgs)e.ObjectInfo).Link;
     if (link.State == DevExpress.Utils.Drawing.ObjectState.Selected ||
         link.State == DevExpress.Utils.Drawing.ObjectState.Hot ||
         link.State == DevExpress.Utils.Drawing.ObjectState.Pressed
         )
     {
         e.Graphics.FillRectangle(Brushes.DodgerBlue, e.RealBounds);
     }
 }
Exemple #2
0
        public bool AddGroupItemArea(string groupName, string itemName, EventHandler callBack, ref string reStr)
        {
            try
            {
                bool isContain = false;
                DevExpress.XtraNavBar.NavBarGroup currGroup = null;
                isContain = IsContainGroup(nbc_MainMenu, groupName, ref currGroup);
                if (isContain == false)
                {
                    reStr = groupName + "不存在!";
                    return(false);
                }

                DevExpress.XtraNavBar.NavBarItem baritem = new DevExpress.XtraNavBar.NavBarItem();
                baritem.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(callBack);
                DevExpress.XtraNavBar.NavBarItemLink itemLink = new DevExpress.XtraNavBar.NavBarItemLink(baritem);
                itemLink.Item.Caption = itemName;
                itemLink.Item.Name    = itemName;
                foreach (DevExpress.XtraNavBar.NavBarItemLink link in currGroup.ItemLinks)
                {
                    if (link.Item.Name == itemName)
                    {
                        reStr = "已存在此item!";
                        return(false);
                    }
                }
                currGroup.ItemLinks.Add(itemLink);
                this.nbc_MainMenu.Groups.Add(currGroup);
                reStr = "添加成功!";
                return(true);
            }
            catch (System.Exception ex)
            {
                reStr = ex.Message;
                return(false);
            }
        }
Exemple #3
0
        private void initData(string ConfigXMLStr)
        {
            WinLaw.checkLaw(this);

            this.addButton.Image = FWImageDic.ADD_IMAGE20;
            this.editButton.Image = FWImageDic.EDIT_IMAGE20;
            this.removeButton.Image = FWImageDic.DELETE_IMAGE20;
            this.closeButton.Image = FWImageDic.CLOSE_IMAGE20;
            this.btnSave.Image = FWImageDic.SAVE_IMAGE20;
            this.btnNoSave.Image = FWImageDic.NO_SAVE_IMAGE20;

            String language = "vn";

            XPathNavigator nav = null;
            XPathDocument docNav = null;
            System.IO.StringReader sr = new System.IO.StringReader(ConfigXMLStr);
            docNav = new XPathDocument(sr);
            nav = docNav.CreateNavigator();

            XPathNodeIterator iterator = nav.Select("/basiccats/group");
            while (iterator.MoveNext())
            {
                XPathNavigator groupNode = iterator.Current;
                //Nav Group
                DevExpress.XtraNavBar.NavBarGroup group = new DevExpress.XtraNavBar.NavBarGroup();
                group.Expanded = true;
                XPathNodeIterator langCatNode = groupNode.SelectChildren("lang", groupNode.NamespaceURI);
                while (langCatNode.MoveNext())
                {
                    //<group id ='3' picindex='navChuXe.png'>
                    //    <lang id='vn'>Đối tác dịch vụ</lang>
                    //    <lang id='en'></lang>
                    //    <cat>...</cat>
                    //</group>
                    XPathNavigator tmp = langCatNode.Current;
                    if (tmp.GetAttribute("id", tmp.NamespaceURI).Equals(language))
                    {
                        group.Caption = langCatNode.Current.Value.Trim();
                        group.Name = langCatNode.Current.Value.Trim();
                        group.Tag = groupNode.GetAttribute("id", groupNode.NamespaceURI);
                    }
                }
                this.navBarControl1.Groups.Add(group);
                //Nav Item
                XPathNodeIterator catNode = groupNode.SelectChildren("cat", groupNode.NamespaceURI);
                while (catNode.MoveNext())
                {
                    //<cat table='" + ProtocolVN.DanhMuc.PL.FURL(N, "Init") + @"' type='action' picindex='navChuXe.png'>
                    //    <lang id='vn'>Đối tác</lang>
                    //    <lang id='en'></lang>
                    //</cat>

                    XPathNavigator tmp = catNode.Current;
                    DevExpress.XtraNavBar.NavBarItem navItem = new DevExpress.XtraNavBar.NavBarItem();
                    navItem.Name = tmp.GetAttribute("table", tmp.NamespaceURI);
                    navItem.Tag = tmp.GetAttribute("type", tmp.NamespaceURI);
                    //navItem.LargeImage = FWImageDic.getImage4848(tmp.GetAttribute("picindex", tmp.NamespaceURI));
                    navItem.SmallImage = HelpImage.getImage1616(tmp.GetAttribute("picindex", tmp.NamespaceURI));
                    //navItem.LargeImage = ResourceMan.getImage48(tmp.GetAttribute("picindex", tmp.NamespaceURI));
                    //navItem.SmallImage = ResourceMan.getImage32(tmp.GetAttribute("picindex", tmp.NamespaceURI));

                    XPathNodeIterator tmpSub = tmp.SelectChildren("lang", tmp.NamespaceURI);
                    while (tmpSub.MoveNext())
                    {
                        XPathNavigator tmp2 = tmpSub.Current;
                        if (tmp2.GetAttribute("id", tmp2.NamespaceURI).Equals(language))
                        {
                            navItem.Caption = tmpSub.Current.Value.Trim();
                        }
                    }
                    try
                    {
                        string param = "";
                        string formName = navItem.Name;

                        if (formName.Contains("?") && formName.Contains("="))
                        {
                            param = formName.Substring(formName.IndexOf('=') + 1).Trim();
                            formName = formName.Substring(0, formName.IndexOf('?')).Trim();
                        }
                        previousItem = currentItem;

                        XtraUserControl control = (XtraUserControl)GenerateClass.initMethod(formName, param, false);

                        if (control != null)
                        {
                            if (HelpPermission.CheckCtrl(control) == false)
                            {
                                navItem.Enabled = false;
                            }
                        }
                    }
                    catch { }
                    navItem.LinkClicked += new DevExpress.XtraNavBar.NavBarLinkEventHandler(this.navBarItem_LinkClicked);
                    DevExpress.XtraNavBar.NavBarItemLink navItemLink = new DevExpress.XtraNavBar.NavBarItemLink(navItem);
                    group.ItemLinks.Add(navItemLink);
                    this.navBarControl1.Items.Add(navItem);
                }
                //Gắn hình vào group

                string image = groupNode.GetAttribute("picindex", groupNode.NamespaceURI);
                if (image == String.Empty)
                {
                    if (group.ItemLinks.Count > 0)
                        group.SmallImage = group.ItemLinks[0].Item.SmallImage;
                }
                else
                {
                    group.SmallImage = HelpImage.getImage1616(image);
                }
            }

            if (navBarControl1.ActiveGroup.ItemLinks.Count > 0)
            {
                lblCat.Text = navBarControl1.ActiveGroup.ItemLinks[0].Item.Caption;
            }
            else
            {
                lblCat.Text = "Chưa xác định danh mục";
            }

            if (viewID == 2)//View Old
            {
                toView2();
            }
            else if (viewID == 1)// View Old
            {
                //NOOP
            }
        }
        private void Init()
        {
            string[] titles = ClipboardMan.Instance.GetTitiles();
            string[] entitys = ClipboardMan.Instance.GetEntitys();
            for (int i = 0; i < titles.Length; i++)
            {
                NavBarItem nav = new NavBarItem(titles[i]);
                nav.Name = entitys[i]; //Gán tên của Item là tên của đối tượng tương ứng
                nav.AppearanceHotTracked.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                nav.AppearanceHotTracked.Options.UseFont = true;
                nav.LinkClicked += new NavBarLinkEventHandler(Item_LinkClicked);
                nav.LargeImage = ResourceMan.getImage48(ClipboardMan.Instance.GetImange(entitys[i]));
                DevExpress.XtraNavBar.NavBarItemLink navItemLink = new DevExpress.XtraNavBar.NavBarItemLink(nav);
                groupClipboard.ItemLinks.Add(navItemLink);
                this.navBarControl1.Items.Add(nav);
            }

            //CHAUTV : Nếu có một clipboardItem có dữ liệu thì hiển thị lên
            bool TonTai = false;
            for (int j = 0; j < titles.Length; j++)
            {
                if (ClipboardMan.Instance.CheckDataSet(entitys[j]))
                {
                    dgc_details.DataSource = ClipboardMan.Instance.clipboard[entitys[j]].Data.Tables[0];
                    entitySelected = entitys[j];
                    ShowColumns(entitySelected);
                    TonTai = true;
                    break;
                }
            }
            if (TonTai == false&&ClipboardMan.Instance.clipboard.Count>0) //Neu khong co dư liệu nào thì hiện cấu trúc dataset của clipboardItem đầu tiên
            {
                dgc_details.DataSource = ClipboardMan.Instance.clipboard[entitys[0]].Data.Tables[0];
                ShowColumns(entitys[0]);
            }
            if (dgv_details.RowCount > 0)
            {
                this.addButton.Enabled = true;
                this.removeButton.Enabled = true;
            }
            else
            {
                this.addButton.Enabled = false;
                this.removeButton.Enabled = false;
            }
        }