Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
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 
Questionchange datagridviewcomboboxColumn to textbox or texboxcolumn or anything that accepts text Pin
shrikanth_BG9-Mar-14 20:47
shrikanth_BG9-Mar-14 20:47 
SuggestionRe: change datagridviewcomboboxColumn to textbox or texboxcolumn or anything that accepts text Pin
Richard Deeming10-Mar-14 2:17
mveRichard Deeming10-Mar-14 2:17 
QuestionPrint a specific single page of a PDF in windows application Pin
Garsa Sanjeev9-Mar-14 4:34
Garsa Sanjeev9-Mar-14 4:34 
AnswerRe: Print a specific single page of a PDF in windows application PinPopular
OriginalGriff9-Mar-14 4:55
mveOriginalGriff9-Mar-14 4:55 
QuestionHow to become a technical architect? Pin
spsureshkumar9-Mar-14 1:30
spsureshkumar9-Mar-14 1:30 
GeneralRe: How to become a technical architect? Pin
Kornfeld Eliyahu Peter9-Mar-14 1:54
professionalKornfeld Eliyahu Peter9-Mar-14 1:54 
GeneralRe: How to become a technical architect? Pin
spsureshkumar9-Mar-14 3:13
spsureshkumar9-Mar-14 3:13 
AnswerRe: How to become a technical architect? PinPopular
Richard MacCutchan9-Mar-14 2:24
mveRichard MacCutchan9-Mar-14 2:24 
GeneralRe: How to become a technical architect? Pin
spsureshkumar9-Mar-14 3:18
spsureshkumar9-Mar-14 3:18 
GeneralRe: How to become a technical architect? Pin
Richard MacCutchan9-Mar-14 3:25
mveRichard MacCutchan9-Mar-14 3:25 
GeneralRe: How to become a technical architect? Pin
spsureshkumar9-Mar-14 5:13
spsureshkumar9-Mar-14 5:13 
AnswerRe: How to become a technical architect? Pin
V.9-Mar-14 22:58
professionalV.9-Mar-14 22:58 
GeneralRe: How to become a technical architect? Pin
spsureshkumar10-Mar-14 17:19
spsureshkumar10-Mar-14 17:19 
GeneralRe: How to become a technical architect? Pin
V.10-Mar-14 20:21
professionalV.10-Mar-14 20:21 
AnswerRe: How to become a technical architect? Pin
BobJanova10-Mar-14 7:43
BobJanova10-Mar-14 7:43 

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.