Esempio n. 1
0
        public TemplateForm()
        {
            //this.ThemeClassName = "Windows7";
            //ThemeResolutionService.ApplicationThemeName = "Windows7";
            InitializeComponent();
            //Icon = new Icon(ResourcesImageHelper.Instance.GetResourcesStream("Common.icon", "MainIco", EnumImageType.ICO));


            Telerik.WinControls.Themes.Office2007SilverTheme officeTheme = new Telerik.WinControls.Themes.Office2007SilverTheme();
            this.ThemeName = officeTheme.ThemeName;
        }
Esempio n. 2
0
        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CnasMain_Load(object sender, EventArgs e)
        {
            //设置窗体图标
            this.Icon = new Icon(ResourcesImageHelper.Instance.GetResourcesStream("Common.icon", "MainIco", EnumImageType.ICO));



            this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
            SetStyle(ControlStyles.DoubleBuffer, true);         // 双缓冲

            this.pnlBackground.BorderStyle = BorderStyle.None;
            this.radPageViewContent.ViewElement.ShowItemCloseButton = true;

            //更换皮肤
            //ThemeResolutionService.ApplyThemeToControlTree(this, "Windows7");

            //Telerik.WinControls.Themes.Office2010BlueTheme s = new Telerik.WinControls.Themes.Office2010BlueTheme();

            //Telerik.WinControls.Themes.TelerikMetroBlueTheme buleTheme = new Telerik.WinControls.Themes.TelerikMetroBlueTheme();

            Telerik.WinControls.Themes.Office2007SilverTheme officeTheme = new Telerik.WinControls.Themes.Office2007SilverTheme();

            this.ApplyTheme(officeTheme.ThemeName);

            //this.radPageViewContent.ThemeName = s.ThemeName;
            this.radPageViewContent.ThemeName = officeTheme.ThemeName;

            //this.LeftMenu.ThemeName = s.ThemeName;
            this.LeftMenu.ThemeName = officeTheme.ThemeName;

            //this.toolLeft.AllowedDockState &= ~AllowedDockState.All;
            //this.toolLeft.AllowedDockState &= ~AllowedDockState.Floating;
            //this.toolLeft.AllowedDockState &= ~AllowedDockState.TabbedDocument;

            CnasRemotCall reCnasRemotCall = new CnasRemotCall();
            SortedList    sttemp01        = new SortedList();

            sttemp01.Add(1, CnasBaseData.SystemID);
            //一级目录菜单
            dtappall = reCnasRemotCall.RemotInterface.SelectData("HCS-app-sec001", sttemp01);
            SortedList sttemp02 = new SortedList();

            sttemp02.Add(1, CnasBaseData.UserName);

            //string aa = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-user_app-sec001", sttemp02);

            //二级目录菜单
            dtappuser = reCnasRemotCall.RemotInterface.SelectData("HCS-user_app-sec001", sttemp02);

            string up1 = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-app-sec001", sttemp01);
            string up2 = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-user_app-sec001", sttemp02);

            //判断一级二级目录是否有值
            if (dtappall != null && dtappuser != null)
            {
                #region 插入一级目录树
                DataRow[] arrayDR = dtappall.Select("app_type=0");
                foreach (DataRow dr in arrayDR)
                {
                    RadPageViewPage rpvPage = new RadPageViewPage();

                    rpvPage.Font = new Font(rpvPage.Font.FontFamily, 11);

                    rpvPage.Name          = dr["app_name"].ToString().Trim();
                    rpvPage.Tag           = dr["app_code"].ToString().Trim();
                    rpvPage.Image         = ResourcesImageHelper.Instance.GetResourcesImage("MenuIcon", dr["app_code"].ToString());
                    rpvPage.TextAlignment = ContentAlignment.MiddleCenter;
                    this.LeftMenu.Pages.Add(rpvPage);
                }

                #endregion

                #region 插入二级目录树

                try
                {
                    //插入二级目录
                    for (int i = 0; i < dtappuser.Rows.Count; i++)
                    {
                        string str_id = dtappuser.Rows[i]["app_id"].ToString();
                        //获得数据的详细数据
                        DataRow[] arrayDRdata = dtappall.Select("id=" + str_id);
                        if (arrayDRdata.Count() <= 0 || arrayDRdata[0]["state"].ToString() == "0")
                        {
                            continue;
                        }
                        string appBreifCode   = arrayDRdata[0]["app_briefcode"].ToString();
                        string str_app_code   = arrayDRdata[0]["app_code"].ToString();
                        string str_app_name   = arrayDRdata[0]["app_name"].ToString();
                        string str_app_parent = arrayDRdata[0]["app_parent"].ToString();
                        string str_app_ico    = arrayDRdata[0]["app_ico"].ToString();
                        string str_app_file   = arrayDRdata[0]["app_file"].ToString();

                        try
                        {
                            //获取父级的菜单
                            DataRow[] dtData     = dtappall.Select("app_code='" + str_app_parent + "'");
                            string    parentName = dtData[0]["app_name"].ToString().Trim();

                            RadPageViewPage parentPage = this.LeftMenu.Pages[parentName];


                            parentPage.Font = new Font(parentPage.Font.FontFamily, 11);


                            parentPage.AutoScroll = true;

                            RadLabel radLi = new RadLabel();

                            radLi.Font = LeftMenu.Font;

                            radLi.AutoSize = false;

                            radLi.Image          = ResourcesImageHelper.Instance.GetResourcesImage("MenuIcon", str_app_code);
                            radLi.ImageAlignment = ContentAlignment.TopCenter;

                            //radLi.TextImageRelation = TextImageRelation.Overlay;

                            radLi.Height = 70;
                            radLi.Width  = parentPage.Width - 10;

                            radLi.Text          = str_app_name;
                            radLi.TextAlignment = ContentAlignment.BottomCenter;

                            radLi.Tag = CnasUtilityTools.ConcatTwoString(appBreifCode, str_app_code);

                            radLi.Cursor = System.Windows.Forms.Cursors.Hand;
                            radLi.Click += radLi_Click;
                            //radLi.Left = 5;

                            if (parentPage.Controls.Count == 0)
                            {
                                radLi.Top = 10;
                            }
                            else
                            {
                                radLi.Top = parentPage.Controls.Count * 82;
                            }


                            parentPage.Controls.Add(radLi);
                            slappfile.Add(CnasUtilityTools.ConcatTwoString(appBreifCode, str_app_code), str_app_file);
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                #endregion
            }
            else
            {
                MessageBox.Show("对不起!请联系管理员先配置用户权限。");
            }
            this.Resize += CnasMain_Resize;
        }