| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 464 人关注过本帖
标题:aspx 文件中定义控件不可见
只看楼主 加入收藏
cxherocx
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-10-19
收藏
 问题点数:0 回复次数:1 
aspx 文件中定义控件不可见
我在隐藏文件cs中的Page_Load函数中 如下,定义画图行为,
 protected void Page_Load(object sender, EventArgs e)
    {
          Bitmap bmp = new Bitmap(
            width, height, PixelFormat.Format24bppRgb);
        Graphics g = Graphics.FromImage(bmp);



        // Save the bitmap to the response stream and
        // convert it to JPEG format.
      bmp.Save(Response.OutputStream, ImageFormat.Jpeg);

        // Release memory used by the Graphics object
        // and the bitmap.
        g.Dispose();
        bmp.Dispose();
    }

当函数Page_Load 执行后,aspx文件中定义的其他控件都不可见了,我查找后 发现如果将 bmp.Save(Response.OutputStream, ImageFormat.Jpeg)注释后,aspx文件中定义的其他控件 可以操作了,这是为什么,是不是和Response.OutputStream 有关,请大侠赐教!!
搜索更多相关主题的帖子: 控件 aspx 定义 文件 
2010-10-19 17:31
cxherocx
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-10-19
收藏
得分:0 
我把具体代码放到这里,大家看看
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Import Namespace = "System.Drawing" %>
<%@ Import Namespace = "System.Drawing.Imaging" %>
<%@ Import Namespace = "System.Drawing.Drawing2D" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.

<script runat="server">
  protected void Page_Load(object sender, EventArgs e)
    {
 
        // Create a font style.
        Font rectangleFont = new Font(
            "Arial", 10, FontStyle.Bold);

        // Create integer variables.
        int height = 100;
        int width = 200;

        // Create a bitmap and use it to create a
        // Graphics object.
        Bitmap bmp = new Bitmap(
            width, height, PixelFormat.Format24bppRgb);
        Graphics g = Graphics.FromImage(bmp);

        g.SmoothingMode = SmoothingMode.AntiAlias;
        g.Clear(Color.LightGray);

        // Use the Graphics object to draw three rectangles.
        g.DrawRectangle(Pens.White, 1, 1, width - 3, height - 3);
        g.DrawRectangle(Pens.Aquamarine, 2, 2, width - 3, height - 3);
        g.DrawRectangle(Pens.Black, 0, 0, width, height);

        // Use the Graphics object to write a string
        // on the rectangles.
        g.DrawString(
            " Samples", rectangleFont,
            SystemBrushes.WindowText, new PointF(10, 40));


        // Save the bitmap to the response stream and
        // convert it to JPEG format.
        bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
      
        // Release memory used by the Graphics object
        // and the bitmap.
        g.Dispose();
        bmp.Dispose();

     

    }
</script>
<html xmlns="http://www. >
<head id="Head1" runat="server">
    <title>CheckBox Control</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h1>CheckBox Control</h1>
         <asp:Label ID="lblTime" runat="server" OnInit="lblTime_Init" />
         <br />
         <br />
         <asp:CheckBox ID="chkUnderLine" runat="server" AutoPostBack="True" Text="Underline?" TextAlign="Left" OnCheckedChanged="chkUnderLine_CheckedChanged" />
         <asp:CheckBox ID="chkOverLine" runat="server" AutoPostBack="True" Text="Overline?" OnCheckedChanged="chkOverLine_CheckedChanged" />
         <asp:CheckBox ID="chkStrikeout" runat="server" AutoPostBack="True" Text="Strikeout?" OnCheckedChanged="chkStrikeout_CheckedChanged" />
   
    </div>
    </form>
</body>
</html>
这个代码中的 CheckBox都不可见了,怎么回事?
2010-10-19 19:17
快速回复:aspx 文件中定义控件不可见
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.038918 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved