Hi
i developed one diagram as a user control in asp.net web application
this diagram i want to use in my web app in defalut.aspx page i want this diagram in center and this diagram code i want to assign one particular asp.net control how to do center position first?
later how to assign to 1 asp.net control.?
my user control(.ascx.cs) code:
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
Bitmap objBitmap;
Graphics objGraphics;
objBitmap = new Bitmap(1000, 1000);
objGraphics = Graphics.FromImage(objBitmap);
objGraphics.Clear(Color.White);
Pen p = new Pen(Color.Red, 0);
Rectangle rect = new Rectangle(10, 10, 280, 280);
objGraphics.DrawRectangle(p, rect);
objGraphics.DrawEllipse(p, rect);
objGraphics.DrawLine(p, 500, 60, 480, 60);
Brush b1 = new SolidBrush(Color.Red);
Brush b2 = new SolidBrush(Color.Green);
Brush b3 = new SolidBrush(Color.Blue);
objGraphics.FillPie(b1, rect, 0f, 60f);
FontFamily fontfml = new FontFamily(GenericFontFamilies.Serif);
Font font = new Font(fontfml, 16);
SolidBrush brush = new SolidBrush(Color.Blue);
objGraphics.DrawString("Drawing Graphics", font, brush, 70, 300);
objBitmap.Save(Response.OutputStream, ImageFormat.Gif);
objBitmap.Save(Server.MapPath("x.jpg"), ImageFormat.Jpeg);
objBitmap.Dispose();
objGraphics.Dispose();
}
}
Namespaces:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Drawing.Design;
using System.Web.UI.WebControls.Adapters;
and my .aspx code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register src="Graph.ascx" tagname="Graph" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
width: 964px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div align="Center">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<table align="Center">
<tr>
<td align="Center">
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
<uc1:Graph ID="Graph1" runat="server" />
</asp:View>
</asp:MultiView>
</td>
<td>
</td>
</tr>
<tr>
<td class="style2">
</td>
<td style="">
</td>
</tr>
</table>
</div>
</form>
</body>
</html>