C# MVC HTML5 Canvas Data - c#

I have some x and y positions in a database table, that go to make up a design for a window.
What I would like to do is draw this onto a HTML5 canvas in my app, but I'm not sure what the best way is to pass data out of my database into the canvas object (I'm not really a JavaScript/web guy).
It will just be drawing lines, that i can do but I'm not sure the best way to get the data into the canvas so I can draw it.

A quick fiddle page for you, maybe this can get you started.
http://dotnetfiddle.net/D3OqTy
I recommend read some html5 canvas tutorial
http://www.html5canvastutorials.com/

Related

What is the correct method for showing a full screen photo within a mobile app using Unity?

I am creating a mobile app using Unity. I would like to place a photo which fills the screen and then place some 3D objects on top of this photo. The photo is created during runtime and is saved to the persistance data folder.
What is the best method to achieve this? The options I see are Raw Image/Image/Sprite. However, I have been unable to achieve the above mentioned goal using either of these component types.
What about making a panel on a canvas, setting the image as background and the canvas to fit screen size?
Then place the objects on front of it, manually or as children of said canvas but higher in the hierarchy.
I don't really understand what you intend to do, just trying to help.
editing my original answer: you need to use RawImage to be able to easily load images that are not marked as Sprite in the editor
You load images from file like this :
Texture2D texture = new Texture2D(1,1); // the following needs a non null starting poin
var path=System.IO.Path.Combine(Application.streamingAssetsPath,"your_file.jpg");
byte[] bytes=System.IO.File.ReadAllBytes(path);
texture.LoadImage(bytes);
rawImage.texture=texture;
As far as keeping it filling the screen the AspectRatioFiter component is likely to do the job
To get 3d objects rendering in front, set your canvas to 'Screen Space - Camera' and point it to your camera. This will behave similar to word space in regards to rendernig order (will get 3d sroted) but canvas size will match camera viewport, so AspectRatioFitter will be able to do its job

WPF Printing Large Canvas over multiple Pages

I've got this problem:
I created a pretty large Canvas in WPF with a lot children.
I want to add a Print Button. PrintVisual seems not to work, because the image is to big. (I am using a scrollbar) I want to split the Canvas between multiple pages.
What i've done so far:
I am taking a Visual Brush for every part of the Canvas
Create a new Canvas and make the visual brush its background
Adding the new Canvas to a page, add the page to a FixedDocument.
Well, now i've got a FixedDocument and going to print it via printDocument.
The Problem is, that the whole process of printing takes a lot of time and sometimes it doesn't work at all. It's like there is a preprocessing step to convert the fixed document into a bitmap.
My Question: Is a Visualbrush in a Canvas to big? Should i convert the Canvas first into a bitmap?
I've found this great article: http://www.codeproject.com/Articles/339416/Printing-large-WPF-UserControls.
Whatever.
Is it a good way to convert a huge canvas into a bitmap first and then print parts of the bitmap? I could very well imagine, that one could get problems with blurring effects this way.
I've got also no idea how to add a bitmap to a page in wpf.
The worst thing is, that i couldn't found some really good sorces or a standardway (and i think there has to be one, cause this should be a pretty standard problem) for printing dynamic produced canvas in wpf.
I am really greatful for every really good source, help or code.
Thank you for your time.

ASP.NET Draw some points on Image and Get coordination

I'm a beginner of C#/ASP.NET
Could you please recommend some components for me?
-Here is my scenario.
Load an image file on page.
Add some points(just circle shape) on the image.
Move these points on image.
Get coordination(x, y) of points.
Store the coordination to database.
which component is appropriate for this web page?
It doen't matter using standard asp.net component or devexpress component.
I really appreciate your help.
Take a look at the HTML 5 Canvas drawImage + getMousePos
I used jquery draggable object to implement this.
Here is the link about draggable object.
http://gabrieleromanato.name/jquery-getting-the-coordinates-of-a-draggable-object/

How do I TranslateTransform an border to a new location

I have 5 Images and a border, when the user clicks an image, I want the border to slide over until it is directly over the Image that was clicked.
I am having a hard time figuring out this transform stuff. I am good with C# but new to wpf. I am quite certain that the translatetransform is what I need, but I have no idea how to implement it. Can someone show me, or point me to a good tutorial on this topic.
var RT=new TranslateTransform(90,0);
SelectBorder.RenderTransform = RT;
SelectBorder.BeginAnimation(...//I don't know what a dependency object is
I would recommend reading the documentation, it has a full example of how to use the method. (Also you would start the animation on the transform not the Border)

how to work with and draw resize images WPF C#

Hello I need to know how I can manage to resize and draw pictures in a given space and the top and left values ​​are stored in a database or XML. What elements need to use?
I put pictures of the software that works to perfection, really need to create something like what is shown in the following images:
Imagen 2
Imagen 3
Thanks!!
You probably want a canvas with a resizing adorner that tells the elements what size and placement to draw. Here is one such example.

Categories

Resources