Hi
I ran into the Tab Text orientation problem with Google Chrome and firefox.
I noticed the suggestion using images instead of text for the tab Titles.
My tab titles are dynamic and created at run time so that poses a challenge.
I am submitting here my solution that creates the images on the fly!!
There are a couple of problems though:
1/The images are not transparent.
2/I have tried to get the image to use the forecolor of the tabs theme, but this always seems to be 0 (black).
Can anyone help fix with these two problems?
Here is how it works:
A/ Create an aspx page that will convert the text to an image:
(this is a pretty handy code in itself and is based on this link:http://911-need-code-help.blogspot.com/2009/02/create-text-images-on-fly-with-aspnet.html)
Create a new page name it TextToImage.aspx
Here is the code behind :
The ASPX needs no content.
B/ The next step is to iterate through the tabs and apply the image URL:
Here is my implemenation, my sliding zone is called 'ExploreSlidingZone' so you will need to change that to your own sliding zone name.
Call this function from code behind page_Load method.
Please see attached for a snapshot of the result.
You should see your tabs with images, but they are not transparent and do not inherit the skin properties.
So if we can solve the transparency & skin issues - we will have a result!!
Best Regards
Richard Briggs
I ran into the Tab Text orientation problem with Google Chrome and firefox.
I noticed the suggestion using images instead of text for the tab Titles.
My tab titles are dynamic and created at run time so that poses a challenge.
I am submitting here my solution that creates the images on the fly!!
There are a couple of problems though:
1/The images are not transparent.
2/I have tried to get the image to use the forecolor of the tabs theme, but this always seems to be 0 (black).
Can anyone help fix with these two problems?
Here is how it works:
A/ Create an aspx page that will convert the text to an image:
(this is a pretty handy code in itself and is based on this link:http://911-need-code-help.blogspot.com/2009/02/create-text-images-on-fly-with-aspnet.html)
Create a new page name it TextToImage.aspx
Here is the code behind :
protected void Page_Load(object sender, EventArgs e) { //Usage example //TextToImage.aspx?size=100&text=Hello%20there&color=FF22F3 //------------------------------------------- // CAPTURE + SANITIZE QUERYSTRING PARAMETERS //------------------------------------------- string qText; qText = Request.QueryString["text"] + ""; if (qText.Length == 0) qText = "-"; int qSize; try { qSize = Convert.ToInt32(Request.QueryString["size"]); } catch { qSize = 0; } if (qSize < 8) qSize = 8; string qColor; qColor = Request.QueryString["color"] + ""; if (qColor.Length == 0 || Regex.IsMatch(qColor, "^[0-9A-F]{6}$", RegexOptions.IgnoreCase) == false) qColor = "000000"; //------------------------------------------- // CALL FUNCTION //------------------------------------------- RenderGraphic(qText, qSize, qColor); } private void RenderGraphic(string pText, int pSize, string pColor) { //------------------------------------------- // DECLARE VARIABLES + PRE-CALCULATE //------------------------------------------- Bitmap b = new Bitmap(1, 1); Graphics g = Graphics.FromImage(b); Font f = new Font("Arial", pSize); int w = Convert.ToInt32(g.MeasureString(pText, f).Width); int h = Convert.ToInt32(g.MeasureString(pText, f).Height); //------------------------------------------- // RENDER DRAWING //------------------------------------------- b = new Bitmap(w, h); g = Graphics.FromImage(b); g.Clear(Color.FromArgb(255, 255, 255, 204));//Color.FromArgb(&HFF, &HFF, &HFF, &HCC) //g.Clear(Color.Transparent); g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; g.DrawString(pText, f, new SolidBrush(ColorTranslator.FromHtml("#" + pColor)), 0, 0); g.Flush(); b.RotateFlip(RotateFlipType.Rotate90FlipNone); //------------------------------------------- // SAVE IN MEMORY //------------------------------------------- MemoryStream m = new MemoryStream(); b.Save(m, ImageFormat.Gif); //------------------------------------------- // APPLY TRANSPARENCY HACK //------------------------------------------- byte[] n; n = m.ToArray(); //n[787] = 254; //------------------------------------------- // SEND TO BROWSER //------------------------------------------- BinaryWriter o = new BinaryWriter(Response.OutputStream); o.Write(n); o.Close(); }The ASPX needs no content.
B/ The next step is to iterate through the tabs and apply the image URL:
Here is my implemenation, my sliding zone is called 'ExploreSlidingZone' so you will need to change that to your own sliding zone name.
Call this function from code behind page_Load method.
private void TabsTextToImage() { // chrome & firefox can;t rotate text so we have to convert the tab text to image // and set the tabs to image only foreach (RadSlidingPane mypane in ExploreSlidingZone.GetPanes()) { mypane.TabView = SplitterSlidePaneTabView.ImageOnly; mypane.IconUrl = "TextToImage.aspx?size=" + mypane.Font.Size + "&text=" + mypane.Title + "&color=" + mypane.ForeColor.GetHashCode(); } }Please see attached for a snapshot of the result.
You should see your tabs with images, but they are not transparent and do not inherit the skin properties.
So if we can solve the transparency & skin issues - we will have a result!!
Best Regards
Richard Briggs