コード例 #1
0
        void OnDecreaseFontSize(object sender, WebPartEventArgs e)
        {
            // change font size in current web part
            switch (this.TextFontSize)
            {
            case 32:
                this.TextFontSize = 24;
                break;

            case 24:
                this.TextFontSize = 18;
                break;

            case 18:
                this.TextFontSize = 14;
                break;
            }

            // save changes back to content database
            SPWeb  site = SPContext.Current.Web;
            SPFile page = site.GetFile(Context.Request.Url.AbsolutePath);

            SP.SPLimitedWebPartManager wpm     = page.GetLimitedWebPartManager(PersonalizationScope.User);
            FontConnectionProvider     webpart = wpm.WebParts[this.ID] as FontConnectionProvider;

            webpart.TextFontSize = this.TextFontSize;
            wpm.SaveChanges(webpart);
        }
コード例 #2
0
        void OnMakeFontRed(object sender, WebPartEventArgs e)
        {
            this.TextFontColor = "Red";
            SPWeb  site = SPContext.Current.Web;
            SPFile page = site.GetFile(Context.Request.Url.AbsolutePath);

            SP.SPLimitedWebPartManager wpm     = page.GetLimitedWebPartManager(PersonalizationScope.User);
            FontConnectionProvider     webpart = wpm.WebParts[this.ID] as FontConnectionProvider;

            webpart.TextFontColor = "Red";
            wpm.SaveChanges(webpart);
        }