Exemplo n.º 1
0
        private void FrmMain_Load(object sender, System.EventArgs e)
        {
            System.Collections.ArrayList rootList = authorityService.GetRootModule(Framework.Entity.Module.MENU);
            foreach (Framework.Entity.Module root in rootList)
            {
                DevComponents.DotNetBar.ButtonItem rootItem = new DevComponents.DotNetBar.ButtonItem();
                rootItem.Text = root.Title;
                BarMenu.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { rootItem });
                System.Collections.ArrayList       childList = authorityService.GetModuleByPid(root.Id, Framework.Entity.Module.MENU);
                DevComponents.DotNetBar.BaseItem[] baseItem  = new DevComponents.DotNetBar.BaseItem[childList.Count];
                int i = 0;
                foreach (Framework.Entity.Module child in childList)
                {
                    DevComponents.DotNetBar.ButtonItem btnItem = new DevComponents.DotNetBar.ButtonItem();
                    btnItem.Text   = child.Title;
                    btnItem.Tag    = child;
                    baseItem[i]    = btnItem;
                    btnItem.Click += new System.EventHandler(delegate(object o, System.EventArgs a)
                    {
                        DevComponents.DotNetBar.ButtonItem btn = (DevComponents.DotNetBar.ButtonItem)o;
                        Framework.Entity.Module mod            = (Framework.Entity.Module)btn.Tag;
                        CreateItem(mod.Title, mod.Class, null);
                    });
                    i++;
                }
                rootItem.SubItems.AddRange(baseItem);
            }
            CreateTheme("经典风格", DevComponents.DotNetBar.eStyle.Office2007VistaGlass);
            CreateTheme("淡蓝色风格", DevComponents.DotNetBar.eStyle.Office2007Blue);
            CreateTheme("银白色风格", DevComponents.DotNetBar.eStyle.Office2007Silver);
            CreateTheme("win7", DevComponents.DotNetBar.eStyle.Windows7Blue);

            ((DevComponents.DotNetBar.ButtonItem)BtnTheme.SubItems[0]).Checked = true;
        }
Exemplo n.º 2
0
        private void ColorSelected()
        {
            DevComponents.DotNetBar.PopupContainerControl ctrl = this.Parent as DevComponents.DotNetBar.PopupContainerControl;
            if (ctrl == null)
            {
                return;
            }

            // Change the Parent Item image to indicate which color was selected last
            // Assumes that Image with ImageIndex 21 is used on button
            DevComponents.DotNetBar.ButtonItem btn = ctrl.ParentItem as DevComponents.DotNetBar.ButtonItem;
            Bitmap   bmp = new Bitmap(btn.ImageList.Images[21], btn.ImageList.ImageSize);
            Graphics g   = Graphics.FromImage(bmp);

            g.DrawImageUnscaled(btn.ImageList.Images[21], 0, 0);
            using (SolidBrush brush = new SolidBrush(this.SelectedColor))
                g.FillRectangle(brush, 0, 12, 16, 4);
            g.Dispose();
            bmp.MakeTransparent(btn.ImageList.TransparentColor);
            btn.ImageIndex = -1;
            DevComponents.DotNetBar.DotNetBarManager manager = null;
            if (btn.ContainerControl is DevComponents.DotNetBar.Bar)
            {
                manager = ((DevComponents.DotNetBar.Bar)btn.ContainerControl).Owner as DevComponents.DotNetBar.DotNetBarManager;
            }
            else if (btn.ContainerControl is DevComponents.DotNetBar.MenuPanel)
            {
                manager = ((DevComponents.DotNetBar.MenuPanel)btn.ContainerControl).Owner as DevComponents.DotNetBar.DotNetBarManager;
            }
            if (manager != null && btn.Name != "")
            {
                ArrayList items = manager.GetItems(btn.Name, true);
                foreach (DevComponents.DotNetBar.ButtonItem item in items)
                {
                    item.Image = bmp;
                }
            }
            else
            {
                btn.Image = bmp;
            }

            DevComponents.DotNetBar.BaseItem topItem = ctrl.ParentItem;
            while (topItem.Parent is DevComponents.DotNetBar.ButtonItem)
            {
                topItem = topItem.Parent;
            }
            topItem.Expanded = false;
            if (topItem.Parent != null)
            {
                topItem.Parent.AutoExpand = false;
            }
        }
Exemplo n.º 3
0
        private void CreateAndInitializeButtons()
        {
            try
            {
                var addImage        = Properties.Resources.IE_UserAdd_24;
                var modifyImage     = Properties.Resources.IE_UserModify_24;
                var deleteImage     = Properties.Resources.IE_UserDelete_24;
                var propertiesImage = Properties.Resources.IE_UserProperties_24;
                var memberShipImage = Properties.Resources.IE_GroupManagement_24;
                var activateImage   = Properties.Resources.IE_UserActivate_24;
                var deactivateImage = Properties.Resources.IE_UserDeactivate_24;

                // Add ButtonItem
                AddButtonItem        = MenuGenerator.CreateButtonItem(addImage, nameof(AddButtonItem), "Add", false, null, true);
                ModifyButtonItem     = MenuGenerator.CreateButtonItem(modifyImage, nameof(ModifyButtonItem), "Modify", false, null, true);
                DeleteButtonItem     = MenuGenerator.CreateButtonItem(deleteImage, nameof(DeleteButtonItem), "Delete", false, null, true);
                PropertiesButtonItem = MenuGenerator.CreateButtonItem(propertiesImage, nameof(PropertiesButtonItem), "Properties", false, null, true);

                AddButtonItem.Click        += ButtonItemClick;
                ModifyButtonItem.Click     += ButtonItemClick;
                DeleteButtonItem.Click     += ButtonItemClick;
                PropertiesButtonItem.Click += ButtonItemClick;

                AddButtonItem.Visible        = true;
                ModifyButtonItem.Visible     = true;
                DeleteButtonItem.Visible     = true;
                PropertiesButtonItem.Visible = true;

                EnableDisableButtons();

                // Add RibbonBar
                var baseItems = new DevComponents.DotNetBar.BaseItem[] {
                    AddButtonItem,
                    ModifyButtonItem,
                    DeleteButtonItem,
                    PropertiesButtonItem
                };

                MaterialsRibbonBar = MenuGenerator.CreateRibbonBar(baseItems, nameof(MaterialsRibbonBar), Translations.General.Manage);
            }
            catch (Exception ex)
            {
                Trace.WriteError("", Trace.GetMethodName(), CLASSNAME, ex);
            }
        }
Exemplo n.º 4
0
        private void FrmMain_Load(object sender, System.EventArgs e)
        {
            System.Collections.ArrayList rootList = authorityService.GetRootModule(Framework.Entity.Module.MENU);
                foreach (Framework.Entity.Module root in rootList)
                {
                    DevComponents.DotNetBar.ButtonItem rootItem = new DevComponents.DotNetBar.ButtonItem();
                    rootItem.Text = root.Title;
                    BarMenu.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { rootItem });
                    System.Collections.ArrayList childList = authorityService.GetModuleByPid(root.Id, Framework.Entity.Module.MENU);
                    DevComponents.DotNetBar.BaseItem[] baseItem = new DevComponents.DotNetBar.BaseItem[childList.Count];
                    int i = 0;
                    foreach (Framework.Entity.Module child in childList)
                    {
                        DevComponents.DotNetBar.ButtonItem btnItem = new DevComponents.DotNetBar.ButtonItem();
                        btnItem.Text = child.Title;
                        btnItem.Tag = child;
                        baseItem[i] = btnItem;
                        btnItem.Click += new System.EventHandler(delegate(object o, System.EventArgs a)
                        {
                            DevComponents.DotNetBar.ButtonItem btn = (DevComponents.DotNetBar.ButtonItem)o;
                            Framework.Entity.Module mod = (Framework.Entity.Module)btn.Tag;
                            CreateItem(mod.Title, mod.Class, null);
                        });
                        i++;
                    }
                    rootItem.SubItems.AddRange(baseItem);
                }
                CreateTheme("经典风格", DevComponents.DotNetBar.eStyle.Office2007VistaGlass);
                CreateTheme("淡蓝色风格", DevComponents.DotNetBar.eStyle.Office2007Blue);
                CreateTheme("银白色风格", DevComponents.DotNetBar.eStyle.Office2007Silver);
                CreateTheme("win7", DevComponents.DotNetBar.eStyle.Windows7Blue);

                ((DevComponents.DotNetBar.ButtonItem)BtnTheme.SubItems[0]).Checked = true;
        }
Exemplo n.º 5
0
        private void AddControls()
        {
            ArrayList al = new ArrayList();

            DevComponents.DotNetBar.LabelItem li = new DevComponents.DotNetBar.LabelItem();
            li.Text = "    ";
            DevComponents.DotNetBar.Controls.ReflectionImage ri;

            DevComponents.DotNetBar.Controls.ReflectionLabel rl = new DevComponents.DotNetBar.Controls.ReflectionLabel();
            rl.Text   = "<b><font size='+3'><font color='#B02B2C'>TCP:</font></font></b>";
            rl.Width  = 40;
            rl.Height = 30;
            DevComponents.DotNetBar.ControlContainerItem cci = new DevComponents.DotNetBar.ControlContainerItem();
            cci.Control = rl;

            al.Add(li);
            al.Add(cci);


            var tcp = from t in ExecServiceList.Lsm where t.SERVICETYPE == "TCP" select t;
            int i   = 0;

            foreach (var item in tcp)
            {
                i++;
                rl          = new DevComponents.DotNetBar.Controls.ReflectionLabel();
                rl.Text     = "<b><font color='#B02B2C'><font size='+.5'><i>" + item.SERVICEID + "</i></font></font></b>";
                rl.Width    = item.SERVICEID.ToString().Length * 8;
                rl.Height   = 30;
                cci         = new DevComponents.DotNetBar.ControlContainerItem();
                cci.Control = rl;
                al.Add(cci);



                ri = new DevComponents.DotNetBar.Controls.ReflectionImage();
                if (item.STATE == false)
                {
                    ri.Image = imageList1.Images[0];
                }
                else
                {
                    ri.Image = imageList1.Images[2];
                }
                ri.MouseDoubleClick += new MouseEventHandler(ri_MouseDoubleClick);
                ri.Tag      = item.SERVICETYPE + item.SERVICEID;
                ri.Width    = 20;
                ri.Height   = 25;
                cci         = new DevComponents.DotNetBar.ControlContainerItem();
                cci.Control = ri;
                al.Add(cci);
            }

            rl          = new DevComponents.DotNetBar.Controls.ReflectionLabel();
            rl.Text     = "<b><font size='+3'><font color='#B02B2C'>UDP:</font></font></b>";
            rl.Width    = 40;
            rl.Height   = 30;
            cci         = new DevComponents.DotNetBar.ControlContainerItem();
            cci.Control = rl;


            li      = new DevComponents.DotNetBar.LabelItem();
            li.Text = "    ";
            al.Add(li);
            al.Add(cci);

            var udp = from t in ExecServiceList.Lsm where t.SERVICETYPE == "UDP" select t;

            i = 0;
            foreach (var item in udp)
            {
                rl          = new DevComponents.DotNetBar.Controls.ReflectionLabel();
                rl.Text     = "<b><font color='#B02B2C'><font size='+.5'><i>" + item.SERVICEID + "</i></font></font></b>";
                rl.Width    = item.SERVICEID.ToString().Length * 8;
                rl.Height   = 30;
                cci         = new DevComponents.DotNetBar.ControlContainerItem();
                cci.Control = rl;
                al.Add(cci);


                ri = new DevComponents.DotNetBar.Controls.ReflectionImage();
                if (item.STATE == false)
                {
                    ri.Image = imageList1.Images[0];
                }
                else
                {
                    ri.Image = imageList1.Images[2];
                }
                ri.MouseDoubleClick += new MouseEventHandler(ri_MouseDoubleClick);
                ri.Tag      = item.SERVICETYPE + item.SERVICEID;
                ri.Width    = 20;
                ri.Height   = 25;
                cci         = new DevComponents.DotNetBar.ControlContainerItem();
                cci.Control = ri;
                al.Add(cci);
            }


            rl          = new DevComponents.DotNetBar.Controls.ReflectionLabel();
            rl.Text     = "<b><font size='+3'><font color='#B02B2C'>GSM:</font></font></b>";
            rl.Width    = 40;
            rl.Height   = 30;
            cci         = new DevComponents.DotNetBar.ControlContainerItem();
            cci.Control = rl;

            li      = new DevComponents.DotNetBar.LabelItem();
            li.Text = "    ";
            al.Add(li);
            al.Add(cci);


            var gsm = from t in ExecServiceList.Lsm where t.SERVICETYPE == "GSM" select t;

            i = 0;
            foreach (var item in gsm)
            {
                rl          = new DevComponents.DotNetBar.Controls.ReflectionLabel();
                rl.Text     = "<b><font color='#B02B2C'><font size='+.5'><i>" + item.SERVICEID + "</i></font></font></b>";
                rl.Width    = item.SERVICEID.ToString().Length * 8;
                rl.Height   = 30;
                cci         = new DevComponents.DotNetBar.ControlContainerItem();
                cci.Control = rl;
                al.Add(cci);


                ri = new DevComponents.DotNetBar.Controls.ReflectionImage();
                if (item.STATE == false)
                {
                    ri.Image = imageList1.Images[0];
                }
                else
                {
                    ri.Image = imageList1.Images[2];
                }
                ri.MouseDoubleClick += new MouseEventHandler(ri_MouseDoubleClick);
                ri.Tag      = item.SERVICETYPE + item.SERVICEID;
                ri.Width    = 20;
                ri.Height   = 25;
                cci         = new DevComponents.DotNetBar.ControlContainerItem();
                cci.Control = ri;
                al.Add(cci);
            }

            rl          = new DevComponents.DotNetBar.Controls.ReflectionLabel();
            rl.Text     = "<b><font size='+3'><font color='#B02B2C'>COM:</font></font></b>";
            rl.Width    = 40;
            rl.Height   = 30;
            cci         = new DevComponents.DotNetBar.ControlContainerItem();
            cci.Control = rl;

            li      = new DevComponents.DotNetBar.LabelItem();
            li.Text = "    ";
            al.Add(li);
            al.Add(cci);

            var com = from t in ExecServiceList.Lsm where t.SERVICETYPE == "COM" select t;

            if (com.Count() > 0)
            {
                toolTip1.SetToolTip(rl, "右击操作");
                rl.MouseClick += new MouseEventHandler(rl_MouseClick);
            }
            i = 0;
            foreach (var item in com)
            {
                rl          = new DevComponents.DotNetBar.Controls.ReflectionLabel();
                rl.Text     = "<b><font color='#B02B2C'><font size='+.5'><i>" + item.SERVICEID + "</i></font></font></b>";
                rl.Width    = item.SERVICEID.ToString().Length * 8;
                rl.Height   = 30;
                cci         = new DevComponents.DotNetBar.ControlContainerItem();
                cci.Control = rl;
                al.Add(cci);


                ri = new DevComponents.DotNetBar.Controls.ReflectionImage();
                if (item.STATE == false)
                {
                    ri.Image = imageList1.Images[0];
                }
                else
                {
                    ri.Image = imageList1.Images[2];
                }
                ri.MouseDoubleClick += new MouseEventHandler(ri_MouseDoubleClick);
                ri.Tag      = item.SERVICETYPE + item.SERVICEID;
                ri.Width    = 20;
                ri.Height   = 25;
                cci         = new DevComponents.DotNetBar.ControlContainerItem();
                cci.Control = ri;
                al.Add(cci);
            }

            DevComponents.DotNetBar.BaseItem[] bi = new DevComponents.DotNetBar.BaseItem[al.Count];
            for (i = 0; i < al.Count; i++)
            {
                bi[i] = al[i] as DevComponents.DotNetBar.BaseItem;
            }

            itemPanel_top.Items.AddRange(bi);
        }
Exemplo n.º 6
0
 private void sideBar1_ItemClick(object sender, System.EventArgs e)
 {
     DevComponents.DotNetBar.BaseItem item = sender as DevComponents.DotNetBar.BaseItem;
     richTextBox1.Text = "ItemClick: " + item.Text + " (" + item.Name + ")\n" + richTextBox1.Text;
 }