This is a migrated thread and some comments may be shown as answers.

VerticalTab control using dynamic image creation

0 Answers 53 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 27 Feb 2009, 04:39 PM
Hi,

I'm trying to get round the problem of FireFox not rendering vertical text when using the skin VericalLeft.

I've been attempting to dynamically draw an image (containing the text I want) using the .Net graphics library, and rotating the image to give me the desired affect.

I'm setting the ImageURL property of the tab to an aspx page (which takes the text on the querystring) , as follows:-

myTab.ImageURL = Page.ResolveURL(string.format("~/mypage.aspx?MyText={0}","Tab A"))

The page (mypage.aspx) then attempts to draw the image in the page load event as follows:-

 

 

Protected

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

 

Dim strText As String = Server.UrlDecode(Request.QueryString("ImageText"))

 

 

Dim sf As StringFormat = New StringFormat()

 

sf.FormatFlags = StringFormatFlags.DirectionVertical

 

Dim f As System.Drawing.Font = New System.Drawing.Font("Tahoma", 8)

 

 

Dim gText As Graphics = Graphics.FromImage(New Bitmap(1000, 1000))

 

 

Dim imageSize As SizeF = gText.MeasureString(strText, f, 25, sf)

 

 

Dim i As Image = DirectCast(New Bitmap(CType(imageSize.Width, Integer), CType(imageSize.Height, Integer)), Image)

 

 

Dim g As Graphics = Graphics.FromImage(i)

 

g.FillRectangle(Brushes.White, 0, 0, i.Width, i.Height)

 


'//flip the image 90 degrees

 

 

 

g.TranslateTransform(i.Width, i.Height)

 

 

g.RotateTransform(90.0F)

g.DrawString(strText, f, Brushes.Black, 0, 0, sf)

 

 

Response.ContentType =

"image/JPEG" 'Tell browser, what we are sending

 

 

 

i.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg)

 

 

 


End
Sub

 

 

 



I've done something similar in a page setting the src of an image control to a page that renders an image. My first attempts have not rendered corrrectly i'm just getting the missing image placeholder. Is it going to be possible to attempt this with the RadTabStrip or am I wasting my time? Perhaps I need to do something with the CSS for image sizing or something?

Cheers,
Rob.

 

No answers yet. Maybe you can help?

Tags
TabStrip
Asked by
Robert
Top achievements
Rank 1
Share this question
or