Click here to Skip to main content
15,913,570 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionOpening a new page in another frame. Pin
Rajiya26-Jul-06 18:54
Rajiya26-Jul-06 18:54 
AnswerRe: Opening a new page in another frame. Pin
minhpc_bk26-Jul-06 19:50
minhpc_bk26-Jul-06 19:50 
GeneralRe: Opening a new page in another frame. Pin
Rajiya26-Jul-06 20:34
Rajiya26-Jul-06 20:34 
GeneralRe: Opening a new page in another frame. Pin
minhpc_bk26-Jul-06 21:13
minhpc_bk26-Jul-06 21:13 
AnswerRe: Opening a new page in another frame. Pin
Ista27-Jul-06 4:15
Ista27-Jul-06 4:15 
QuestionTrick question:after download prompt, how to make the page postback? Pin
addict_li26-Jul-06 17:16
addict_li26-Jul-06 17:16 
AnswerRe: Trick question:after download prompt, how to make the page postback? Pin
minhpc_bk26-Jul-06 19:53
minhpc_bk26-Jul-06 19:53 
Questioniframe in asp.net Pin
porsche996turbo26-Jul-06 15:51
porsche996turbo26-Jul-06 15:51 
i have a page wherein an iframe is in it.. the page simply zooms the image in the iframe.. the zoom out and zoom in is outside the iframe.. how can i access the image in the iframe??

this is the main page
Public Class pgViewImage<br />
    Inherits System.Web.UI.Page<br />
<br />
    Private msLoc As String = "C:\Inetpub\wwwroot\MetSysClient\Images\"<br />
    Private sImageName As String = "car"<br />
<br />
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
        'Put user code to initialize the page here<br />
<br />
        Dim ShowImage As HtmlControl = CType(Me.FindControl("ShowImage"), HtmlControl)<br />
        Dim btnMainImage As WebControl = CType(ShowImage.FindControl("btnMainImage"), WebControl)<br />
<br />
        If Not IsPostBack Then<br />
<br />
            'On the first page load, we need to know <br />
            'the original image's size and get the <br />
            'center x and y coordinates<br />
<br />
            Dim i As System.Drawing.Image = _<br />
            System.Drawing.Image.FromFile(msLoc & sImageName & ".jpg")<br />
            ImageWidth = i.Width<br />
            ImageHeight = i.Height<br />
            X = CInt(ImageWidth / 2)<br />
            Y = CInt(ImageHeight / 2)<br />
            Z = 1<br />
            i.Dispose()<br />
            getimage()<br />
<br />
        End If<br />
<br />
    End Sub<br />
<br />
    Private Sub btnMainImage_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)<br />
        If Z = 1 Then<br />
            X = e.X<br />
            Y = e.Y<br />
            Z = 2<br />
        Else<br />
            X = CInt(hx.Value) - CInt((CInt(ImageWidth / 2) - e.X) / Z)<br />
            Y = CInt(hy.Value) - CInt((CInt(ImageHeight / 2) - e.Y) / Z)<br />
        End If<br />
        getimage()<br />
    End Sub<br />
<br />
    Private Sub btnLeft_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)<br />
        X = X - 20<br />
        getimage()<br />
    End Sub<br />
<br />
    Private Sub btnRight_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)<br />
        X = X + 20<br />
        getimage()<br />
    End Sub<br />
<br />
    Private Sub btnUp_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)<br />
        Y = Y - 20<br />
        getimage()<br />
    End Sub<br />
<br />
    Private Sub btnDown_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)<br />
        Y = Y + 20<br />
        getimage()<br />
    End Sub<br />
<br />
    Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)<br />
        X = CInt(ImageWidth / 2)<br />
        Y = CInt(ImageHeight / 2)<br />
        Z = 1<br />
        getimage()<br />
    End Sub<br />
<br />
    Private Sub cmdZoomIn_Click(ByVal sender As System.Object, ByVal e As _<br />
    System.EventArgs) Handles cmdZoomIn.Click<br />
        If Z < 8 Then<br />
            Z = Z * 2<br />
        End If<br />
<br />
        getimage()<br />
    End Sub<br />
<br />
    Private Sub cmdZoomOut_Click(ByVal sender As System.Object, ByVal e As _<br />
    System.EventArgs) Handles cmdZoomOut.Click<br />
        If Z > 1 Then<br />
            Z = CInt(Z / 2)<br />
        End If<br />
        getimage()<br />
    End Sub<br />
<br />
    Public Sub getimage()<br />
        Dim srcx, srcy As Integer<br />
<br />
<br />
        'Convert X Value to Top Left of image<br />
        srcx = X - CInt(CInt(ImageWidth / 2) / Z)<br />
        If srcx < 0 Then srcx = 0<br />
        If srcx > ImageWidth Then srcx = ImageWidth<br />
<br />
        'Convert Y value to Top Left of Image<br />
        srcy = Y - CInt(CInt(ImageHeight / 2) / Z)<br />
        If srcy < 0 Then srcy = 0<br />
        If srcy > ImageHeight Then srcy = ImageHeight<br />
<br />
        'Set the source of the Image to be our Processing aspx page<br />
<br />
        'btnMainImage.ImageUrl = "pgZoomProcessor.aspx?x=" & srcx & _<br />
        '"&y=" & srcy & "&z=" & Z & "&img=" & sImageName<br />
<br />
        hx.Value = X.ToString<br />
        hy.Value = Y.ToString<br />
<br />
        'Enable/disable buttons<br />
<br />
<br />
        If Z = 8 Then<br />
            cmdZoomIn.Enabled = False<br />
        Else<br />
            cmdZoomIn.Enabled = True<br />
        End If<br />
<br />
    End Sub<br />
<br />
    Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _<br />
                            Handles cmdClose.Click<br />
        Dim script(1) As String<br />
<br />
        script(1) = "<script> self.close() </script>"<br />
        RegisterClientScriptBlock("test", Join(script, ""))<br />
<br />
    End Sub<br />
<br />
<br />
End Class<br />
<br />




this is the page that the iframe calls:
<br />
Public Class pgImage<br />
    Inherits System.Web.UI.Page<br />
<br />
    Private msLoc As String = "C:\Inetpub\wwwroot\MetSysClient\Images\"<br />
    Private sImageName As String = "biglogo"<br />
<br />
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
        'Put user code to initialize the page here<br />
<br />
        If Not IsPostBack Then<br />
<br />
            'On the first page load, we need to know <br />
            'the original image's size and get the <br />
            'center x and y coordinates<br />
            Dim i As System.Drawing.Image = _<br />
            System.Drawing.Image.FromFile(msLoc & sImageName & ".jpg")<br />
            ImageWidth = i.Width<br />
            ImageHeight = i.Height<br />
            X = CInt(ImageWidth / 2)<br />
            Y = CInt(ImageHeight / 2)<br />
            Z = 1<br />
            i.Dispose()<br />
            getimage()<br />
<br />
        End If<br />
    End Sub<br />
<br />
    Private Sub btnMainImage_Click(ByVal sender As System.Object, ByVal e As _<br />
    System.Web.UI.ImageClickEventArgs) Handles btnMainImage.Click<br />
        If Z = 1 Then<br />
            X = e.X<br />
            Y = e.Y<br />
            Z = 2<br />
        Else<br />
            X = CInt(hx.Value) - CInt((CInt(ImageWidth / 2) - e.X) / Z)<br />
            Y = CInt(hy.Value) - CInt((CInt(ImageHeight / 2) - e.Y) / Z)<br />
        End If<br />
        getimage()<br />
    End Sub<br />
<br />
    Public Sub getimage()<br />
        Dim srcx, srcy As Integer<br />
<br />
        'Convert X Value to Top Left of image<br />
        srcx = X - CInt(CInt(ImageWidth / 2) / Z)<br />
        If srcx < 0 Then srcx = 0<br />
        If srcx > ImageWidth Then srcx = ImageWidth<br />
<br />
        'Convert Y value to Top Left of Image<br />
        srcy = Y - CInt(CInt(ImageHeight / 2) / Z)<br />
        If srcy < 0 Then srcy = 0<br />
        If srcy > ImageHeight Then srcy = ImageHeight<br />
<br />
        'Set the source of the Image to be our Processing aspx page<br />
<br />
        btnMainImage.ImageUrl = "pgZoomProcessor.aspx?x=" & srcx & _<br />
        "&y=" & srcy & "&z=" & Z & "&img=" & sImageName<br />
        hx.Value = X.ToString<br />
        hy.Value = Y.ToString<br />
<br />
        'Enable/disable buttons<br />
<br />
        'If Z = 8 Then<br />
        '    cmdZoomIn.Enabled = False<br />
        'Else<br />
        '    cmdZoomIn.Enabled = True<br />
        'End If<br />
<br />
    End Sub<br />
<br />
    Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)<br />
        Dim script(1) As String<br />
<br />
        script(1) = "<script> self.close() </script>"<br />
        RegisterClientScriptBlock("test", Join(script, ""))<br />
<br />
    End Sub<br />
End Class<br />



this is the page for the processing of the image:

<br />
Public Class pgZoomProcessor<br />
    Inherits System.Web.UI.Page<br />
<br />
    Private msLoc As String = "C:\Inetpub\wwwroot\MetSysClient\Images\"<br />
<br />
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As _<br />
        System.EventArgs) Handles MyBase.Load<br />
<br />
        'Create a new Image object from our source image<br />
        Dim i As System.Drawing.Image = _<br />
        System.Drawing.Image.FromFile(msLoc & Request("img") & ".jpg")<br />
<br />
        'System.Drawing.Image.FromFile(Server.MapPath("./" _<br />
        '& Request("img") & ".jpg"))<br />
<br />
<br />
        'Create a workable bitmap image<br />
        Dim b As New System.Drawing.Bitmap(CInt(i.Width), _<br />
        CInt(i.Height), System.Drawing.Imaging.PixelFormat.Format24bppRgb)<br />
<br />
        'Place the bitmap image in a Graphics object<br />
        Dim g As Graphics = Graphics.FromImage(b)<br />
<br />
        'Set the default image background color <br />
        g.Clear(Color.White)<br />
<br />
        'Crop the main image<br />
        'Get Coordinates and Zoom Values from querystring<br />
        Dim x As Integer = CInt(Request("X"))<br />
        Dim Y As Integer = CInt(Request("y"))<br />
        Dim Z As Integer = CInt(Request("z"))<br />
        'Create 2 rectangles.  We can grab a rectangle portion<br />
        'of the original image and stretch it to fit the size<br />
        'of the larger rectangle.<br />
        Dim src As New Rectangle<br />
        Dim dst As New Rectangle<br />
<br />
        'Set Source rectangle properties<br />
        src.X = x<br />
        src.Y = Y<br />
        src.Width = CInt(i.Width / Z)<br />
        src.Height = CInt(i.Height / Z)<br />
<br />
        'Set Destination rectangle properties<br />
        dst.X = 0<br />
        dst.Y = 0<br />
        dst.Width = CInt(i.Width)<br />
        dst.Height = CInt(i.Height)<br />
<br />
        'Create the image from our rectangles<br />
        g.DrawImage(i, dst, src, GraphicsUnit.Pixel)<br />
<br />
        'Set the content type  <br />
        Response.ContentType = "image/jpeg"<br />
<br />
        'Save the image as the Output of this page <br />
        b.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)<br />
<br />
        'Clean Up<br />
        src = Nothing<br />
        dst = Nothing<br />
        g = Nothing<br />
        b = Nothing<br />
        i = Nothing<br />
    End Sub<br />
<br />
End Class<br />
<br />



anyone know how to solve this?
thanks...
AnswerRe: iframe in asp.net Pin
Ista27-Jul-06 4:16
Ista27-Jul-06 4:16 
QuestionHi , is there any autosize proprety within the gridview ? [modified] Pin
Mohammed Amine26-Jul-06 13:49
Mohammed Amine26-Jul-06 13:49 
QuestionGlobal.asax problem Pin
TheMajorRager26-Jul-06 11:58
TheMajorRager26-Jul-06 11:58 
AnswerRe: Global.asax problem Pin
minhpc_bk26-Jul-06 20:00
minhpc_bk26-Jul-06 20:00 
QuestionDatagrid row color (back to original) Pin
B Desai26-Jul-06 11:31
B Desai26-Jul-06 11:31 
AnswerRe: Datagrid row color (back to original) Pin
postmaster@programmingknowledge.com26-Jul-06 17:15
postmaster@programmingknowledge.com26-Jul-06 17:15 
GeneralRe: Datagrid row color (back to original) Pin
B Desai26-Jul-06 17:25
B Desai26-Jul-06 17:25 
GeneralRe: Datagrid row color (back to original) Pin
enjoycrack29-Jul-06 6:06
enjoycrack29-Jul-06 6:06 
QuestionUsing custom classes with the GridView Pin
Ista26-Jul-06 9:21
Ista26-Jul-06 9:21 
JokeRe: Has anyone tied classes to the GidView or DetailsView Pin
ToddHileHoffer26-Jul-06 9:34
ToddHileHoffer26-Jul-06 9:34 
GeneralRe: Has anyone tied classes to the GidView or DetailsView [modified] Pin
Ista26-Jul-06 9:50
Ista26-Jul-06 9:50 
AnswerRe: Has anyone tied classes to the GidView or DetailsView Pin
eggsovereasy26-Jul-06 9:49
eggsovereasy26-Jul-06 9:49 
GeneralRe: Has anyone tied classes to the GidView or DetailsView Pin
eggsovereasy26-Jul-06 9:49
eggsovereasy26-Jul-06 9:49 
GeneralRe: Has anyone tied classes to the GidView or DetailsView Pin
Ista26-Jul-06 9:50
Ista26-Jul-06 9:50 
AnswerRe: Using custom classes with the GridView Pin
Paddy Boyd26-Jul-06 22:24
Paddy Boyd26-Jul-06 22:24 
GeneralRe: Using custom classes with the GridView Pin
Ista27-Jul-06 2:46
Ista27-Jul-06 2:46 
GeneralRe: Using custom classes with the GridView Pin
Paddy Boyd27-Jul-06 5:03
Paddy Boyd27-Jul-06 5:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.