コード例 #1
0
        public stdole.IPictureDisp OnGetImage(string imageName)
        {
            //Assembly assembly = Assembly.GetExecutingAssembly();

            //String projectName = Assembly.GetExecutingAssembly().GetName().Name.ToString();
            //Stream stream = assembly.GetManifestResourceStream(projectName + ".Resources." + imageName);

            // return new Bitmap(stream);

            switch (imageName)
            {
            case "insert":
                return(ConvertImage.Convert2Picture(Resources.insert));

            case "history":
                return(ConvertImage.Convert2Picture(Resources.history));

            case "realtime":
                return(ConvertImage.Convert2Picture(Resources.realtime));

            case "report":
                return(ConvertImage.Convert2Picture(Resources.report));

            case "shot":
                return(ConvertImage.Convert2Picture(Resources.shot));

            case "refresh":
                return(ConvertImage.Convert2Picture(Resources.refresh));

            case "help":
                return(ConvertImage.Convert2Picture(Resources.help));

            case "wizzard":
                return(ConvertImage.Convert2Picture(Resources.wizzard));

            case "lr":
                return(ConvertImage.Convert2Picture(Resources.lr));

            case "file":
                return(ConvertImage.Convert2Picture(Resources.file));

            case "selected":
                return(ConvertImage.Convert2Picture(Resources.selceted));

            case "page":
                return(ConvertImage.Convert2Picture(Resources.page));
            }
            return(ConvertImage.Convert2Picture(Resources.insert));
        }
コード例 #2
0
        public void AddCommandBar(CommandBar ComBar)
        {
            CommandBarButton buttonInsertFormual = (CommandBarButton)ComBar.Controls.Add(MsoControlType.msoControlButton, 1, "", 1, true);

            buttonInsertFormual.Caption = "插入函数";
            buttonInsertFormual.Picture = ConvertImage.Convert2Picture(Resources.insert);
            buttonInsertFormual.Mask    = ConvertImage.Convert2Picture(Resources.insert2);
            buttonInsertFormual.Style   = MsoButtonStyle.msoButtonIconAndCaption;
            buttonInsertFormual.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSButtonInsertFormulaClick);

            CommandBarButton buttonHistory = (CommandBarButton)ComBar.Controls.Add(MsoControlType.msoControlButton, 1, "", 2, true);

            buttonHistory.Caption = "历史行情";
            buttonHistory.Picture = ConvertImage.Convert2Picture(Resources.history);
            buttonHistory.Mask    = ConvertImage.Convert2Picture(Resources.history2);
            buttonHistory.Style   = MsoButtonStyle.msoButtonIconAndCaption;
            buttonHistory.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSButtonHistoryClick);

            CommandBarButton buttonRealTime = (CommandBarButton)ComBar.Controls.Add(MsoControlType.msoControlButton, 1, "", 3, true);

            buttonRealTime.Caption = "实时行情";
            buttonRealTime.Picture = ConvertImage.Convert2Picture(Resources.realtime);
            buttonRealTime.Mask    = ConvertImage.Convert2Picture(Resources.realtime2);
            buttonRealTime.Style   = MsoButtonStyle.msoButtonIconAndCaption;
            buttonRealTime.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSButtonRealTimeClick);

            CommandBarPopup cmdBarPopReport = (CommandBarPopup)ComBar.Controls.Add(MsoControlType.msoControlPopup, 1, "", 4, true);

            cmdBarPopReport.Caption = "截面报表";
            CommandBar cmdBarReport = cmdBarPopReport.CommandBar;

            CommandBarButton buttonWizzard = (CommandBarButton)cmdBarReport.Controls.Add(MsoControlType.msoControlButton, 1, "", 1, true);

            buttonWizzard.Caption = "向导式";
            buttonWizzard.Picture = ConvertImage.Convert2Picture(Resources.wizzard);
            buttonWizzard.Mask    = ConvertImage.Convert2Picture(Resources.wizzard2);
            buttonWizzard.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSButtonWizzardClick);

            CommandBarButton buttonLR = (CommandBarButton)cmdBarReport.Controls.Add(MsoControlType.msoControlButton, 1, "", 2, true);

            buttonLR.Caption = "左右式";
            buttonLR.Picture = ConvertImage.Convert2Picture(Resources.lr);
            buttonLR.Mask    = ConvertImage.Convert2Picture(Resources.lr2);
            buttonLR.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSButtonLRClick);

            CommandBarPopup cmdBarPopSnapshot = (CommandBarPopup)ComBar.Controls.Add(MsoControlType.msoControlPopup, 1, "", 5, true);

            cmdBarPopSnapshot.Caption = "建立快照";
            CommandBar cmdBarSnapshot = cmdBarPopSnapshot.CommandBar;

            CommandBarButton buttonPage = (CommandBarButton)cmdBarSnapshot.Controls.Add(MsoControlType.msoControlButton, 1, "", 1, true);

            buttonPage.Caption = "工作表快照";
            buttonPage.Picture = ConvertImage.Convert2Picture(Resources.shot);
            buttonPage.Mask    = ConvertImage.Convert2Picture(Resources.shot2);
            buttonPage.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSButtonSnapshotPageClick);

            CommandBarButton buttonFile = (CommandBarButton)cmdBarSnapshot.Controls.Add(MsoControlType.msoControlButton, 1, "", 2, true);

            buttonFile.Caption = "工作薄快照";
            buttonFile.Picture = ConvertImage.Convert2Picture(Resources.file);
            buttonFile.Mask    = ConvertImage.Convert2Picture(Resources.file2);
            buttonFile.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSButtonSnapshotFileClick);

            CommandBarPopup cmdBarPopRefresh = (CommandBarPopup)ComBar.Controls.Add(MsoControlType.msoControlPopup, 1, "", 6, true);

            cmdBarPopRefresh.Caption = "刷新所有工作薄";
            CommandBar cmdBarRefresh = cmdBarPopRefresh.CommandBar;

            CommandBarButton buttonRefreshSelected = (CommandBarButton)cmdBarRefresh.Controls.Add(MsoControlType.msoControlButton, 1, "", 1, true);

            buttonRefreshSelected.Caption = "刷新选中区域";
            buttonRefreshSelected.Picture = ConvertImage.Convert2Picture(Resources.selceted);
            buttonRefreshSelected.Mask    = ConvertImage.Convert2Picture(Resources.selected2);
            buttonRefreshSelected.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSButtonRefreshSelectedClick);

            CommandBarButton buttonRefreshPage = (CommandBarButton)cmdBarRefresh.Controls.Add(MsoControlType.msoControlButton, 1, "", 2, true);

            buttonRefreshPage.Caption = "刷新本页";
            buttonRefreshPage.Picture = ConvertImage.Convert2Picture(Resources.page);
            buttonRefreshPage.Mask    = ConvertImage.Convert2Picture(Resources.page2);
            buttonRefreshPage.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSButtonSnapshotPageClick);

            CommandBarButton buttonRefreshFile = (CommandBarButton)cmdBarRefresh.Controls.Add(MsoControlType.msoControlButton, 1, "", 3, true);

            buttonRefreshFile.Caption = "刷新整个文件";
            buttonRefreshFile.Picture = ConvertImage.Convert2Picture(Resources.refresh);
            buttonRefreshFile.Mask    = ConvertImage.Convert2Picture(Resources.refresh2);
            buttonRefreshFile.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSButtonSnapshotFileClick);

            CommandBarButton buttonHelp = (CommandBarButton)ComBar.Controls.Add(MsoControlType.msoControlButton, 1, "", 7, true);

            buttonHelp.Caption = "使用手册";
            buttonHelp.Picture = ConvertImage.Convert2Picture(Resources.help);
            buttonHelp.Mask    = ConvertImage.Convert2Picture(Resources.help2);
            buttonHelp.Style   = MsoButtonStyle.msoButtonIconAndCaption;
            buttonHelp.Click  += new _CommandBarButtonEvents_ClickEventHandler(OnUMSHelpClick);
        }