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
ADVERTISEMENT
Jan 3, 2012
I have a picture in my picturebox. In that picture, I need to draw a straight line between two points and calculate the length of that line (probably in pixels). Is there any suggestion how to do it?
View 2 Replies
Feb 19, 2010
I have to draw a black line across the center of the picture from one side to the other, how do I do that. Here is the code:
Dim bmp As Bitmap
Dim x, y As Integer
Dim pixel As Color
lblLeft.Image = Image.FromFile(tbFileName.Text)
bmp = Bitmap.FromFile(tbFileName.Text)
' manipulate bmp here
lblRight.Image = bmp
View 1 Replies
Jan 31, 2012
I see that the Line method is replaced with DrawLine, however; it seems like DrawLine must treated as an object as follows:
Private Sub Form1_Paint(ByVal sender As Object, ByVal e _
As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Draw a solid black line 25 pixels from the top of the form.[code].....
When I attempt to use this code (call it), I must somehow bring about an event, but I haven't found how to do that.How do I "call" this sub?
View 13 Replies
Jun 12, 2011
I'm in this proyect where I need an area in the form where I can place just dots, then join these dots with an straight line between them.how can I do that? I placed a Picturebox to see functions there but nothing is clear.
View 3 Replies
Jan 24, 2010
I have a line shape which I am using as a straight 'finishing line'. As the program runs an identically shaped line shape appears. I am a little confused from where and how it is appearing, as I only have the one line shape. Also, on some runs of the program 'trails' of the cars that are racing across the screen remain.Are these issues something simple I can fix?
View 5 Replies
Jul 22, 2010
[Code]...
If someone could post some sample code, in either c# or vb.net that would be much appreciated.
View 1 Replies
Oct 3, 2011
I am trying to draw a black border around a ToolStripButton. This is the code I am using and it only draws the border on 2 sides. Dim clrMenuBorder As Color = Color.Black Dim borderPen As New Pen(clrMenuBorder)
Dim rect1 As New Rectangle(0, 0, e.ToolStrip.Width, e.ToolStrip.Height)
e.Graphics.DrawRectangle(borderPen, rect1)
View 7 Replies
Jul 22, 2010
I have two points (x1, y1) and (x2,y2) and have a straight line between the 2 points, from this I can work out the distance between the 2 points lets say it is 50.What I want to do is increase or decrease the length of the line by a predefined amount lets say 10.So If I increase the line length by 10 (from 50 to 60), What I want to work out is what point(x3,y3) would be at the end of the increased line.Hope this makes sense.I have tried to work out the new point using the angle but it does not work correctly, it does not seems to produce a perfectly straight line and the angle from point (x1,y1) to the new (x3,y3) is not the same as the angle from point (x1,y1 to x2,y2).
This is what I have tried:
:I work out the angle
aAngle =Math.Atan((Y2 Y1) / (X2 X2))
[code].....
View 1 Replies
Aug 29, 2011
I have created tooltips on a form from the toolbox and defined them as owner draw. I tied them to either a panel or a grid and they show up as black boxes the size that would contain the text that is assigned. If I had two areas next to each other, the text shows up. Neither the background or the forground color is black, so the black of the box is not from a color assignment. This has worked at one time and I do not know what changed.
View 2 Replies
May 29, 2012
I use this cod but it not moving the text contnusly Private sub Timer1............ Label1.text = " " & Label1.text
View 1 Replies
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
Mar 17, 2011
I want to draw a rectangle on image where color pixel of image is black
View 1 Replies
May 19, 2010
How does the CheckBox control draw that black check mark in the white box? I can't install .Net Reflector or anything here on my work machine so could someone post the code (vb.net or c# is fine with me)?
Or if anyone knows how to do it (I have an 8x8 Bitmap object I'm drawing on already) I'd like a hand since my math isn't working out correctly[code]...
View 4 Replies
Jan 4, 2012
im trying to download a file to the exact area of the application where ever it might be on hte computer the code im using now only downloads it to the computer and this cant work becuase all computers are diffrent
[code...]
could any one show me how that code could work but instead of to the computer but to where the application is so that who ever uses it can move there application folder where every they want and it will still work
View 8 Replies
Apr 9, 2010
Is it possible to make the scrollbars in my webbrowser a thin black line which moves up and down, instead of the usual ones?So its just a black line (maybe 3pt thick) which is OVER the content, on the right hand side. So as you scroll the black line changes size like a normal scrollbar, but it isn't separated from the content, its actually over the top of it.Sort of like the scrollbars on an iPhone if you've seen them.
View 3 Replies
Jul 25, 2010
I have a program where I have to calculate straight-line depreciation (cost * 1/n) n being the number of years to depreciate, and Double-Declining depreciation (cost * 2/n) using user input for year of purchase, cost, and years of depreciation. The output needs to be put into 4 columns in a list box. Year, Value at beginning of year, Amount of depreciation during the year and Total depreciation to the end of the year.
The problem I am having is with my loop. It is not properly calculating. I'm sure I am doing something wrong that is simple, but I can't see it.
Here is my code; the problem areas are bold:
Public Class frmDepreciation
Dim Cost, Life, Year, Depreciation, BegValue, EndValue, Total, Counter As Double
Dim fmtStr As String = "{0,-10}{1,10}{2,17}{3,5}{4,-15}"
Dim fmtStr2 As String = "{0,-10}{1,10}{2,17}{3,15}"
[CODE]....
View 3 Replies
Aug 22, 2010
I am graphing using Visual Basic graphics and it works. I would like to know how to draw a DASHED line instead of a solid line. Could someone help me with this?gphFormGraphics.DrawLine(Pens.Green, pt2, pt1)
View 4 Replies
Oct 14, 2011
I have a form that uses a button to draw a line and a second button to draw a rectangle. I have a third button to clear the form but can't find a code example to code the Clear button.
View 4 Replies
Dec 10, 2009
I'm creating a shortcut with my application, and its working successfully, except that the "Target" line is being cut off. Not all the arguments are listed. When I run the target application of this shortcut using process.start and these arguments, it runs fine. Is this simply a limitation of the "Target" textbox? Is it simply not displaying all the arguments, or is it functionally limited in this way?EDIT: I have determined that it is simply not displaying the full string, but seems to work correctly. I would still like to fix this somehow, but if not, not a big deal.There are 259 characters in the textbox, including spaces. Doesn't seem like a significant number to me.Here is the code, but it doesn't really matter, it is working fine:
[code]...
View 1 Replies
Mar 31, 2010
For class, I am creating a Tic Tac Toe game. When there is a win I would like to draw a line over the 3-in-a-row. Not sure if this is possible because I used an array of buttons to represent the X's and O's. If this is not possible I would like to highlight the winning buttons.
View 14 Replies
Apr 10, 2010
Surely its possible to draw a line in Visual Studio without writing a dozen lines of code?
Is there a drawing toolbox that's hiding from me?
View 7 Replies
Jun 21, 2010
How come this doesn't work...
Private Sub ColorKeyForm_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
'Draws diagonal line of dot and dash on form
[Code]....
... the top part draws a line on the form but the second part does nothing. The picColorKey is a picture box on the form.
View 2 Replies
Sep 14, 2009
How would I draw a Direct 3D Line in VB?
View 1 Replies
Apr 18, 2009
I searched this forum for the answer before posting this and from what i have noticed there is no "simple" way ofcourse "simple" definition varies from one person to another
my definition of simple is something like this Line(x1,y1,x2,y2,color) or something like that.[code]...
View 24 Replies
Oct 31, 2011
I am building a basic program for kg students,,I have a form with two sets of picture, 5 pictures at left and 5 pictures at right
names of pictures at left are
picEyeLeft
PicListenLeft
PicNoseLeft
PicHandLeft
[Code].....
View 20 Replies
Jun 21, 2010
How can I do the same thing with other shaped like rectangle?
I know that I need x,y,widht,height but it still don't do my rec.
View 1 Replies
Jul 16, 2009
in vb.net i would like to draw a regular line on a form. is there a control to do this?
View 2 Replies
Jun 29, 2009
I need to draw a line on a series of pictures: I have decompiled a movie file to 1200 pictures. I also have 1200 samples of vector data (coordinates of the line: beginning point, ending point , size of vector (length) and direction (angle)... anything). With these data I want for each corresponding picture to draw a line corresponding to this vector data for instance: picture 550 needs to get a line drawn from point (5,95) ... these are (x,y) coordinates. in direction of 5 degrees from a vertical line and length 55. Visual Basic do that? I understand there will be some work in locating the origin of the x,y coordinate system and telling the program what 'size 1' means...
View 4 Replies
Mar 2, 2009
I'm new to Visual Studio.Net. Having trouble learning how to draw a simple line on a Windows Form.
View 4 Replies