Drawing A Line In Silverlight / Canvas Width Is Invalid

Mar 17, 2011

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.

View 1 Replies


ADVERTISEMENT

VS 2010 Drawing On A Canvas With Wpf?

Jun 30, 2010

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+?

View 3 Replies

Silverlight Project With Tabcontrol Hosting Canvas Objects : Can't Get Vertical Bar To Hide Even When Lots Of Room

Aug 11, 2011

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.

Some code:

<Grid x:Name="LayoutRoot" MinHeight="768" MaxHeight="1024" MinWidth="1024" MaxWidth="1280" Background="#FF6A6868" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.775*"/>

[code]....

....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.

<sdk:TabItem Margin="0" Header="Mezzanine">
<Canvas x:Name="Upstairs" HorizontalAlignment="Left" Height="1000" UseLayoutRounding="False" VerticalAlignment="Top" Width="1280">

..another tab. Same deal with child canvas objects.

View 1 Replies

Drawing Multiple Lines On A Canvas?

Jun 29, 2012

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.

View 5 Replies

Printed Line Width Too Wide Even When Pen Width Is 1?

Mar 18, 2010

I have a drawing program written in VB6 that is capable of printing very thin lines to a laser printer. In VB .net, even though the pen width is set to 1, the thinnest lines are way too "thick". The equivalent line width in VB .net using a pen width of 1 is about the same as the DrawWidth = 4 in VB6. So, my question is, how can I print very thin lines to a laser printer in VB .net?

View 5 Replies

Creating A WPF Application To Draw A Straight Black Line On A Canvas

Aug 16, 2010

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)

[Code].....

View 2 Replies

Part Of The Line Goes Below 0 It Starts Drawing The Line Inverted Again?

Dec 3, 2010

This is more of a mathematical problem than programming problem.I have created a very basic 3D engine using Visual Basic .Net. It displays lines on the screen with an additional z axis. The engine works, however when part of the line goes below 0 it messes up and starts drawing the line inverted again.

This is how it calculates the points:

y = (point.y / z) + offset.y + camera.y
x = (point.x / z) + offset.x + camera.x

Can anyone work out a way to only draw part of the line when it intersects the z=0 axis?

View 1 Replies

Can't Split A Line By A Newline In Silverlight

Jan 17, 2009

I cant split a line by a newline in silverlight vb.net I am reading in numbers from a file into a string as this is the quickest way. Then I parse the data in numbers by splitting the string by newline then by comma. I cant split by newline which again is the sticking point as nothing happens with the newline split.

Dim myone(), myint2(60) As String
Dim myint(6) As Integer
Dim contents As String

[Code].....

View 1 Replies

Change Width Of A Line Chart?

Dec 15, 2010

Is it possible to change the width of a line series with the chart bundled in .net 4?

View 3 Replies

Exporting ReportViewer To Excel / Line Width Variation

Apr 28, 2009

I am creating reports using the Microsoft ReportViewer control.I am encountering some formatting issues when exporting the reports into Excel. The problem is that I am specifying a line width of 1pt in ReportViewer, which is the smallest line possible (or is it?).When the export is done, the line widths in Excel are all thick borders.I am trying to figure out how to get the line widths to be standard lines in Excel.

View 1 Replies

Drawing A Line At An Angle?

Jan 22, 2011

if i use

Dim Gr As Graphics = SomePanel.CreateGraphics()
Gr.Drawline(StartingPoint, EndingPoint)

I want to be able to have a line drawn from point a to b, but be able to rate it 90 degress based on user input so if the user inputs 70 I want it to rotate 30 degree's to simulate a 70 deg relationship to a horizontal line that it touches if that makes any sense. a is starting point b is the user inputs 70 and it draws it at 70 in relationship to the horizontal lineheres the image that i forgot to post above Attached image(s)

View 1 Replies

Drawing A Line In VB With OpenGL

Nov 6, 2010

I was wondering if anyone could steer me to any good references to using OpenGL in vb.Net? I wanted to try a simple line drawing test to start off with, and came across many old discussions about using CsGl or the Tao Framework. But I could not get CsGL to import into Net2008 (the Add Reference window simply could not see the DLL that was clearly there when using Windows Explorer). And although I could get Tao to import OK, and found portions of one person's project, I figured that somehow the GL window he was referring to had to first be set up as a GL object (new class?).In addition, all the OpenGL books I have looked at only discuss OGL with respect to some version of C.From what I have gathered, you need a connector between vb.Net and the opengl32.dll libraries and that is what CsGL and Tao are about. But the edumucation resources seem very few.

View 13 Replies

Drawing A Line On Form

Feb 24, 2012

how to draw in vb.net, and I figured the easiest way is to get my hands dirty and start coding. I figure that the best way to start is by drawing a line on the form. What I'm trying to do is use the graphics.drawline(), but I'm failing. This is what I'm using so far

[Code]...

View 2 Replies

Drawing A Line With Points?

May 13, 2009

I have a question about drawing lines. Most of the code snippets I've seen approach drawing a line with the mouse down as the startpoint and the mouse up as the endpoint. But I am trying to draw a line by startpoint as
a mouse click and then an endpoint as a mouse click just as you do on a typical cad program.

View 8 Replies

Drawing A Multicolored Line?

May 30, 2011

That's vertical and 1 pixel wide. This is for a mulitiprocessor performance monitor.How do I do it....if you tell me which routine to use... I'll take it from there. I don't think the routine is

System.Drawing.Graphics.DrawLine, because it's looks to an external reference like I'm putting random pixels in.If possible I need to put the pixels in by hand. Besides this line of pixeld is another line of pixels for another epoch. They are not related numrically.

View 1 Replies

Drawing Line On Picturebox?

May 27, 2010

My program is giving the error: "End of statement expected" The red lines are the ones giving errors. I'm trying to draw lines on a picturebox to create a graph

Dim iScale As Single
Const Distance = 1000
pictureBoxGraph.ForeColor = QBColor(0)

[Code]....

View 16 Replies

Change The Vertical Scrollbar Width On A Multi-line Text Box?

Sep 30, 2010

I'm working on a VB.NET application using VS2010 for an application that will run on a touch-screen. I have a problem with a mutli-line text boxes, ListBoxes and DataGridView controls which contains a vertical scroll bar. The scroll bar is too small for anyone with big fingers. Is there any way to make that scroll bar wider so that it's more "finger friendly"?

View 6 Replies

Dynamic Opacity Line Drawing?

Dec 12, 2011

I am doing a project with graph (VB.NET). I am drawing a line handling dynamic property ( opacity changes based on DB value). I don't know how to change the opacity.

View 1 Replies

Use A Binary Pattern When Drawing A Line?

Nov 29, 2010

I'm using vb10.

Is it possible when drawing a line to use a binary pattern? Is there a command for this?

Example:

167 is 1010 0111
Draw a line X32 x Y1 would be: 10100111101001111010011110100111
205 is 1100 1101
Draw a line X32 x Y1 would be : 11001101110011011100110111001101

1's being pixels drawn and 0's not.

View 2 Replies

VS 2010 Drawing A Line From A Number?

Jan 18, 2012

I have been working on an angle calculating program. I have incorprated a feature so you can type the angle and the program draw it. I have since added a few new features and updated everything as such. For the life of me I can't figure out why the draw angle has stoped working. let me just paste some code.

Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data

[Code]....

Right, the program isn't so complicated. The important bit is that you type an angle in textbox1 and hit enter. Then what happens is the angle is calculated against a base line (one of the new features is that this base line can be moved from left to right and center.) the problem occurs when you hit enter, the program doesnt actually draw the line for you.

View 2 Replies

Drawing And Deleting Line On MouseMove Event?

Jun 21, 2010

I'm writting program in VB 2010, but I have a problem. I want to draw a temporary line on PictureBox control MouseMove event. That works fine but deleting of that line doesn't work. I tried to draw the white line on the same coordinates (PictureBox's background is white), but won't work.

Here is the code: Private Sub drawing_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles drawing.MouseMove

[Code]...

View 7 Replies

VS 2010 Drawing A Line Over DirectX Fullscreen?

Jan 25, 2012

Basically I want to Position a line from The middle of my screen to the bottom right of my screen. But I need to draw over the game to do this. I dont mind if it flickers as long as its there is all i want. Like this VV

View 4 Replies

Error - Data At The Root Level Is Invalid. Line 1, Position 1

May 6, 2010

I am trying to learn how to read XML file and created a little program below to start testing what I have read but keep getting error "Data at the root level is invalid. Line 1, position 1"The line where the error is coming from is the line "xmldoc.LoadXml(strFile)".. any ideas?

Code:
Private Sub cmdReadXML_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles cmdReadXML.Click
Dim clsk As New clsHx

[code]....

View 6 Replies

Invalid Resx File Parameter Is Incorrect Line 1374, Position 5?

Oct 26, 2009

Here is my problem: I developed one application in VB.Net in VS 2008 Express Edition on MS Vista. I published the application and created the installation setup. Now when I install this application on any Vista machine, it runs without any problems, but if I install it on an XP machine, the installation is clean, but when I launch the application, it ends abruptly without any warnings/error just after the splash screen.

Then to investigate further what I did was that I copied the source project from my VS 2008 Express Edition on Vista to an XP machine having full (VS 2008 Team System) version , and when I try to compile it there (XP/VS2008 Full), I get one error in one of the forms resx file. Incidently this is the same form that gets loaded after the splash screen. So I see there is some correlation between my application ending just after the splash screen and failing to compile the main form of the application. The error that I get reads like: "Invalid resx file. The parameter is incorrect Line 1374, position 5."

View 2 Replies

Interface And Graphics :: Drawing Line Chart With Dynamic Data

Apr 13, 2009

I would like to build a line chart which can redraw or change during a period of time with dynamic data. So that the x, y axis will change if out of range. The graph may be somehow similar to Matlab. I am using vs2005.

View 2 Replies

Send XML File Error 'Data At The Root Level Is Invalid. Line 1, Position 39'

Aug 2, 2011

I am attempting to send my XML file through an API. I have done this no problem by using the below code, however when I try and send the FILE over it will not work, I am now getting in the browser:

Data at the root level is invalid. Line 1, position 39.

Without trying to send FILE it works:

' create the Xml that the Msxml2.serverXmlHttp object will send to the Webservice
dim Xml_to_Send
Xml_to_Send = "<?xml version=""1.0"" encoding=""utf-8"" ?>"
Xml_to_Send = Xml_to_Send & "<xmldata>"

[Code]....

View 2 Replies

Port WinForms To Silverlight 2 Or Silverlight 3

Mar 19, 2009

I have a LOB app written in VB.NET with a WinForms front-end and SQL back-end. After many months weighing up how to get onto the Web, I decided last month to use Silverlight 2. Now, Silverlight 3 Beta is out, but there is no end-user runtime.

Does anyone know when the runtime will be available for deployment of SL 3 apps onto client sites?
My dev timeline is about 3 months: should I persist with SL 2 and then u/g to SL3, or jump straight in to SL3?

View 5 Replies

Adding Auto Width (.width = -2) To Existing Listview Class?

Nov 7, 2010

I'm using the next class to fill my listview

Imports System.Data.SqlClient
Public Class ListViewData
Public Sub FillListView(ByRef MyListView As ListView, _

[code]....

I want all the listview columns to be in auto width. I tried adding the next line of code but then only my first column fills my entering listview width. All other columns are not affected!

lvwColumn.Width = -2

View 2 Replies

Auto-size Datagridview Width Based On Content Width?

Nov 26, 2011

What I am trying to do is fill the contents of the datagridview with the cell contents. There are two ways to do this.

1) Either set the DGV width to the cell contents width, or

2) Autoadjust the width of the cells to the width of the DGV.

how to implement either of these two approaches?

View 3 Replies

Why Isn't Width Of ToolStripComboBox Changing / When Change Width In Property Setttings

Dec 17, 2010

This Winforms app has a toolStripComboBox within a MenuStrip container that displays Culture Info languages.The toolStripComboBox's width is not expanding to accommodate the size of the string. The strings are dynamically added to the combobox from underlying code. How do I get the comboboxe's width to expand? Below is an image of the'too narrow' combobox and below that the Properties for the combobox.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved