I am a C# ASP.NET developer who is trying to create a web app that allows users to designate an area of their screen and screen capture it. I have found many javascript and jquery solutions but they are too complicated in my opinion and I lack the javascript skills to work with them. I found this code on MSDN:
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Printing;
public class Form1 :
    Form
{
    private Button printButton = new Button();
    private PrintDocument printDocument1 = new PrintDocument();
    public Form1()
    {
        printButton.Text = "Print Form";
        printButton.Click += new EventHandler(printButton_Click);
        printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
        this.Controls.Add(printButton);
    }
    void printButton_Click(object sender, EventArgs e)
    {
        CaptureScreen();
        printDocument1.Print();
    }
    Bitmap memoryImage;
    private void CaptureScreen()
    {
        Graphics myGraphics = this.CreateGraphics();
        Size s = this.Size;
        memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
        Graphics memoryGraphics = Graphics.FromImage(memoryImage);
        memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
    }
    private void printDocument1_PrintPage(System.Object sender,
           System.Drawing.Printing.PrintPageEventArgs e)
    {
        e.Graphics.DrawImage(memoryImage, 0, 0);
    }
    public static void Main()
    {
        Application.Run(new Form1());
    }
}
I put the code in code behind in ASP.NET and added a reference to WindowsFormIntegration to my project but when I run it I get an error:
CS1061: 'ASP.default2_aspx' does not contain a definition for 'printButton_Click' and no extension method 'printButton_Click' accepting a first argument of type 'ASP.default2_aspx' could be found (are you missing a using directive or an assembly reference?)
This is the .aspx code:
    <body bgcolor="Silver">
    <form id="form1" runat="server">
    <br />
    <h2 style="color: #808000; font-size: x-large; font-weight: bolder;">
        Article by Vithal Wadje</h2><br />
        <asp:Label style="color: #808000;" ID="Label1" runat="server" Text="Label"></asp:Label>
    <br />
    <div>
        <br />
      <asp:Button 
            ID="printButton" runat="server"
             onclick="printButton_Click"  />
    </div>
    </form>`enter code here`
</body>
</html>
I'm unfamiliar with Windows Forms so am unsure if I should abandon using this MSDN sample https://msdn.microsoft.com/en-us/library/fw1kt6f9.aspx and look at Silverlight possibly though I'm not familiar there either. Is what I am working possible to convert to ASP.NET/C#?
Thanks in advance.
 
     
     
    