B
Barry
Hi
Can someone tell why i am not able to print the graphics text in the
following source (it is basically a copy of the ASPDraw sample from
Microsoft)
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e)
{
int width = 300;
int height = 200;
// Create a Bitmap instance
Bitmap objBitmap = new Bitmap(width, height);
Graphics objGraphics = Graphics.FromImage(objBitmap);
SolidBrush blackBrush = new SolidBrush(Color.Black);
// Put a white backround in
objGraphics.FillRectangle(new SolidBrush(Color.White), 0, 0, width,
height);
// we need to create fonts for our legend and title
Font fontLegend = new Font("Verdana", 10);
Font fontTitle = new Font("Verdana", 15, FontStyle.Bold);
int titleHeight = fontTitle.Height + 15;
// Create the title, centered
StringFormat stringFormat = new StringFormat();
stringFormat.Alignment = StringAlignment.Center;
stringFormat.LineAlignment = StringAlignment.Center;
objGraphics.DrawString("Is this Graphics", fontTitle, blackBrush,
new Rectangle(0, 0, width, titleHeight), stringFormat);
// clean up...
objGraphics.Dispose();
}
</script>
Barry
Can someone tell why i am not able to print the graphics text in the
following source (it is basically a copy of the ASPDraw sample from
Microsoft)
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e)
{
int width = 300;
int height = 200;
// Create a Bitmap instance
Bitmap objBitmap = new Bitmap(width, height);
Graphics objGraphics = Graphics.FromImage(objBitmap);
SolidBrush blackBrush = new SolidBrush(Color.Black);
// Put a white backround in
objGraphics.FillRectangle(new SolidBrush(Color.White), 0, 0, width,
height);
// we need to create fonts for our legend and title
Font fontLegend = new Font("Verdana", 10);
Font fontTitle = new Font("Verdana", 15, FontStyle.Bold);
int titleHeight = fontTitle.Height + 15;
// Create the title, centered
StringFormat stringFormat = new StringFormat();
stringFormat.Alignment = StringAlignment.Center;
stringFormat.LineAlignment = StringAlignment.Center;
objGraphics.DrawString("Is this Graphics", fontTitle, blackBrush,
new Rectangle(0, 0, width, titleHeight), stringFormat);
// clean up...
objGraphics.Dispose();
}
</script>
Barry