for(int i = 0; i <= 2; i++) { for (int j = 0; j<=2; j++) { //从数据库读一张图片,然后根据x,y的值放成3行3列 } }这个是最基本的循环呀.
<%@ Import Namespace="System.Data.SqlClient" %> <%@ Import Namespace="System.Drawing" %> <%@ Import Namespace="System.Drawing.Imaging" %> <%@ Import Namespace="System.IO" %> <script language="VB" runat="server"> Sub Page_load(Sender as Object, E as EventArgs) dim stream as new MemoryStream dim connection as SqlConnection connection=new SqlConnection("server=localhost;database=pubs;uid=sa;pwd=") try connection.Open() dim command as SqlCommand command = new SqlCommand ("select logo from pub_info where pub_id='0736'", connection) dim image as byte() image = command.ExecuteScalar () stream.Write (image, 0, image.Length) dim imgbitmap as bitmap imgbitmap = new Bitmap (stream) Response.ContentType = "image/gif" imgbitmap.Save (Response.OutputStream, ImageFormat.Gif) Finally connection.Close() stream.Clse() End Try End Sub </script>
你可以用GDI+在不同的位置绘制
先把图片从数据库中取出放入DataSet中 byte[] buffer = DataSet.Table.Rows[0 ][ 0 ] as byte[]; MemoryStream ms = new MemoryStream( buffer ); PictureBox.Image= Image.FromStream( ms );
----->
如何从数据库读取数据?
如果这些数据是图片有什么不同吗?
要按3行3列排列9个控件,使用什么作为父控件来承载好点?
最后,合起来.
{
for (int j = 0; j<=2; j++)
{
//从数据库读一张图片,然后根据x,y的值放成3行3列
}
}这个是最基本的循环呀.
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
Sub Page_load(Sender as Object, E as EventArgs)
dim stream as new MemoryStream
dim connection as SqlConnection
connection=new SqlConnection("server=localhost;database=pubs;uid=sa;pwd=")
try
connection.Open()
dim command as SqlCommand
command = new SqlCommand ("select logo from pub_info where pub_id='0736'", connection)
dim image as byte()
image = command.ExecuteScalar ()
stream.Write (image, 0, image.Length)
dim imgbitmap as bitmap
imgbitmap = new Bitmap (stream)
Response.ContentType = "image/gif"
imgbitmap.Save (Response.OutputStream, ImageFormat.Gif)
Finally
connection.Close()
stream.Clse()
End Try
End Sub
</script>
byte[] buffer = DataSet.Table.Rows[0 ][ 0 ] as byte[];
MemoryStream ms = new MemoryStream( buffer );
PictureBox.Image= Image.FromStream( ms );