Hi Trint and CJ,
I was curious if I could do it.
It is a webclock with full serverside aspx
Not the problem from Trint but to let a serverside status go on the
clientside.
I asking myself if you will be happy with it, but it works.
I have used a clock, it will it give of course in the regional settings
notation from the serverside, while when Trint want to use as a solution for
his problem, I think that he minimal has to add something as cookies in the
second page to identify the startstatus and endstatus of the client who ask
again and again that image.
But I am a little bit proud on this sample, so I show it you (I think I can
make that bitmap nicer but maybe I replace it with a real classic clock, I
think that is even nicer)..
Cor
\\\Form 1 Needs an imagebox on the page the project should be named
"WebClock".
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.Image1.Height = New Unit(32)
Me.Image1.Width = New Unit(200)
Image1.Visible = True
Dim scriptString As String = "<script language=JavaScript>" & _
"setclock(); function setclock(){document.images.Image1.src = " & _
"'
http://localhost/WebClock/WebForm2.aspx';setTimeout('setclock()',1000)}</s
cript>"
Page.RegisterStartupScript("setclock", scriptString)
End Sub
///
\\\Form2 needs nothing
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim myForeBrush As Brush = Brushes.Black
Dim myFont As New Font("Times New Roman", 8, FontStyle.Regular)
Dim textHeight As Single
Dim bm As New Bitmap(120, 20)
Dim g As Graphics = Graphics.FromImage(bm)
g.Clear(Color.White)
Dim textSize As SizeF = g.MeasureString("now.tostring", myFont)
g.DrawString(Now.ToString, myFont, myForeBrush, _
New RectangleF(0, 0, 120, 20))
Dim ms As New IO.MemoryStream
Dim arrImage() As Byte
bm.Save(ms, Imaging.ImageFormat.Bmp)
arrImage = ms.GetBuffer
Response.BinaryWrite(arrImage)
End Sub
///