1) add the converter in web.config (BitmapConverter is not installed
by default):
<ajaxNet>
<ajaxSettings>
<jsonConverters>
<add type="AjaxPro.BitmapConverter,AjaxPro.2"/>
</jsonConverters>
</ajaxSettings>
</ajaxNet>
2) add a new location tag to add a new image handler:
<location path="ajaximage">
<system.web>
<httpHandlers>
<add verb="GET" path="*.ashx"
type="AjaxPro.AjaxBitmapHttpHandler,AjaxPro.2"/>
</httpHandlers>
</system.web>
</location>
3) create you AjaxMethod:
[AjaxPro.AjaxMethod]
public static Bitmap MyBitmapTest()
{
Bitmap bmp = new Bitmap(300, 80);
Graphics g = Graphics.FromImage(bmp);
g.FillRectangle(new SolidBrush(Color.YellowGreen), 0, 0, 300, 80);
g.DrawRectangle(new Pen(new SolidBrush(Color.Black)), 0, 0, 299, 79);
g.DrawString("Hello World!",
new Font("Courier New", 8),
new SolidBrush(Color.Blue), 10, 40);
return bmp;
}
4) On the client-side call the MyBitmapTest method and use following
code in the callback:
function callback(res) {
document.getElementById("image1").src = res.value.src;
}
or
function callback(res) {
document.body.appendChild(res.value.getImage());
}
For a online demo open
http://munich.schwarz-interactive.de/datatype.aspx and click on <Run
Test...>!
--
Best regards | Schöne Grüße
Michael
Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer
http://weblogs.asp.net/mschwarz/
http://www.schwarz-interactive.de/
mailto:[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---