I tried to export my canvas to a file. First I tried to export it to a png and it worked fine, everything looks the same as on the canvas.After that I modified my code to export to a xps file.
Dim thePack As IO.Packaging.Package = IO.Packaging.Package.Open(path.LocalPath,IO.FileMode.Create) Dim doc As New Xps.Packaging.XpsDocument(thePack)
I am trying to convert some old VB6 code to VB.NET. The VB6 uses a Canvas control, simply
Dim cv as Canvas
I cannot for the life of me figure out how to use the Canvas control in VB.NET (using VS2005). MSDN says it is in the System.Windows.Controls namespace, which doesn't seem to exist? All I see is System.Windows.Forms, which doesn't include the Canvas control.
Finally took the plunge for wpf, all was going well until i needed to do a simple drawing on a canvas control (presume this is the right surface to use). First thing i noticed is that there is no paint event in wpf so i looked at a few others (Initialized, layout updated) at this point i looked under google and found very little on this. would anyone here have or know of a tutorial to allow this functionality? My application (a testbed) will draw an archery target within the canvas along with score numbers in the correct place as follows to do this it will need to draw several filled circles with black (or white) borders and text objects in the correct position. the locations and widths of the circles will be determined using a simple algorithm so my question is on the structure of paint events within wpf, are the commands the same as in gdi+?
So I built myself a simple program to work out the kinks of drawing in my programs. I have a button that I press that when the textbox.text reads 1 it then draws a line of a specific height, color and position, the problem is when I click that button again it will crash informing me that... "Specified Visual is already a child of another Visual or the root of a CompositionTarget." [code..]
I know where the problem lies, its with the Canvas1.children.add(line), cause its telling me the line variable is already been used or in use on the canvas, I'm just unsure of how to turn that into a solution that will allow me to click the button a hundred times or more without being forced to MANUALLY make a hundred or more individual variables to store the line.
I have an application that generates a replay of Air Traffic and I need to allow the user to capture parts of the canvas so it can be exported as a BMP of GIF. I did this in VB6, but not sure how to do it in WPF. I plan on drawing a rectangle around the intended capture area following the mouse till the user triggers the capture.
I have a canvas inside a window. The window is full screen, but the canvas is set to a solid 640x480 in the center of the window. I need to get the mouse position inside of the canvas, but NOT inside of the window. How do I do this?
I convert a SVG to canvas using canvg to an image and then vb.net client side I convert the image to bytearray() and saved it to a folder on my server so I can attached by email :
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim path = Server.MapPath("PDFs") Dim fileNameWithPath As String = path + DateTime.Now.ToString().Replace("/", "-").Replace(" ", "-").Replace(":", "") + ".jpeg" Dim fs As FileStream = New FileStream(fileNameWithPath, FileMode.Create) Dim bw As BinaryWriter = New BinaryWriter(fs) [Code] .....
This code works fine and it send the image. Actually I don't need to save this image to my server I just wanted to send it without saving, this is what I have done so far. Protected Sub emailSend_Click(ByVal sender As Object, ByVal e As EventArgs) Handles emailSend.Click Dim customerChoice As String = DropDownList1.Text Select Case customerChoice Case "pdf" [Code] .....
How to display canvas element of HTML5 in Visual Basic .net 2010 webbrowser (I try in framework 2 and 4, WebBrowser version 2 and 4)? It seems that VS2010 not support new version of HTML. In Microsoft Web Browser - "AxWebBrowser" didn't work too. Any idea to make this thing work?
I created a paint type program for signatures, and now I would like to save my canvas as either a jpeg, bitmap, or gif file, but I am unsure how to go about this. Here is my code,[CODE...]
I'm making a drag and drop application and when I'm dragging an element inside the canvas the brush displays the element when the coordinates are negative this gives a weird resize in the brush witch also displays the negative elements.
How can I make the visual brush only draw the real size of the canvas, or the positive children of the canvas?
What I need is some formula to calculate font size of TextBlock for its owner - Let's say I have Canvas height 100.0 then which TextBlock font size should be to fill all space of the Canvas?
P.S. The main problem is that I scroll those TextBlocks horizontally...
I'm trying to make a very simple Silverlight application.I want it to be full-screen, and I want to draw a line onto a Canvas.My problem is that the .Width and .Height of the canvas never seem to have a valid value. The website shows the canvas at 400x300 pixels or so, and when you click on it, it goes into Fullscreen mode.I want to use the Height and Width to find the usable space of the screen. I've tried adding events (thinking that the canvas wasn't yet ready to be used immediate after the full-screen line of code) but the LayoutChanged and Resized events don't seem to yield anything.
Under the MouseLeftButtonUp event handker store the first coordinates of the lines second endpoint. Then call the length method to obtain the distance between the two endpoints(the lines length). Fianlly display the line on the canvas and the line's length in the Length=Label. Below is the code I have so far. There are no errors, but when I run the application nothing happens.
Private Sub lineCanvas_MouseLeftButtonUp(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArg... Handles lineCanvas.MouseLeftButtonUp Dim distance As Double endPoint = e.GetPosition(lineCanvas)
Silverlight project with tabcontrol hosting canvas objects. I want to wrap my entire tabcontrol with a scrollviewer so that on a short display you can scroll vertically to see the whole area on my canvas.When I run my project my scrollviewer vertical bar is always showing even when there's more room vertically than needed for a scrollbar.
All I am trying to accomplish here is a min resolution of 1280x768 to be scrollable and anything bigger than that have the scrollbars hide. My laptop is only 768 tall, but my canvases were developed with 1280x1024 in mind. So I would like a way to set this up so that everyone can scroll or just see the canvas all at once depending on their resolution.
Anyone have any ideas why it is always visible? I've tried setting canvas width and height. I tried setting stretch on alignments on the outer grid. Saw both those tips while searching other issues similar to mine.
....lots of child canvas items in my "Main Floor" canvas. Child canvas objects contain lots of path objects. None which are taller or wider than the main floor canvas width/height.
I use some code to successfully resize and save images - but I want to save the image to 800x800 px size on a canvas of 900x900px so it has a white border type thing around it.