当前位置: 首页>>代码示例>>C#>>正文


C# WebControls.Image类代码示例

本文整理汇总了C#中System.Web.UI.WebControls.Image的典型用法代码示例。如果您正苦于以下问题:C# Image类的具体用法?C# Image怎么用?C# Image使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Image类属于System.Web.UI.WebControls命名空间,在下文中一共展示了Image类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: gridGAC_RowDataBound

    protected void gridGAC_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (e.Row.Cells.Count > 3)
            {
                // Last modified on is in Column - 3, index starts at 0.
                int compare = System.DateTime.Compare(DateTime.Parse(e.Row.Cells[2].Text), System.DateTime.Today);

                if (compare > 0)
                {
                    System.Web.UI.WebControls.Image tickImage = new System.Web.UI.WebControls.Image();
                    tickImage.ImageUrl = "~/Images/tick-circle-frame-icon.png";
                    tickImage.ToolTip = "This DLL was installed into GAC today.";

                    e.Row.Cells[0].Controls.Add(tickImage);
                    e.Row.Cells[1].ForeColor = Color.Teal;
                    e.Row.Cells[2].ForeColor = Color.Teal;
                    e.Row.Cells[3].ForeColor = Color.Teal;
                }
            }

            if (e.Row.Cells.Count > 0)
            {
                if (e.Row.Cells[0].Text.Contains(identifier))
                {
                    e.Row.Cells[0].ForeColor = Color.Red;
                    e.Row.Cells[1].ForeColor = Color.Red;
                    e.Row.Cells[2].ForeColor = Color.Red;
                    e.Row.Cells[3].ForeColor = Color.Red;
                }
            }
        }
    }
开发者ID:navkar,项目名称:BizTalkControlCenter,代码行数:34,代码来源:DV.aspx.cs

示例2: cmdCreate_Click

    protected void cmdCreate_Click(object sender, System.EventArgs e)
    {
        tbl.Controls.Clear();

        int rows = Int32.Parse(txtRows.Text);
        int cols = Int32.Parse(txtCols.Text);

        for (int i = 0; i < rows; i++)
        {
            TableRow rowNew = new TableRow();
            tbl.Controls.Add(rowNew);
            for (int j = 0; j < cols; j++)
            {
                TableCell cellNew = new TableCell();
                Label lblNew = new Label();
                lblNew.Text = "(" + i.ToString() + "," + j.ToString() + ")<br />";

                System.Web.UI.WebControls.Image imgNew = new System.Web.UI.WebControls.Image();
                imgNew.ImageUrl = "cellpic.png";

                cellNew.Controls.Add(lblNew);
                cellNew.Controls.Add(imgNew);

                if (chkBorder.Checked == true)
                {
                    cellNew.BorderStyle = BorderStyle.Inset;
                    cellNew.BorderWidth = Unit.Pixel(1);
                }

                rowNew.Controls.Add(cellNew);
            }
        }
    }
开发者ID:njmube,项目名称:ErpBapSoftNet_Producion,代码行数:33,代码来源:Default3.aspx.cs

示例3: buildAlertImage

        public static System.Web.UI.WebControls.Image buildAlertImage(AlertLevel level)
        {
            System.Web.UI.WebControls.Image res = new System.Web.UI.WebControls.Image();

            switch (level)
            {
                case AlertLevel.None:
                    res.ImageUrl = "~/img/ok.png";
                    res.AlternateText = "OK";
                    break;
                case AlertLevel.Warning:
                    res.ImageUrl = "~/img/warning.png";
                    res.AlternateText = "Warning";
                    break;
                case AlertLevel.Critical:
                default:
                    res.ImageUrl = "~/img/critical.png";
                    res.AlternateText = "Critical";
                    break;
            }

            res.BorderWidth = 0;
            res.Style["vertical-align"] = "middle";

            return res;
        }
开发者ID:ahorn,项目名称:z3test,代码行数:26,代码来源:Default.aspx.cs

示例4: SetSortImageStates

        /// <summary>
        /// Sets the sort image states.
        /// </summary>
        /// <param name="gridView">The grid view.</param>
        /// <param name="row">The row.</param>
        /// <param name="columnStartIndex"> </param>
        /// <param name="sortField">The sort field.</param>
        /// <param name="sortAscending">if set to <c>true</c> [sort ascending].</param>
        public static void SetSortImageStates(GridView gridView, GridViewRow row,int columnStartIndex, string sortField, bool sortAscending)
        {
            for (var i = columnStartIndex; i < row.Cells.Count; i++)
            {
                var tc = row.Cells[i];
                if (!tc.HasControls()) continue;

                // search for the header link  
                var lnk = tc.Controls[0] as LinkButton;
                if (lnk == null) continue;

                // initialize a new image
                var img = new Image
                {
                    ImageUrl = string.Format("~/images/{0}.png", (sortAscending ? "bullet_arrow_up" : "bullet_arrow_down")),
                    CssClass = "icon"
                };

                // setting the dynamically URL of the image
                // checking if the header link is the user's choice
                if (sortField == lnk.CommandArgument)
                {
                    // adding a space and the image to the header link
                    //tc.Controls.Add(new LiteralControl(" "));
                    tc.Controls.Add(img);
                }
            }
        }
开发者ID:ChuckLafferty,项目名称:bugnet,代码行数:36,代码来源:PresentationUtils.cs

示例5: Render

        public IEnumerable<object> Render(PanelItem panelItem)
        {
            if (panelItem.Type == PanelItemType.Image)
            {
                var image = new Image { ID = panelItem.GetId(), Enabled = false, Width = new Unit(panelItem.Width, UnitType.Pixel), CssClass = ItemStyle };

                panelItem.Target = image;

                return new object[] { image };
            }
            if (panelItem.Type == PanelItemType.InfoIcon)
            {
                var image = new Image
                {
                    ID = panelItem.GetId(),
                    ImageUrl = @"../images/info.png",
                    ToolTip = ResourceManager.GetString(panelItem.Text.IsNullOrEmpty() ? panelItem.GetPropertyName() + "Info" : panelItem.Text),
                    Enabled = false,
                    Width = new Unit(panelItem.Width, UnitType.Pixel),
                    CssClass = ItemStyle
                };

                panelItem.Target = image;

                return new object[] { image };
            }

            return null;
        }
开发者ID:erwinbovendeur,项目名称:ADF,代码行数:29,代码来源:ImageRenderer.cs

示例6: GetImagesPanel

        /// <summary>
        /// Gets a panel with all the image elements from a device within it.
        /// </summary>
        /// <param name="images"></param>
        /// <returns></returns>
        internal static Panel GetImagesPanel(KeyValuePair<string, Uri>[] images)
        {
            if (images != null)
            {
                Panel panel = new Panel();
                foreach (var hardwareImage in images)
                {
                    Panel item = new Panel();
                    item.Style.Add("float", "left");

                    Panel imagePanel = new Panel();

                    System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
                    image.ImageUrl = hardwareImage.Value.ToString();
                    image.Height = 128;
                    image.Width = 128;
                    imagePanel.Controls.Add(image);


                    Literal caption = new Literal();

                    caption.Text = String.Format("<h4 class=\"deviceImageCaption\">{0}</h4>", hardwareImage.Key);

                    item.Controls.Add(imagePanel);
                    item.Controls.Add(caption);

                    panel.Controls.Add(item);
                }
                return panel;
            }
            else
                return null;
        }
开发者ID:axle-h,项目名称:.NET-Device-Detection,代码行数:38,代码来源:DeviceImages.cs

示例7: Render

    protected override void Render(HtmlTextWriter output)
    {
      Assert.ArgumentNotNull(output, nameof(output));

      base.Render(output);

      //render other control
      var value = GetValue();

     
      if (!string.IsNullOrEmpty(value))
      {
        //get lat lng
        var position = value.Split(',');

        if (position.Count() == 2)
        {
          double lat = 0;
          double lng = 0;

          double.TryParse(position[0], out lat);
          double.TryParse(position[1], out lng);

          var mapImageCtrl = new Image();
          mapImageCtrl.ID = ID + "_Img_MapView";
          mapImageCtrl.CssClass = "imageMapView";
          mapImageCtrl.Width = mapWidth;
          mapImageCtrl.Height = mapHeight;
          mapImageCtrl.ImageUrl = GetMapImageUrl();
          mapImageCtrl.Style.Add("padding-top", "5px");

          mapImageCtrl.RenderControl(output);
        }     
      }
    }
开发者ID:chiragp,项目名称:Habitat,代码行数:35,代码来源:MapField.cs

示例8: lnkDownload_Click

 protected void lnkDownload_Click(object sender, EventArgs e)
 {
     System.Web.UI.WebControls.Image objImg = new System.Web.UI.WebControls.Image();
     objImg.
     objImg. = "handlethings.ashx?op=imagednld";
     Bitmap bmp2 = new Bitmap(objImg);
 }
开发者ID:sathi-natarajan,项目名称:WebAppSamples_CSharp,代码行数:7,代码来源:DownloadImages.aspx.cs

示例9: SetSortImageStates

        /// <summary>
        /// Sets the sort image states.
        /// </summary>
        /// <param name="gridView">The grid view.</param>
        /// <param name="row">The row.</param>
        /// <param name="sortField">The sort field.</param>
        /// <param name="sortAscending">if set to <c>true</c> [sort ascending].</param>
        public static void SetSortImageStates(GridView gridView, GridViewRow row,int columnStartIndex, string sortField, bool sortAscending)
        {
            for (int i = columnStartIndex; i < row.Cells.Count; i++)
            {
                TableCell tc = row.Cells[i];
                if (tc.HasControls())
                {
                    // search for the header link
                    LinkButton lnk = (LinkButton)tc.Controls[0];
                    if (lnk != null)
                    {
                        // initialize a new image
                        System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
                        // setting the dynamically URL of the image
                        img.ImageUrl = "~/images/" + (sortAscending ? "bullet_arrow_up" : "bullet_arrow_down") + ".png";
                        img.CssClass = "icon";
                        // checking if the header link is the user's choice
                        if (sortField == lnk.CommandArgument)
                        {
                            // adding a space and the image to the header link
                            //tc.Controls.Add(new LiteralControl(" "));
                            tc.Controls.Add(img);
                        }

                    }
                }
            }
        }
开发者ID:JackyW83,项目名称:Test,代码行数:35,代码来源:PresentationUtils.cs

示例10: MakeBracketCell

        /// <summary>
        /// Makes a bracket cell for a row.
        /// </summary>
        /// <param name="team">The team corressponding to the row the cell is being
        /// placed in.</param>
        /// <returns>The Bracket cell for the row.</returns>
        private TableCell MakeBracketCell(ContestTeam team)
        {
            TableCell bracketCell = new TableCell();
            bracketCell.HorizontalAlign = HorizontalAlign.Center;

            System.Web.UI.WebControls.Image bracketImage = new System.Web.UI.WebControls.Image();
            bracketImage.Width = new Unit("25px");
            bracketImage.Height = new Unit("25px");
            bracketImage.ImageAlign = ImageAlign.Middle;

            if (team.Bracket == (int)ContestBracket.Bronze)
            {
                bracketImage.ImageUrl = "~/Images/Competition/Contests/BronzeBracket.png";
            }
            else if (team.Bracket == (int)ContestBracket.Silver)
            {
                bracketImage.ImageUrl = "~/Images/Competition/Contests/SilverBracket.png";
            }
            else if (team.Bracket == (int)ContestBracket.Gold)
            {
                bracketImage.ImageUrl = "~/Images/Competition/Contests/GoldBracket.png";
            }
            else if (team.Bracket == (int)ContestBracket.Platinum)
            {
                bracketImage.ImageUrl = "~/Images/Competition/Contests/PlatinumBracket.png";
            }
            else
            {
                bracketImage.ImageUrl = "~/Images/Competition/Contests/DiamondBracket.png";
            }

            bracketCell.Controls.Add(bracketImage);;

            return bracketCell;
        }
开发者ID:mlcamilli,项目名称:ActivEarth,代码行数:41,代码来源:LeaderBoard.ascx.cs

示例11: btnGenerate_Click

        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            List<String> lstcode = new List<string>();
            //lstcode.Add(txtCode.Text);
            lstcode.Add("00271B7");
            //lstcode.Add("00533A7");
            //lstcode.Add("0056251");
            //lstcode.Add("00623D6");
            //lstcode.Add("007FF4C");
            //lstcode.Add("0085604");
            //lstcode.Add("009153D");
            //lstcode.Add("00947E7");
            //lstcode.Add("00A3631");

            //lstcode.Add("00C96DE");
            //lstcode.Add("00EB691");
            //lstcode.Add("00F3513");
            //lstcode.Add("010B183");
            //lstcode.Add("011DA5F");
            //lstcode.Add("0136BB5");
            //lstcode.Add("013ABFD");
            //lstcode.Add("013CFC7");
            //lstcode.Add("0142610");
            //lstcode.Add("0148237");
            //lstcode.Add("0151BA7");
            //lstcode.Add("0156796");
            //lstcode.Add("015AC84");
            //lstcode.Add("015C038");

            string barCode = txtCode.Text;

            foreach (string str in lstcode)
            {
                System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
                using (Bitmap bitMap = new Bitmap(str.Length * 40, 80))
                {
                    using (Graphics graphics = Graphics.FromImage(bitMap))
                    {
                        Font oFont = new Font("IDAutomationHC39M", 8);
                        PointF point = new PointF(2f, 2f);
                        SolidBrush blackBrush = new SolidBrush(Color.Black);
                        SolidBrush whiteBrush = new SolidBrush(Color.White);
                        graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height);
                        graphics.DrawString("*" + str + "*", oFont, blackBrush, point);
                    }
                    using (MemoryStream ms = new MemoryStream())
                    {
                        bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                        byte[] byteImage = ms.ToArray();

                        Convert.ToBase64String(byteImage);
                        imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                    }
                    plBarCode.Controls.Add(imgBarCode);
                }
            }
        }
开发者ID:SalesInventory,项目名称:SIMS,代码行数:57,代码来源:test.aspx.cs

示例12: RenderContents

        /// <summary>
        /// Renders the contents.
        /// </summary>
        /// <param name="output">The output.</param>
        protected override void RenderContents(HtmlTextWriter output)
        {
            System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();

            int height = Convert.ToInt32(this.Height.Value);

            image.ImageUrl = string.Format("image.barcode?Type={0}&Code={1}&Height={2}", Type, Code, height);

            image.RenderControl(output);
        }
开发者ID:cmendesce,项目名称:asp-net-barcode,代码行数:14,代码来源:Barcode.cs

示例13: scrollImage

 private System.Web.UI.WebControls.Image scrollImage() {
     System.Web.UI.WebControls.Image functionReturnValue = null;
     functionReturnValue = new System.Web.UI.WebControls.Image();
     functionReturnValue.Width = Unit.Pixel(7);
     functionReturnValue.Height = Unit.Pixel(20);
     functionReturnValue.BorderWidth = Unit.Pixel(0);
     functionReturnValue.Attributes.Add("align", "absMiddle");
     functionReturnValue.CssClass = "editorArrow";
     functionReturnValue.Attributes.Add("onMouseOut", "this.className = 'editorArrow'; scrollStop();");
     return functionReturnValue;
 }
开发者ID:elrute,项目名称:Triphulcas,代码行数:11,代码来源:ScrollingMenu.cs

示例14: ImageButton1_Click

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        // this is the folder where the uploaded files are saved
        string DefaultFileName = "";

        if (FileUploader.HasFile)
            try
            {
                //FileUploader.SaveAs(Server.MapPath(DefaultFileName) + FileUploader.FileName);

                FileUploader.SaveAs(Server.MapPath("~/Images/" + FileUploader.FileName));
                //string where = (Server.MapPath(DefaultFileName) + FileUploader.FileName);

                double punctX = 10;
                double punctY = 10;

                double spacing = 5;

                Panel2.Style["position"] = "relative";

                for (int y = 1; y < 3; y++)
                {
                    System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
                    //image.ID = "testjpg"; // +y.ToString();
                    image.Style["position"] = "absolute";
                    image.Style["left"] = punctX.ToString() + "px";
                    image.Style["top"] = punctY.ToString() + "px";
                    image.Width = 60;
                    //image.Height = 100;
                    //image.ImageUrl = (Server.MapPath(DefaultFileName) + FileUploader.FileName);
                    //image.ImageUrl = "Images/" + image.ID.ToString() + ".jpg";
                    image.ImageUrl = "Images/" + FileUploader.FileName.ToString();
                    //image.ImageUrl = Server.MapPath("~/Images/" + FileUploader.FileName);
                    Panel2.Controls.Add(image);
                    punctX += image.Width.Value + spacing;

                }

             DebugText.Text = "File name: " +
             FileUploader.PostedFile.FileName + "<br>" +
             FileUploader.PostedFile.ContentLength + " kb<br>" +
             "Content type: " +
             FileUploader.PostedFile.ContentType + "<br><b>Uploaded Successfully";

            }
            catch (Exception ex)
            {
                DebugText.Text = "ERROR: " + ex.Message.ToString();
            }
        else
        {
            DebugText.Text = "You have not specified a file.";
        }
    }
开发者ID:hansparsons,项目名称:SharePage,代码行数:54,代码来源:Default.aspx.cs

示例15: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            List<ProductDetailsBLL> lstProductDetails = ProductDetailsBLL.GetDetailByUser(1);
            if (lstProductDetails != null)
            {
                foreach (ProductDetailsBLL objProductDetailsBLL in lstProductDetails)
                {
                    System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
                    using (Bitmap bitMap = new Bitmap(objProductDetailsBLL.BarCodeNumber.Length * 17, 100))
                    {
                        using (Graphics graphics = Graphics.FromImage(bitMap))
                        {
                            Font oFont = new Font("IDAutomationHC39M", 6);
                            Font oFontCalibri = new Font("Calibri",12);

                            PointF point = new PointF(2f, 2f);
                            SolidBrush blackBrush = new SolidBrush(Color.Black);
                            SolidBrush whiteBrush = new SolidBrush(Color.White);

                            graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height);
                            graphics.DrawString("Size: " + objProductDetailsBLL.SizeName, oFontCalibri, blackBrush, 0, 44);
                            graphics.DrawString("MRP: " + objProductDetailsBLL.MRP, oFontCalibri, blackBrush, 0, 60);
                            graphics.DrawString("Code: " + objProductDetailsBLL.BarCodeNumber, oFontCalibri, blackBrush, 0, 76);
                            graphics.DrawString("*" + objProductDetailsBLL.BarCodeNumber + "*", oFont, blackBrush, point);
                        }
                        using (MemoryStream ms = new MemoryStream())
                        {
                            //PlaceHolder holder = new PlaceHolder();

                            //Label autoLabel = new Label();
                            //autoLabel.Text = "Name: " + objProductDetailsBLL.Name;
                            //holder.Controls.Add(autoLabel);

                            ////TextBox autoTextBox = new TextBox();
                            ////autoTextBox.Text = "" + id.ToString();
                            ////autoTextBox.ID = "TextBox" + id.ToString();
                            ////holder.Controls.Add(autoTextBox);

                            //holder.Controls.Add(new LiteralControl("&lt;br />"));

                            //imgBarCode.Controls.Add(holder);

                            bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                            byte[] byteImage = ms.ToArray();

                            Convert.ToBase64String(byteImage);
                            imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                        }
                        plBarCode.Controls.Add(imgBarCode);
                    }
                }
            }
        }
开发者ID:SalesInventory,项目名称:SIMS,代码行数:53,代码来源:barcodeforprint.aspx.cs


注:本文中的System.Web.UI.WebControls.Image类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。