ASP.NET/ActiveX/Silverlight Screen Capture

I need a way to capture a screen in a web application in any way. Is there such a way without installing other tools like SnagIt? Can I use Win32 DllImports in an ActiveX component and do it this way?

Thanks in advance!

+3
source share
4 answers

Here is the code that will appear on the screen of your silverlight application. and then you can send it or something else :-)

Just create a silverlight project (with a normal main page, etc.) and replace it.

works in both 3.0 and 4.0 (havent tried 2.0 and below)

Hope I help Regards, ReLoad

.cs

System; System.Collections.Generic; System.Linq; System.Net; System.Windows; System.Windows.Controls; System.Windows.Documents; System.Windows.Input; System.Windows.Media; System.Windows.Media.Animation; System.Windows.Shapes; System.Windows.Data; System.Windows.Media.Imaging;

SilverlightApplication1 {     public partial class MainPage: UserControl     {         public MainPage()         {             InitializeComponent();         }

    private void UIelementShoot(object sender,

RoutedEventArgs e)         {             theImageToSend.Source = new WriteableBitmap (elementToCapture, );         }

    private void ScreenShoot(object sender,

RoutedEventArgs e)         {             theImageToSend.Source = new WriteableBitmap (LayoutRoot, null);         }

    private void Button_Click(object sender,

RoutedEventArgs e)         {

    }
} }

XAML:

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:SilverlightApplication1" x:Class="SilverlightApplication1.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White" Width="400" Height="300" >
        <Image x:Name="theImageToSend" Margin="191,56,44,103" d:LayoutOverrides="HorizontalAlignment"/>
        <TextBox x:Name="elementToCapture" Margin="37,56,0,130" TextWrapping="Wrap" Text="TextBox" Width="124" HorizontalAlignment="Left" d:LayoutOverrides="Width"/>
        <Button Content="Make ScreenShoot" HorizontalAlignment="Right" Margin="0,0,44,26" VerticalAlignment="Bottom" Width="139" Click="ScreenShoot"/>
        <Button Content="Make TextBox Shoot" HorizontalAlignment="Left" Margin="61,0,0,26" VerticalAlignment="Bottom" Width="139" Click="UIelementShoot"/>


    </Grid>
</UserControl>
0

Silverlight, , , ( !. , - -).

(, ActiveX, IE), Win32, . , , .. . , COM #, GAC ( , ..).

, Silverlight , .

, , ( -) EXE , / / .. , .

, Windows 7 , Snipping Tool, .

+2

Silverlight , Silverlight - .

, -, PrintDocument ....
. , LayoutRoot .

In the links from this forum, they register the DLL in the GAC and use this method to create a screenshot. Not very nice ;-)
http://forums.silverlight.net/forums/p/163378/367809.aspx

private void ButtonPrint_Click(object sender, System.Windows.RoutedEventArgs e)
{
    PrintDocument pd = new PrintDocument();
    pd.PrintPage += OnPrintPage;
    pd.Print("from Silverlight");
}

private void OnPrintPage(object s, PrintPageEventArgs args)
{
    args.PageVisual = LayoutRoot;
}
0
source

For someone else who stumbles upon this in the future, there is also a great option for using phantoms ( http://phantomjs.org/ )!

0
source

Source: https://habr.com/ru/post/1724550/


All Articles