Click here to Skip to main content
15,897,704 members
Home / Discussions / C#
   

C#

 
GeneralRe: Shortest Way to Shuffle Array Pin
computerpublic11-Mar-14 6:59
computerpublic11-Mar-14 6:59 
GeneralRe: Shortest Way to Shuffle Array Pin
Simon_Whale11-Mar-14 7:13
Simon_Whale11-Mar-14 7:13 
GeneralRe: Shortest Way to Shuffle Array Pin
computerpublic11-Mar-14 7:20
computerpublic11-Mar-14 7:20 
GeneralRe: Shortest Way to Shuffle Array Pin
Simon_Whale11-Mar-14 7:29
Simon_Whale11-Mar-14 7:29 
GeneralRe: Shortest Way to Shuffle Array Pin
computerpublic11-Mar-14 6:57
computerpublic11-Mar-14 6:57 
GeneralRe: Shortest Way to Shuffle Array Pin
BobJanova12-Mar-14 3:01
BobJanova12-Mar-14 3:01 
AnswerRe: Shortest Way to Shuffle Array Pin
GuyThiebaut10-Mar-14 22:47
professionalGuyThiebaut10-Mar-14 22:47 
GeneralRe: Shortest Way to Shuffle Array Pin
BillWoodruff10-Mar-14 23:22
professionalBillWoodruff10-Mar-14 23:22 
GeneralRe: Shortest Way to Shuffle Array Pin
computerpublic11-Mar-14 7:03
computerpublic11-Mar-14 7:03 
AnswerRe: Shortest Way to Shuffle Array Pin
Pete O'Hanlon11-Mar-14 7:51
mvePete O'Hanlon11-Mar-14 7:51 
AnswerRe: Shortest Way to Shuffle Array Pin
Henrik Jonsson13-Mar-14 11:10
Henrik Jonsson13-Mar-14 11:10 
AnswerRe: Shortest Way to Shuffle Array Pin
Henrik Jonsson13-Mar-14 22:05
Henrik Jonsson13-Mar-14 22:05 
QuestionRMO programming Pin
Member 1064095910-Mar-14 10:22
Member 1064095910-Mar-14 10:22 
AnswerRe: RMO programming Pin
Eddy Vluggen10-Mar-14 10:39
professionalEddy Vluggen10-Mar-14 10:39 
Questionrdlc report print button Pin
balamuru10-Mar-14 9:05
balamuru10-Mar-14 9:05 
GeneralRe: rdlc report print button Pin
Ravi Bhavnani10-Mar-14 9:41
professionalRavi Bhavnani10-Mar-14 9:41 
AnswerRe: rdlc report print button Pin
Member 1064095910-Mar-14 10:31
Member 1064095910-Mar-14 10:31 
QuestionC# SQl Connection and Retrieve Data Pin
Member 1062896810-Mar-14 5:47
Member 1062896810-Mar-14 5:47 
QuestionRe: C# SQl Connection and Retrieve Data Pin
Richard MacCutchan10-Mar-14 6:00
mveRichard MacCutchan10-Mar-14 6:00 
AnswerRe: C# SQl Connection and Retrieve Data Pin
OriginalGriff10-Mar-14 6:01
mveOriginalGriff10-Mar-14 6:01 
AnswerRe: C# SQl Connection and Retrieve Data Pin
Simon_Whale10-Mar-14 6:38
Simon_Whale10-Mar-14 6:38 
QuestionHow to add bookmark in a PDF that has images Pin
meeram399-Mar-14 23:37
professionalmeeram399-Mar-14 23:37 
QuestionConverting Canvas Element to image Pin
Vinay Sakpal9-Mar-14 22:56
professionalVinay Sakpal9-Mar-14 22:56 
Hi Guyz,

I am developing windows metro apps using vb.net and XAML.

I need to convert canvas element which contains ink strokes on it.

I am using the below code :

<grid grid.row="1">
<grid.rowdefinitions>
<rowdefinition height="1*">
<rowdefinition height="1*">

<grid.columndefinitions>
<columndefinition width="1*">
<columndefinition width="1*">


<stackpanel x:name="spCollectionSignature" margin="120,0,10,10">
<textblock text="Client signature at collection address" style="{StaticResource FieldTextStyle}" padding="0,5,5,5">
<textblock style="{StaticResource LabelTextStyle}" padding="0,5,5,5" textwrapping="WrapWholeWords" maxheight="120" texttrimming="WordEllipsis" text="{Binding PCollectionSignatureMessage, Source={StaticResource oSettingData}}">
<border x:name="borderCollectionSignature" horizontalalignment="Left" verticalalignment="Top" borderthickness="2" borderbrush="{StaticResource AppBorderBrush}">
<canvas x:name="CollectionSignature" height="120" width="350" background="White" margin="0" horizontalalignment="Left">





Vb.Net code :

Public Shared Async Function GetSignatureImageString(oElement As Canvas) As Task(Of String)
Try



Dim o As New RenderTargetBitmap
Await o.RenderAsync(oElement, Convert.ToInt32(oElement.Width), Convert.ToInt32(oElement.Height))
Dim aryData = Await o.GetPixelsAsync()

Dim logicaldpi = DisplayInformation.GetForCurrentView().LogicalDpi

Dim oStorageFile As StorageFile = Await ApplicationData.Current.TemporaryFolder.CreateFileAsync(oElement.Name + ".png", CreationCollisionOption.ReplaceExisting)
Dim oStream As IRandomAccessStream = Await oStorageFile.OpenAsync(FileAccessMode.ReadWrite)
Dim oEncoder As BitmapEncoder = Await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, oStream)
oEncoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Ignore, Convert.ToInt16(oElement.Width), Convert.ToInt16(oElement.Height), logicaldpi, logicaldpi, aryData.ToArray())
Await oEncoder.FlushAsync()

Dim oBuffer As IBuffer = Await FileIO.ReadBufferAsync(oStorageFile)
Dim aryData1 As Byte() = oBuffer.ToArray()

oStream.Dispose()
oEncoder = Nothing
oStorageFile = Nothing
aryData = Nothing
o = Nothing

Return Convert.ToBase64String(aryData1)
Catch ex As Exception

End Try
End Function


I am getting 'Value does not false within expected range' on 'o.renderasync' method.

Can you please help?

Thanks,

Vinay
AnswerRe: Converting Canvas Element to image Pin
OriginalGriff9-Mar-14 23:05
mveOriginalGriff9-Mar-14 23:05 
GeneralRe: Converting Canvas Element to image Pin
Vinay Sakpal10-Mar-14 1:38
professionalVinay Sakpal10-Mar-14 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.