locked
TextureBrushes RRS feed

  • Question

  • User-539484920 posted

    Hi,

    How to do the TextureBrushes  concepts in asp.net with c#?

    any suggestion.

     

    Thanks

     

     

    Thursday, April 16, 2009 4:13 AM

Answers

  • User-1659704165 posted

    Hi,

    I wound Not save the file On Your hard Disk..

     It will create Image At runtime on Your aspx page..

    Hope it helps

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 16, 2009 7:54 AM

All replies

  • User-1659704165 posted

    Hi,

     

    Hi,


    <%@ Page Language="vb" %> 
     <%@ import namespace="system.drawing" %> 
     <%@ import namespace="system.drawing.imaging" %> 
     <%@ import namespace="system.drawing.drawing2d" %> 
     <% 
     
     ' initialise objects 
     dim b as New system.drawing.bitmap(400, 100, pixelformat.Format16bppRgb555) 
     dim salign as New system.drawing.stringformat 
     dim g as graphics = graphics.fromimage(b) 
     g.smoothingMode = smoothingMode.antiAlias ' antialias objects 
     
     g.clear(color.silver) ' blank the image 
     
     
     g.FillRectangle(New linearGradientBrush(New point(0,0), New point(b.width,b.height), color.fromArgb(255,255,255,255),color.fromArgb(100,100,100,100)),0,0,b.width,b.height)   
     ' shadow text 
     salign.alignment = stringalignment.center 
     
     dim i as System.Drawing.Image 
     dim strFilename as String = server.mappath("../chris-fsck.jpg") 
     i = System.Drawing.Image.FromFile(strFilename) 
     
     dim myBrush as New TextureBrush(i) 
     
     g.drawString(date.now.ToString("T"), New font("arial black",40,fontstyle.italic),Brushes.black, 203,23, salign) 
     g.drawString(date.now.ToString("T"), New font("arial black",40,fontstyle.italic),Brushes.white, 201,21, salign) 
     g.drawString(date.now.ToString("T"), New font("arial black",40,fontstyle.italic),myBrush, 202,22, salign) 
     
     
     ' centered text 
     salign.alignment = stringalignment.center 
     
     ' Set the content type 
     response.contenttype="image/jpeg" 
     
     ' send the image to the viewer 
     b.save(response.outputstream, imageformat.jpeg) 
       ' tidy up 
     b.dispose() 
     
     %> 

    Check Code Above

     

    Hope It helps 

     

     

    Thursday, April 16, 2009 5:25 AM
  • User-539484920 posted

     HI,

    many thanks,

    i tried your code.it shown "Exception Details: System.Web.HttpException: 'C:\img1\1.jpg' is not a valid virtual path." from this statement of code "dim strFilename as String = server.mappath("~\1.jpg") "
    so i modified this statement like

    Dim imgPath As String
    imgPath  = "C:\img1\1.jpg"
    Dim i As System.Drawing.Image
    Dim strFilename As String = imgPath
    i = System.Drawing.Image.FromFile(strFilename)

    but it shown dummy values only  i could not see any output.

    any idea please

    Thursday, April 16, 2009 7:02 AM
  • User-1659704165 posted

    Hi,

    I wound Not save the file On Your hard Disk..

     It will create Image At runtime on Your aspx page..

    Hope it helps

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 16, 2009 7:54 AM