private void CreateWithImageMagick(TextStyle textStyle, string text, string filename, bool cacheImage) { lock (ImageMagickLock) { Process imageMagick = new Process(); imageMagick.StartInfo.CreateNoWindow = true; imageMagick.StartInfo.UseShellExecute = false; imageMagick.StartInfo.WorkingDirectory = Server.MapPath("/images/headings"); imageMagick.StartInfo.FileName = imageMagick.StartInfo.WorkingDirectory + @"\\convert.exe"; imageMagick.StartInfo.Arguments = (BackgroundTextureFile != null ? " -size x" + MinHeight + " " : "") + "-antialias -fill \"" + RgbInHex(textStyle.Color) + "\" -gravity north -font " + textStyle.PostScriptFamily + " -pointsize " + textStyle.Size + " label:\"" + text + "\" " + (BackgroundTextureFile != null ? " -gravity center -tile \"" + Server.MapPath(BackgroundTextureFile) + "\" -draw \"color 0,0 reset\" " : " -background " + RgbInHex(Background) + " ") + (BackgroundTextureFile != null ? " +tile -fill \"" + RgbInHex(textStyle.Color) + "\" -gravity center -annotate +0-" + (Math.Round((double)MinHeight / 10)) + " \"" + text + "\" " : "") + " \"" + filename + "\""; imageMagick.StartInfo.RedirectStandardOutput = true; imageMagick.StartInfo.RedirectStandardError = true; imageMagick.Start(); string err = imageMagick.StandardError.ReadToEnd(); // + imageMagick.StandardError.ReadToEnd(); imageMagick.WaitForExit(); if (err != null && err != "") throw new Exception("Could not create TextImage: " + err); // Read it back Bitmap newBitmap = null; Graphics newGraphic = null; try { using (Image image = Image.FromFile(filename)) using (Bitmap objBitmap = new Bitmap(image)) { int left, width; FindMinimumBitmapWidth(objBitmap, out left, out width); newBitmap = new Bitmap(width, MinHeight); newGraphic = Graphics.FromImage(newBitmap); newGraphic.DrawImage(image, 0, 0, new Rectangle(left, YOffset, width, MinHeight), GraphicsUnit.Pixel); // Let go of the file so we can // overwrite it } // Send to user MemoryStream io = new MemoryStream(); newBitmap.Save(io, ImageFormat.Png); byte[] ba = io.GetBuffer(); Response.BinaryWrite(ba); if (cacheImage) SaveFile(filename, ba); } finally { if (newGraphic != null) newGraphic.Dispose(); if (newBitmap != null) newBitmap.Dispose(); } } }
private void CreateWithSystemDrawing(TextStyle textStyle, string text, string filename, bool cacheImage) { // Start with a large object, and find the required width and height int width = 800, height = 50; int top = 0, left = 0, right = 0; int actualwidth; int x, y; int? leftTextureWidth = null; using (Bitmap bitmap = new Bitmap(width, height)) using (Graphics graphics = Graphics.FromImage(bitmap)) { // The calculated width varies due to antialiasing of the // font in various colours, so we will always use black when // measuring using (TextStyle textStyleWithBlackBrush = (TextStyle)textStyle.Clone()) { textStyleWithBlackBrush.Brush = new SolidBrush(Color.Black); using (SolidBrush whiteBrush = new SolidBrush(Color.White)) graphics.FillRectangle(whiteBrush, 0, 0, width, height); AddText(left, top, text, graphics, textStyleWithBlackBrush, Format); } FindMinimumBitmapWidth(bitmap, out left, out width); left = -left; // find min height bool found = false; for (y = height - 1; y >= 0; y--) { for (x = 0; x < width; x++) { if (bitmap.GetPixel(x, y).ToArgb() != Color.White.ToArgb()) { found = true; break; } } if (found) break; } height = y + 1; // find top offset found = false; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { if (bitmap.GetPixel(x, y).ToArgb() != Color.White.ToArgb()) { found = true; break; } } if (found) break; } if (yOffset != 0) y = yOffset; top = -y; height -= y; if (height < minHeight) { if (yOffset == 0) top += (minHeight - y) / 2; height = minHeight; } if (LeftTextureFile != null) { using (Bitmap leftTexture = new Bitmap(Server.MapPath(LeftTextureFile))) { width += leftTexture.Width; left += leftTexture.Width; leftTextureWidth = leftTexture.Width; } } if (RightTextureFile != null) { using (Bitmap rightTexture = new Bitmap(Server.MapPath(RightTextureFile))) { width += rightTexture.Width; right += rightTexture.Width; } } if (IconTextureFile != null) { using (var iconTexture = new Bitmap(Server.MapPath(IconTextureFile))) width += iconTexture.Width; } if (FixedWidth != 0) { actualwidth = FixedWidth; } else if (useDefaultWidth) { actualwidth = width + (2 * DefaultWidthMargin); } else { actualwidth = width + AdditionalWidth; } } if (actualwidth < 1) actualwidth = 1; // Create our actual image using (Bitmap bitmap = new Bitmap(actualwidth, height)) using (Graphics graphics = Graphics.FromImage(bitmap)) { using (Brush backgroundBrush = BackgroundBrush) graphics.FillRectangle(backgroundBrush, 0, 0, actualwidth, height); // If there is a textured background, fill up out output with it if (BackgroundTextureFile != null) { using (Bitmap texturedBackground = new Bitmap(Server.MapPath(BackgroundTextureFile))) { for (x = leftTextureWidth ?? left; x < actualwidth - right - texturedBackground.Width; x += texturedBackground.Width) graphics.DrawImage(texturedBackground, x, 0, texturedBackground.Width, height); graphics.DrawImage(texturedBackground, x, 0, actualwidth - right - x, height); } } // If there are left/right backgrounds, output them if (LeftTextureFile != null) { using (Bitmap leftTexture = new Bitmap(Server.MapPath(LeftTextureFile))) graphics.DrawImage(leftTexture, 0, 0, leftTexture.Width, height); } if (RightTextureFile != null) { using (Bitmap rightTexture = new Bitmap(Server.MapPath(RightTextureFile))) graphics.DrawImage(rightTexture, actualwidth - rightTexture.Width, 0, rightTexture.Width, height); } // If we have an IconTexture set, output it on the image var textLeftOffset = left; if (IconTextureFile != null) { using (var iconTexture = new Bitmap(Server.MapPath(IconTextureFile))) { var xOffset = ((actualwidth - width) / 2) + IconXOffset; graphics.DrawImage(iconTexture, xOffset, ((height - iconTexture.Height) / 2) + IconYOffset, iconTexture.Width, iconTexture.Height); textLeftOffset += iconTexture.Width + IconXOffset + AdditionalIconTextLeftOffset; } } // Output the button text AddText(textLeftOffset + ((actualwidth - width) / 2), top, text, graphics, textStyle, Format); // Draw border if set if (Border != null) { graphics.DrawLine(Border, 0, 0, 0, height); graphics.DrawLine(Border, 0, 0, actualwidth, 0); graphics.DrawLine(Border, actualwidth - 1, 0, actualwidth - 1, height); graphics.DrawLine(Border, 0, height - 1, actualwidth - 1, height - 1); } Correct99AlphaBug(bitmap); // Send MemoryStream io = new MemoryStream(); bitmap.Save(io, ImageFormat.Png); byte[] ba = io.GetBuffer(); if (Png8) ba = CreatePng8(ba); if (cacheImage) SaveFile(filename, ba); Response.BinaryWrite(ba); io.Close(); } }
/// <summary> /// Setup the TextImage properties used to render the image /// </summary> /// <returns>True if the result can be safely cached to disk, otherwise false if it should not be.</returns> protected abstract bool Setup(TextStyle textStyle, TextImageParameters textParams);
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Convert.ToBoolean(Request["noheaders"])) { Response.ContentType = "image/png"; Response.Cache.SetExpires(DateTime.Today.AddHours(6)); Response.Cache.SetCacheability(HttpCacheability.Public); } // Read the input //var decodedPathInfo = "Title"; //string pathInfo = BasePage.GetPathInfo(this); //if (pathInfo != null && pathInfo.Length > 1) //decodedPathInfo = pathInfo.Substring(1); //decodedPathInfo = Server.UrlDecode(decodedPathInfo.Trim()); NameValueCollection queryParams = new NameValueCollection(); foreach (string key in Request.QueryString.Keys) { queryParams.Add(key, Server.UrlDecode(Request.QueryString[key])); } var decodedPathInfo = Text.JoinQueryString(Request.QueryString, "-", "-"); // Setup text image parameters var textParams = new TextImageParameters(decodedPathInfo, queryParams); minHeight = 0; yOffset = 0; var filename = Server.MapPath("/images/generated/") + ClassName + "-" + textParams.GetCacheKey(); if (!filename.EndsWith(".png")) filename += ".png"; // At this point, we should check for a cached copy on-disk and return that if found if (CanServeFromDisk(filename)) { using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read)) using (BinaryReader reader = new BinaryReader(fs)) { byte[] buffer = new byte[fs.Length]; reader.Read(buffer, 0, Convert.ToInt32(fs.Length)); Response.BinaryWrite(buffer); return; } } // Process our input using (TextStyle textStyle = new TextStyle()) { if (textParams.FixedWidth.HasValue) FixedWidth = textParams.FixedWidth.Value; var cacheImage = Setup(textStyle, textParams); if (Request.QueryString["color"] != null) { string[] parts = Request.QueryString["color"].Split(new char[] { ',' }); textStyle.Color = Color.FromArgb(Convert.ToInt32(parts[0]), Convert.ToInt32(parts[1]), Convert.ToInt32(parts[2])); } if (!string.IsNullOrEmpty(textParams.Icon)) IconTextureFile = GetValidIconFilePath(textParams.Icon); text = textParams.Text; if (textStyle.PostScriptFamily == null) CreateWithSystemDrawing(textStyle, textParams.Text, filename, cacheImage); else CreateWithImageMagick(textStyle, textParams.Text, filename, cacheImage); } }
protected static void AddText(int x, int y, string text, Graphics graphics, TextStyle cls, StringFormat format) { if (cls == null) throw new ArgumentNullException("cls"); lock (FontLock) { Font verFont; PrivateFontCollection pfc = new PrivateFontCollection(); try { if (cls.FontFileName != null && cls.FontFileName != string.Empty) { try { pfc.AddFontFile(cls.FontFileName); } catch (ArgumentNullException ex) { throw new Exception(string.Format("Font with filename '{0}' not found", cls.FontFileName), ex); } verFont = new Font(pfc.Families[0], cls.Size, cls.Style, GraphicsUnit.Pixel); } else verFont = new Font(cls.Family, cls.Size, cls.Style, GraphicsUnit.Pixel); using (verFont) { graphics.TextRenderingHint = TextRenderingHint.AntiAlias; graphics.DrawString(text, verFont, cls.Brush, x, y, format); } } finally { // due to a bug in the BCL, each fontfamily object in the private font collection has to // be explicitly disposed. See: // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=202970 // http://support.microsoft.com/kb/901026 // http://blog.loseyourmind.com/?m=200710 if (pfc.Families.Length > 0) { for (int i = pfc.Families.Length - 1; i >= 0; i--) pfc.Families[i].Dispose(); pfc.Dispose(); } } } }
public object Clone() { TextStyle cloned = new TextStyle(); cloned.Brush = (Brush)Brush.Clone(); cloned.Color = Color; cloned.Family = Family; cloned.FontFileName = FontFileName; cloned.PostScriptFamily = PostScriptFamily; cloned.Size = Size; cloned.Style = Style; return cloned; }
protected override bool Setup(TextStyle textStyle, TextImageParameters textParams) { textStyle.Color = Color.Black; textStyle.Family = "Mini 7"; textStyle.Style = FontStyle.Regular; textStyle.Size = 10; MinHeight = 17; // FIXME: -1 on mono. This should be calculated // automatically YOffset = -2; bool shouldBeCached = true; switch (textParams.Type) { case "small": _background = Color.FromArgb(0, 255, 255, 255); _backgroundTextureFile = "/images/templates/buttons/smallbk.png"; _leftTextureFile = "/images/templates/buttons/smallleft.png"; _rightTextureFile = "/images/templates/buttons/smallright.png"; textStyle.Family = "Arial"; textStyle.Style = FontStyle.Bold; MinHeight = 16; textStyle.Size = 11; YOffset = -2; // Apply a few different changes if we are showing an icon too if (!string.IsNullOrEmpty(textParams.Icon)) { UseDefaultWidth = false; AdditionalIconTextLeftOffset = -4; AdditionalWidth = 7; } break; case "large": _background = Color.FromArgb(0, 255, 255, 255); _backgroundTextureFile = "/images/templates/buttons/largebk.png"; _leftTextureFile = "/images/templates/buttons/largeleft.png"; _rightTextureFile = "/images/templates/buttons/largeright.png"; textStyle.Family = "Arial"; textStyle.Style = FontStyle.Bold; MinHeight = 20; textStyle.Size = 11; YOffset = -3; // Apply a few different changes if we are showing an icon too if (!string.IsNullOrEmpty(textParams.Icon)) { UseDefaultWidth = false; AdditionalIconTextLeftOffset = -4; AdditionalWidth = 7; } break; case "largewithicon": _background = Color.FromArgb(0, 255, 255, 255); _backgroundTextureFile = "/images/templates/buttons/largebk.png"; _leftTextureFile = "/images/templates/buttons/largeleft.png"; _rightTextureFile = "/images/templates/buttons/largeright.png"; textStyle.Family = "Arial"; textStyle.Style = FontStyle.Bold; MinHeight = 30; textStyle.Size = 11; YOffset = -3; // Apply a few different changes if we are showing an icon too if (!string.IsNullOrEmpty(textParams.Icon)) { UseDefaultWidth = false; AdditionalIconTextLeftOffset = -4; AdditionalWidth = 7; } break; case "padded": _background = Color.FromArgb(0, 255, 255, 255); _backgroundTextureFile = "/images/templates/buttons/padded-bk.png"; _leftTextureFile = "/images/templates/buttons/padded-left.png"; _rightTextureFile = "/images/templates/buttons/padded-right.png"; textStyle.Family = "Arial"; textStyle.Style = FontStyle.Bold; MinHeight = 26; textStyle.Size = 12; YOffset = -6; break; case "nonpadded": _background = Color.FromArgb(0, 255, 255, 255); _backgroundTextureFile = "/images/templates/buttons/padded-bk.png"; _leftTextureFile = "/images/templates/buttons/padded-left.png"; _rightTextureFile = "/images/templates/buttons/padded-right.png"; textStyle.Family = "Arial"; textStyle.Style = FontStyle.Bold; MinHeight = 26; textStyle.Size = 12; YOffset = -6; UseDefaultWidth = false; AdditionalWidth = 4; break; case "blue": _background = Color.FromArgb(0, 255, 255, 255); _backgroundTextureFile = "/images/templates/buttons/blue-bk.png"; _leftTextureFile = "/images/templates/buttons/blue-left.png"; _rightTextureFile = "/images/templates/buttons/blue-right.png"; textStyle.Family = "Arial"; textStyle.Color = Color.White; textStyle.Style = FontStyle.Bold; textStyle.Size = 16; AdditionalIconTextLeftOffset = 4; MinHeight = 31; YOffset = -6; break; case "largemenu": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); textStyle.Color = Color.FromArgb(254, 254, 254); MinHeight = 0; textStyle.Size = 17; YOffset = 0; UseDefaultWidth = false; Png8 = false; break; case "newlargemenu": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); textStyle.Color = Color.FromArgb(254, 254, 254); MinHeight = 0; textStyle.Size = 20; YOffset = 0; UseDefaultWidth = false; Png8 = false; break; case "voucher": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); textStyle.Color = Color.FromArgb(254, 254, 254); MinHeight = 0; textStyle.Size = 24; YOffset = 0; UseDefaultWidth = false; Png8 = false; break; case "transparentmodule": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); textStyle.Color = Color.FromArgb(254, 254, 254); textStyle.Style = FontStyle.Regular; textStyle.Size = 24; MinHeight = 41; YOffset = -6; UseDefaultWidth = false; break; case "newslettermodule": _background = Color.FromArgb(0, 255, 255, 255); _backgroundTextureFile = "/images/templates/buttons/newsletterbk.png"; textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); textStyle.Color = Color.FromArgb(255, 255, 255); textStyle.Style = FontStyle.Regular; textStyle.Size = 24; MinHeight = 41; YOffset = -6; UseDefaultWidth = false; break; case "largegenre": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); textStyle.Color = Color.FromArgb(254, 254, 254); MinHeight = 24; textStyle.Size = 15; YOffset = 0; Png8 = false; break; case "submenu": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/COPRGTL.ttf"); textStyle.Color = Color.Black; MinHeight = 20; textStyle.Size = 15; YOffset = 1; Png8 = false; break; case "submenuhover": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/COPRGTL.ttf"); textStyle.Color = Color.FromArgb(255, 153, 0); MinHeight = 20; textStyle.Size = 15; YOffset = 1; Png8 = false; break; case "topmenu": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); textStyle.Color = Color.FromArgb(124, 203, 254); MinHeight = 0; textStyle.Size = 20; YOffset = 0; Png8 = false; break; case "topmenuwhite": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); textStyle.Color = Color.FromArgb(255, 255, 255); MinHeight = 0; textStyle.Size = 20; YOffset = 0; Png8 = false; UseDefaultWidth = false; break; case "ltblue": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); _backgroundTextureFile = "/images/templates/buttons/ltblue-bk.png"; _leftTextureFile = "/images/templates/buttons/ltblue-left.png"; _rightTextureFile = "/images/templates/buttons/ltblue-right.png"; textStyle.Color = Color.White; textStyle.Size = 19; MinHeight = 46; YOffset = -12; break; case "ltblueleft": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); _backgroundTextureFile = "/images/templates/buttons/ltblue-bk.png"; _leftTextureFile = "/images/templates/buttons/ltblue-left.png"; _rightTextureFile = "/images/templates/buttons/ltblue-leftbk.png"; textStyle.Color = Color.White; textStyle.Size = 19; MinHeight = 46; YOffset = -12; break; case "ltblueright": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); _backgroundTextureFile = "/images/templates/buttons/ltblue-bk.png"; _leftTextureFile = "/images/templates/buttons/ltblue-rightbk.png"; _rightTextureFile = "/images/templates/buttons/ltblue-right.png"; textStyle.Color = Color.White; textStyle.Size = 19; MinHeight = 46; YOffset = -12; break; case "ltbluemiddle": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); _backgroundTextureFile = "/images/templates/buttons/ltblue-bk.png"; _leftTextureFile = "/images/templates/buttons/ltblue-rightbk.png"; _rightTextureFile = "/images/templates/buttons/ltblue-leftbk.png"; textStyle.Color = Color.White; textStyle.Size = 19; MinHeight = 46; YOffset = -12; break; case "silver": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); _backgroundTextureFile = "/images/templates/buttons/silver-bk.png"; _leftTextureFile = "/images/templates/buttons/silver-left.png"; _rightTextureFile = "/images/templates/buttons/silver-right.png"; textStyle.Color = Color.Black; textStyle.Size = 19; MinHeight = 46; YOffset = -12; break; case "silverleft": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); _backgroundTextureFile = "/images/templates/buttons/silver-bk.png"; _leftTextureFile = "/images/templates/buttons/silver-left.png"; _rightTextureFile = "/images/templates/buttons/silver-leftbk.png"; textStyle.Color = Color.Black; textStyle.Size = 19; MinHeight = 46; YOffset = -12; break; case "silverright": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); _backgroundTextureFile = "/images/templates/buttons/silver-bk.png"; _leftTextureFile = "/images/templates/buttons/silver-rightbk.png"; _rightTextureFile = "/images/templates/buttons/silver-right.png"; textStyle.Color = Color.Black; textStyle.Size = 19; MinHeight = 46; YOffset = -12; break; case "silvermiddle": _background = Color.FromArgb(0, 255, 255, 255); textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Condensed.ttf"); _backgroundTextureFile = "/images/templates/buttons/silver-bk.png"; _leftTextureFile = "/images/templates/buttons/silver-rightbk.png"; _rightTextureFile = "/images/templates/buttons/silver-leftbk.png"; textStyle.Color = Color.Black; textStyle.Size = 19; MinHeight = 46; YOffset = -12; break; #region old styles // OLD STYLES - maintained just for CMS case "light": _background = Color.FromArgb(0xec, 0xec, 0xec); break; case "medium": _background = Color.FromArgb(0xc9, 0xc9, 0xc9); break; case "smallheader": _background = Color.FromArgb(0xc9, 0xc9, 0xc9); MinHeight = 15; YOffset = 0; break; case "smallheaderhover": _background = Color.FromArgb(0x66, 0x66, 0x66); textStyle.Color = Color.FromArgb(254, 254, 254); MinHeight = 15; YOffset = 0; break; case "dark": _background = Color.FromArgb(0x66, 0x66, 0x66); textStyle.Color = Color.FromArgb(254, 254, 254); break; case "normalhover": case "highlight": _background = Color.FromArgb(0xff, 0x99, 0x00); textStyle.Color = Color.FromArgb(254, 254, 254); break; #endregion //Medium grey to black colour gradient used on main navigation buttons in header. case "darkgradient": textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Bold-Condensed.ttf"); _backgroundTextureFile = "/images/Modules/HeaderButtonBGDark.png"; textStyle.Color = Color.FromArgb(254, 254, 254); textStyle.Style = FontStyle.Bold; textStyle.Size = 14; MinHeight = 22; break; //Medium orange to orange yellow colour gradient used as mouseover affect for darkgradien buttons. case "darkgradienthover": textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Bold-Condensed.ttf"); _backgroundTextureFile = "/images/Modules/HeaderButtonBGDarkOver.png"; textStyle.Color = Color.FromArgb(0, 0, 0); textStyle.Style = FontStyle.Bold; textStyle.Size = 14; MinHeight = 22; break; case "darkgradientmedium": textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Bold-Condensed.ttf"); _backgroundTextureFile = "/images/Modules/darkmediumidoff.png"; textStyle.Color = Color.FromArgb(254, 254, 254); textStyle.Style = FontStyle.Bold; textStyle.Size = 14; MinHeight = 18; YOffset = -1; break; case "darkgradientmediumhover": textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Bold-Condensed.ttf"); _backgroundTextureFile = "/images/Modules/darkmediumidon.png"; textStyle.Color = Color.FromArgb(0, 0, 0); textStyle.Style = FontStyle.Bold; textStyle.Size = 14; MinHeight = 18; YOffset = -1; break; case "darkgradientsmall": textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Bold-Condensed.ttf"); _backgroundTextureFile = "/images/Modules/darksmallmidoff.png"; textStyle.Color = Color.FromArgb(254, 254, 254); textStyle.Style = FontStyle.Bold; textStyle.Size = 14; MinHeight = 15; YOffset = 1; break; case "darkgradientsmallhover": textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Bold-Condensed.ttf"); _backgroundTextureFile = "/images/Modules/darksmallmidon.png"; textStyle.Color = Color.FromArgb(0, 0, 0); textStyle.Style = FontStyle.Bold; textStyle.Size = 14; MinHeight = 15; YOffset = 1; break; case "darkrounded": textStyle.Family = "Arial"; _backgroundTextureFile = "/images/Modules/darkroundedmidoff.png"; _leftTextureFile = "/images/Modules/darkroundedleftoff.png"; _rightTextureFile = "/images/Modules/darkroundedrightoff.png"; textStyle.Color = Color.FromArgb(255, 255, 255); textStyle.Style = FontStyle.Bold; textStyle.Size = 11; MinHeight = 22; UseDefaultWidth = false; YOffset = -4; break; case "darkroundedhover": textStyle.Family = "Arial"; _backgroundTextureFile = "/images/Modules/darkroundedmidon.png"; _leftTextureFile = "/images/Modules/darkroundedlefton.png"; _rightTextureFile = "/images/Modules/darkroundedrighton.png"; textStyle.Color = Color.FromArgb(255, 255, 255); textStyle.Style = FontStyle.Bold; textStyle.Size = 11; MinHeight = 22; UseDefaultWidth = false; YOffset = -4; break; case "darkgradientlarge": textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Bold-Condensed.ttf"); _backgroundTextureFile = "/images/Modules/BigButtonBGDark.png"; textStyle.Color = Color.FromArgb(254, 254, 254); textStyle.Style = FontStyle.Bold; textStyle.Size = 22; MinHeight = 36; break; case "darkgradientlargehover": textStyle.FontFileName = Server.MapPath("/images/headings/Berthold-Akzidenz-Grotesk-BE-Bold-Condensed.ttf"); _backgroundTextureFile = "/images/Modules/BigButtonBGDarkOver.png"; textStyle.Color = Color.FromArgb(255, 255, 255); textStyle.Style = FontStyle.Bold; textStyle.Size = 22; MinHeight = 36; break; default: _background = Color.Green; textStyle.Color = Color.Purple; shouldBeCached = false; break; } return shouldBeCached; }