.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links


Posted By:      Posted Date: October 17, 2010    Points: 0   Category :ASP.Net

Can someone tell me how to draw on the screen in razor? I cannot find any information on this anywhere.

I had an old asp.net source which worked, but I reckon razor could do this more more easily.


View Complete Post

More Related Resource Links



Hi there,


 I am doing one task on asp.net graphics. i would like to a form that let the user choose the color code from the color picker.

inside my backend code, i can get the color code and convert to the system.drawing.color.



Dim col As System.Drawing.Color = System.Drawing.ColorTranslator.FromHtml("#9932CC")

 Dim Brush As New SolidBrush(col)


but i have some problem in make this col object to alpha color. as i know the .net code that make the system color to become alpha is wrote as like tat :

gr.DrawString(strWatermarkText, wmFont, New SolidBrush(Color.FromArgb(8, 0, 0, 0)), x, y)


May someone share me how to make the color input from form to become alpha color? thanx in advanced. hope to hear from you all soon 


System.Drawing.Image.Fromfile is not working


I am trying to get the height and width of the image dynamically.  The reason is I am loading multiple images using code, where the image name is from the database. 

Here is my code:

in the ascx page, I have an asp image

<asp:image id="imgInfo" runat="server" /> 


In the code behind

string ImagePath = "~/products/img/" + dataviewImgInfo[0]["imgName"].ToString();

System.Drawing Image imgProd = System.Drawing.Image.FromFile(ImagePath);

if(imgProd.Height > 200)

imgInfo.Height = 100;




imgInfo.Height = 200



WHen I run this page I am getting the folloiwng error

Windows With C++: Drawing with Direct2D


In this article, the author shows you how to draw with Direct2D by introducing Direct2D's color structure and its various types of brushes.

Kenny Kerr

MSDN Magazine September 2009

Office 2003: Host an Interactive Visio Drawing Surface in .NET Custom Clients


Microsoft Office Visio 2003 introduces a new drawing component that allows you to embed an interactive drawing surface into your application's user interface. You can drive the Visio drawing component from events in your host application or with data from a Web Service and an ADO.NET data adapter. The Visio drawing component supports the rich Visio application programming model, giving you control over how graphics are used and displayed on the drawing surface. This article explains how to embed the Visio drawing component into a C#-based Windows Forms client app that retrieves data from the Fabrikam 2.0 Web Service.

Mai-lan Tomsen Bukovec and Blair Shaw

MSDN Magazine December 2003

EventType clr20r3, P1 devenv.exe, P2 9.0.30729.1, P3 488f2b50, P4 system.drawing, P5, P6 488

Hi,I am facing a strange issue in Visual Studio 2008 Standard SP1, when using WPF Designer (even without using the Designer tab, only XAML tab). Visual Studio crashes very often, without any apparent reason, and in various ways, for example: exits instantly, the IDE displays corrupted UI, when begining compiling it stops responding.There are two new Event Log entries after this: EventType clr20r3, P1 devenv.exe, P2 9.0.30729.1, P3 488f2b50, P4 system.drawing, P5, P6 4889dec2, P7 33d, P8 18, P9 system.outofmemoryexception, P10 NIL. .NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (7A2E0F92) (0)Worth mentioning:- computer has Windows XP SP3 with the latest updates installed- it crashes on other computer types too- the project has quite a large number of UserControls - it appears that if opening a XAML file with the XML editor instead, it works ok- on other WPF projects it also works okDoes anyone have an ideea why is this happening and solutions? Thanks

Displaying a System.Drawing.Bitmap in a WPF Image control

How would I convert a System.Drawing.Btimap into a comparable WPF image control so I can display in on my WPF window? Thanks

WPF - Drawing the connected lines shape

I want something to draw like in WPF   ___________________________                                        |                                        |                                        | __________________________ | | | ___________________________                                         |                                         |                                         | ___________________________          

Having problem with drawing rounded corners with borders using RoundedCornersExtender control

Hi, I have created panel using below syntax <asp:Panel style="z-index:4;top:270px;left:270px;width:320px;height:200px;position:absolute;"  Enabled="True" CssClass="Panel" TabIndex="4" Visible="True" runat="server" ToolTip="" BackColor="" BorderStyle="NotSet" BorderWidth="0px">  <div style="clear:both"></div></asp:Panel> and added rounded corner extened control using <cc1:RoundedCornersExtender Corners="All" runat="server" TargetControlID="panel4" BorderColor="Black" Enabled="True" Radius="10"></cc1:RoundedCornersExtender>Issue: At run time   there is  a gap between border and corners. I am using doctype of this" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >"If i changed the doc type to below "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" ><html xmlns="http://www.w3.org/1999/xhtml" >" its working fine.Is there any solution for this with out changing the doc type?Advanced thanks for your help.Thanks,Charles  

Visio Web Drawing Not Working

Hello   I have created a Visio 2010 Drawing, and saved it as a web drawing to my sharepoint 2010 server. Visio 2010 - Version: 14.0.4760.1000 (32-bit) SharePoint 2010 - Version 14.0.4763.1000 (64-bit) When i create a page and add a visio web access webpart and then open my web drawing i get an error which reads: 'The Server failed to process the request' The Event Viewer shows the following error: Failed to get Vector Diagram for visio file page Exception : The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs. I have tried google, bing and technet but cant find an answer. I have a secure store target spplication id set up and credentials set and have added that information to the visio graphic service global settings. Any ideas what i can do to fix this issue?

Bitmap drawing

I am trying to draw objects (line, etc) on a Bitmap. However, I have run into some problems: the origin of the bitmap coordinate system is at the top-left corner of the bitmap. How can I have it set to the bottom-left corner? Also, I need to draw some real world objects on this bitmap: how can I transform or map the real world coordinates on the bitmap coordinate space? Any help is really appreciated as I am totally lost on this one.

Converting System.Windows.Media to System.Drawing objects

Hello, I want to know if it's possible to convert the System.Windows.Media objects Color and Imaging.BitmapSource to the System.Drawing objects Color and Bitmap and the other way around. If yes, how can I do this?

XmlSerializer: Serialize an array of System.Drawing.Color

Ok,  here is my problem... I am building a UI configuration tool that utiliizes a PropertyGrid.  One of the properties is a indexed list of Colors contained in an array: CategoryAttribute("Style"), DisplayName("Data Set Colors"), DescriptionAttribute(""), XmlArray("SetColors"), XmlArrayItem(ElementName="Color",Type=typeof(SColor))] public Color[] SetColors { get; set; } The beauty of the PropertyGrid is it knows how to handle this Poperty and properly handles array and list of Colors. BUT...   As we already know in order to serialize a Color,  we have to use a surrigate property,  which is very unfortunate, and I fear is one of those little thing MS just overlooked.  (I understand it is actually a structure and not a class and has not default properties from which to get type info from.) I am really amazed that when I do serialize the class,  the XML is soooo  close to what I need,  its just missing the actual color value data: <AppGridColumnConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Name>Label</Name> <SetColors> <Color /> <Color /> <Color /> </SetColors> <IsDefaultEditable>false</IsDefaultEditable> <IsDirtyCheck&

Drawing The form behind desktop icons.

I need to display my form in background behind the desktop icons. Possible?

Mouse Drawing in Bitmap and repositioning bitmap

Dear Friends,                  I have made an application similar to this: http://www.bobpowell.net/simpledraw.aspx. But I have made few changes like I have used only the mouse draw option where the drawing is zoomed to specific level with Matrix transformation and I have snapped the mouse to the current mouse coordinates. The programe is working fine. Problem arises when I try to place the same bitmap in X and Y axis many time. After placing bitmap in both the axis once again repositioned the mouse like whenever the mouse is clicked on repositioned bitmaps it draws into the original bitmap and displays the image in all positioned bitmaps. I have solved the mouse back tracking issues.                   The major problem I face here is that when the mouse crosses one bitmap to another bitmap it ticks a continuous line. That is whenever mouse crosses 0th pixel to the last pixel of previous positioned bitmap or from last pixel to 0th pixel of next positoned bitmap. Whereas I need smooth mouse drawing programme with bitmaps positioned many time so that the drawn image should look continuous. I couldnt give code because it is huge.               &n

First Steps with VS2010 RC - System.Drawing; missing?

I'm a little confused! I was curious about the new VS2010 RC and as I wanted to start with a new Software Project I  wanted to give it a try. 1. Installation troubble with Silverlight but VS2010 loads without errors. 2. Now I wanted to try out this things with a full aero window and found a nice and simple code snipplet on the MSDN .NET FW4 Extend Glass Frame Into a WPF Application So I made this short changes in my first source code and I'm getting the strange message: Error    1    The type or namespace name 'Drawing' does not exist in the namespace 'System' (are you missing an assembly reference?)    D:\Projekte\Selfmade\Software\CAS_Information\CAS_Information\MainWindow.xaml.cs    19    14    CAS_Information I found a lot of c# code with a using System.Drawing; but on my installation I dont have such a namespace. What the heck is wrong there?   Windows 7 x64 - VS2010 RC

Drawing text hangs - FormattedText bug?


A customer has reported that our software hangs when he runs it on one of his computers. We narrowed down the problem to rendering text with FormattedText and put together a simple application for him to try, which just renders some text with different font parameters - this would hang too.

Here's the bit of code which does the actual text drawing:

Typeface typeface = new Typeface(m_Font, m_FontStyle, m_FontWeight, FontStretches.Normal);
FormattedText ftext = new FormattedText(m_Text, new CultureInfo("en-US"), FlowDirection.LeftToRight, typeface, m_FontSize, m_FontColor);

ftext.TextAlignment = CenterText ? TextAlignment.Center : TextAlignment.Left;

if (m_DrawOutline)
  Geometry geom = ftext.BuildGeometry(CenterText ? new Point(ftext.Width, 0) : new Point());
  dc.DrawGeometry(m_FontColor, DrawOutline ? new Pen(m_OutlineColor, m_OutlineWidth) : null, geom);
  dc.DrawText(ftext, CenterText ? new Point(ftext.Width, 0) : 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend