سؤال

I want to develop a silverlight project like ms paint. i found a example. but it has a problem. i can't save DrawingArea grid as a image file or bytes. i don't how save DrawingArea grid into bytes. plz help me

            <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" x:Class="SilverlightPaintApplication.MainPage" 
            Width="805" Height="600" mc:Ignorable="d" BorderThickness="0,0,0,0" BorderBrush="{x:Null}">
            <Grid x:Name="LayoutRoot" Background="#FFFFFFFF" Width="Auto" >

                ...

            <Grid x:Name="DrawingArea" Margin="0,0,-5,8" MouseMove="DrawingArea_MouseMove" MouseLeftButtonDown="DrawingArea_MouseLeftButtonDown" MouseLeftButtonUp="DrawingArea_MouseLeftButtonUp" Background="#FFFFFFFF"/>

                ...

            </Grid>
        </UserControl>
هل كانت مفيدة؟

المحلول

I believe the solution is to use a Writeable Bitmap and save that out as explained here.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top