asp.net-mvc-helpers

Stack Overflow Exception in MVcHtmlString

回眸只為那壹抹淺笑 提交于 2019-12-23 12:27:37
问题 I have created my own Html Helper which adds red asterisks to any required field. It successfully works with both @Html.myLabelFor(model => model.Description) //and @Html.myLabelFor(model => model.Description, new { /*stuff*/ }) However, some of the code lines are like following @Html.myLabelFor(model => model.Description, "Deletion Reason", new { /*stuff*/ }) My method was not designed to handle 3 parameters, so I added a caller which would handle 3 parameters public static MvcHtmlString

MVC3 WebImage helper: resize is converting transparent background to black

空扰寡人 提交于 2019-12-04 11:59:55
问题 I'm trying to create a thumbnail using MVC3's WebImage helper. The original image is a .png with a transparent background. When I try and resize it with the following: var image = blob.DownloadByteArray(); new WebImage(image) .Resize(50, 50) .Write(); The resulting thumbnail replaces the original transparent background with a black background. 回答1: This above answer is great but i did some fine-tuning and implemented the "keep ratio" of the image so that we don't end up with stretched images.

MVC3 WebImage helper: resize is converting transparent background to black

痞子三分冷 提交于 2019-12-03 07:38:54
I'm trying to create a thumbnail using MVC3's WebImage helper. The original image is a .png with a transparent background. When I try and resize it with the following: var image = blob.DownloadByteArray(); new WebImage(image) .Resize(50, 50) .Write(); The resulting thumbnail replaces the original transparent background with a black background. This above answer is great but i did some fine-tuning and implemented the "keep ratio" of the image so that we don't end up with stretched images. using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using