Reputation: 596
I'm working with a C# windows form application, and I want to place a pre-generated QR code onto the form that will take the user to a certain website on the form in a 'picturebox' or something similar. Having used a website to generate the QR code, It has given me a unique barcode image and a piece of code that looks like this:
<script type="text/javascript" src="http://www.qrjumps.com/script/embed.js"></script>
<script type="text/javascript">
Tracker('8713921');
</script>
This is HTML with reference to some JavaScript on the other side of the source link. Is it possible to include this somewhere in the code for my C# application? I have never used these particular languages together before.
If this can't be done in this type of application, is there any alternative way to get a QR code onto a C# Windows Form that will work in the same way?
Thanks in advance,
Mark
Upvotes: 0
Views: 997
Reputation: 13
You could make it a property on one of your models, likely the model for which you will use reporting.
protected string MyProperty {get;init;} = "yourStringHere"
Then when you are designing your report, you pull the barcode control from the tool box then set it to QRcode. That is when you can bind to your property from earlier "MyProperty" (assuming you already set up the Data Source for your report).
protected could also be private or public depending on your use.
There is an option to have text directly in the QRcode control. Double click on the control after it has been dropped onto the report. Then paste or type the text there. If special characters are in your text make sure, in the control's properties, that the compaction mode is set to byte.
Upvotes: 1
Reputation: 4178
Just save the image:
Now you can just add it as an image to your WinForms Application.
Bitmap image = new Bitmap(@"myImagePath", true);
// Make a picturebox and add it
PictureBox1.Image = image;
This would be the easiest possibility.
Upvotes: 1