コード例 #1
0
        /// <summary>
        /// Called when the Add Tab menu item is clicked.
        /// </summary>
        /// <param name="sender">The source object</param>
        /// <param name="e">Event arguments</param>
        private void OnAddTab(object sender, EventArgs e)
        {
            TabStrip strip = (TabStrip)Component;
            PropertyDescriptor itemsDesc = DesignUtil.GetPropertyDescriptor(strip, "Items");
            if (itemsDesc != null)
            {
                // Tell the designer that we're changing the property
                RaiseComponentChanging(itemsDesc);

                // Do the change
                Tab tab = new Tab();
                tab.Text = "Tab";
                strip.Items.Add(tab);

                // Tell the designer that we've changed the property
                RaiseComponentChanged(itemsDesc, null, null);
                UpdateDesignTimeHtml();
            }
        }
コード例 #2
0
        private void SetupFileWindow(FileWindow window)
        {
            int i, vi=0;
            m_viewers = new IFileViewer[MAXFILES];

            //Get viewers and load tabs
            tsFiles.Items.Clear();
            for (i = window.Low; i < window.High; i++) {
                int fileID;
                string fileName;

                fileID = window.FileIDs[i];
                fileName = window.FilePaths[i];

                Tab tab = new Tab();
                tab.Text = Path.GetFileName(fileName);
                tsFiles.Items.Add(tab);

                try {
                    m_viewers[vi++] = LoadFileControl(fileID, fileName);
                } catch (FileDownloadException er) {
                    //Redirect if we only have 1 file
                    if (window.High - window.Low == 1)
                        Response.Redirect("dlfile.aspx?FileID="+er.FileID, true);
                    else
                        vi++;
                }
            }
            //Load up the placeholder controls
            LoadPlaceHolders(m_viewers);
        }