VS 2010 Painting When To Draw/erase Snap Lines?
Oct 6, 2010
I have started to work some more on my 'shape editor'. If you're not familiar with it,ust imagine the Visual Studio form designer: a 'canvas' (the form) with a bunch of 'shapes' (the controls) that can be selected, moved, resized, etc. I have just finished implementing snapping between shapes and the canvas boundaries. But now I am having some slight issues with painting the snap lines.Just FYI: this is what I mean by snap lines:The blue lines that indicate that the 'buttons' are snapped to each other, and a purple line indicating that button1 is snapped to the boundary.
My shape editor is based loosely on jmcilhinney's 'manipulating GDI+ drawings' codebank entry, and a central idea in that post is to only draw what is necessary. In other words, when I move a shape I could re-draw the entire canvas, but it is much faster and smoother to only re-draw the old and the new location of the shape. Since nothing else has changed, I don't need to draw the rest. So, I simply invalidate the old bounds and the new bounds, and even with a lot of shapes all moving simultaneously it still feels very smooth.
View 13 Replies
ADVERTISEMENT
Dec 21, 2010
I'm looking to draw a trackbar normal, only with a transparent background. I have created a new class that supports transparent backgrounds set to true. Without using userpaint, the trackbar does nothing or takes the color of it's parent. When using userpaint I have to draw the control on mine own. Not quite sure where to start first though...
I've read about drawing a line (not so hard), drawing a floating object (to act as marker), and handling events on when the floating object moves left/right... Drawing 3 separate objects inside an inherited trackbar control seems like a clunky way of calling methods that should exist somewhere? Is there an easier way to draw the control normal without a background? If not, some in starting to implement all 3 new objects working together would be good (I could draw them separately but that's about it).
View 1 Replies
Nov 11, 2011
I have created a custom ToolStripProgressBar. It is basically a class inherited from ToolStripStatusLabel, and i paint the 'progress' bar myself (just a simple rectangle). I have tried creating a custom ToolStripProgressBar using different methods including inheriting from both ProgressBar, ToolStripProgressBar and ToolStripControlHost. I always ran into difficulties doing in this way. Inheriting from ToolStripStatusLabel works well, but with one issue...
In order to have the progress bar update in the statusbar, i have to call StatusStrip.Refresh. Trouble is, adds a huge overhead to the drawing of the progress bar graphics. Simply calling the invalidate method of my ToolStripStatusLabel does not seem to render anything to the screen. how to have my graphics draw without calling the refresh method?
View 1 Replies
Apr 13, 2011
I display a Chart with several graphic lines on it. What I want to do is draw a line (using the mouse) overtop or below the chart such that it can be seen on the chart. The mouse line draw code is below. What is required is either make
the line always be on top or make the chart transparent. I don't know how to do either and I don't know if it is possible in Visual Basic 2010 as it was in VB2.
Private Sub frmComDashBrdGraph_MouseDown(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
If e.Button = Windows.Forms.MouseButtons.Left Then
[Code].....
View 9 Replies
May 14, 2010
I am creating a program that will allow you to sketch out a house-floor-plan... I am using Snap-To-Grid code. The snap to grid works fine but i need a label that appears in the middle of the lines that are being drawn that represents the length of the line in feet. This will be saved as a bitmap image, so i need the length to stay visible after the lines are drawn. I have found code for a "symbiote-line", but it displays the text in a caption and the caption dissappears as soon as a line is drawn. I need the text to still be visible after the mouse-up event is fired. This is similar to the way i need the line to look.
[Code]...
View 1 Replies
Aug 26, 2011
I want to draw string in multiple lines and and I want to know how many lines given string will take. I am using following method.
[Code]...
View 1 Replies
Jun 7, 2011
tried to dissable the Snap to Grid feature from the "Tools" menu "Options" under the category "Windows form Designer "General" with out any luck, every time I tried to postion any of my controls on the form, I still see the blue and pink alignment lines and I can not align them where I would like to postion my controls on the form, any one can shed some light on this feature or could it be a bug?
View 1 Replies
Oct 25, 2008
I'm making the transition from VB6 to VB2008 and I'm having difficulty finding the equivalent to[code]...
It seems in VB2008 I can only use pens inside a picturebox1_onpaint() subroutine, I can't tell a picturebox what to do from a button_click subroutine or form_load subroutine first and then send the results to a picturebox. I have no control over when the graphics are drawn and from which subroutine. How do I solve this in VB2008 ?
View 7 Replies
Apr 11, 2009
I have a simple picturebox, line drawing procedure (call it "DrawTheLine"), which fires ok when I call it from a command button. But when I try to call it from the boot form_load procedure it doesn't work; no lines draw. No errors are raised.
Things I've thought of are:
1. The form_load procedure is not done creating all of the controls on the form, so it can't work with them yet. Doesn't make sense because my drawing call is the last thing in the form_load procedure, and it executes, but the picturebox does not show the lines.
2. Tried Application.DoEvents, but no go.
3. Tried using picturebox.invalidate to force a paint event and "called" the drawing procedure that way, with the appropriate arguments. Again, the procedure "DrawTheLine" fires, but no lines draw to the picturebox.
View 15 Replies
Sep 21, 2011
I have the following form:I want to join the boxes so that it looks like this: would rather create the lines on the userform manually but I do not think there is a way to do it. I've tried the following code but I cannot see the line:
Private Sub DrawLine(ByVal X_From As Integer, ByVal Y_From As Integer, ByVal X_To As Integer, ByVal Y_To As Integer, _
ByVal Line_Width As Integer, ByVal Line_Colour As System.Drawing.Color)
[code]....
View 3 Replies
Jun 12, 2011
Iam doing a sample project for school and i CHOSE Tic Tac toe. sample program of it becuase i have no idea where to start. And do I use a picture box to draw the lines?
View 1 Replies
May 29, 2009
I need to draw dashed lines. I use this code:
Dim MyPen As Pen = New Pen(Color.Black, MyWidth) With {.DashStyle = Drawing2D.DashStyle.Dash}
MyGraphics.DrawLines(MyPen , MyDots.ToArray)
But since the distance between successive lines it too short, the dashes start each one too near to the last. It causes a continuous black line
View 10 Replies
Aug 24, 2009
How would I do this? I want my Program to draw 2 lines in the center of the screen.
View 3 Replies
Apr 25, 2009
I can draw one line by mouse moving on a form, but i used cls function to clear screen when move mouse (otherwise it wont show single line when move mouse), so i cudnot draw next line with out clearing previously drawn line, kindly help how to solve this problm
[Code]...
View 1 Replies
Aug 19, 2011
I am making a drawing application (Graphics class), with a highlight pen and a calligraphy tool. But the pen tip should not rotate according to the line direction. I have tried the CustomLineCap, but still not working.
View 3 Replies
Feb 2, 2011
How to draw lines inside the circle. I mean a circle with n-number of lines within in it.
View 7 Replies
Nov 1, 2009
Firstly I am using Vb 2008 Express Edition.I have the following code:
Code:
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e _
As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim x1 As Integer = 0
Dim x2 As Integer = 50
[code]....
When I run the above code it works , no problem. But I want to trigger it only on my Button_click event.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
I don't know how to call the PictureBox1_Paint into my Button1_Click
View 7 Replies
Jun 20, 2012
i want to "draw" zebra lines in my form [code] ican import background image, but I prefer code :)
View 1 Replies
Feb 15, 2006
The image editor toolbar is not active. I would like to draw lines and shapes on a form.
View 1 Replies
Apr 5, 2010
I need to draw lines, in one VB form. Like paint, I need the tool brush, and design some lines and curves in a Vb form. How can I do this? I don't know where to start.
View 3 Replies
May 1, 2010
How do I draw lines using DirectX? (on my form)
View 1 Replies
Jun 4, 2010
I'm tired of looking at the boring default dark gray back of an MdiParent. I tried using Juggalo's Gradient Form and realized that the MdiParent was not being painted, at all. A temporary work around was to create an Image and set it as the background. This is fine and dandy but when I bring the thing to full screen and drag around my MdiChildren forms, the application gets laggy. I have already tried setting the Form to Double Buffered and it doesn't work at all, no noticeable change.I did try editing the Form's Paint() event, but to no avail.Here's the code I'm using to create the image (practically from Juggalo's Gradient Form):
[code]...
Creates the image nice and fast. I want this to happen in the Form's Paint Event though, so I don't have to rely on an Image that causes my program to lag about.
View 39 Replies
Dec 7, 2011
I'm trying to draw a grid using vertical and horizontal lines.Both For..To statements work fine when one of them is commented out otherwise, they won't work together. At run, only the first For..To statement is executed.[code]
View 6 Replies
Nov 6, 2011
I have some lines drawn in many different directions (2D y 3D enviroments). Is there any way to draw text oriented along the direction of each of these lines? It was an easy task in former versions of Visual Basic, but now it looks like a very tough -almost impossible- mission.
View 4 Replies
May 9, 2012
I'm trying to do something that is turning out to be out of my league at the moment. I need to draw geometric figures. These geometric figures have all the coordinates of their corners. Say I have a trapezoid, and I would want to draw it. The drawing would be done in a picturebox or a panel or a groupbox (some part of the form where only the geometric figure will be).
I saw the method on how to do that Here and that's exactly what I'm trying to achieve, but there it's drawn on a newly created form, and I need it in a picbox, panel or groupbox as I mentioned above. I also need the drawn figure to be at the center of the picbox/panel/groupbox.
The coordinates of the lines should be like (xa.text,ya.text) to (xa.text - xb.text, ya.text + yb.text) if I'm not wrong for the first line of the geometric figure and so on.
View 3 Replies
Mar 4, 2009
How do I draw lines like these ones at top (underneath the white box) and bottom (above the buttons) - preferably in the GUI?
View 6 Replies
Nov 20, 2011
I think we can just draw an image that resemble the grid using this article : drawing in a datagridview Currently creating a way to make the image drawn in tile mode. Each time I develop a datacentric application using VB.NET regardless of how much the data displayed in the datagrid, I always want the grid to display full row of empty data, not just blank panel. Can we achieve this using VB.NET design time property? And also, we must not trigger the display of vertical scrollbar this way..
View 1 Replies
Oct 17, 2010
I am currently using Visual Basic 2008 Express Edition.I want to make a program that will draw 700 random lines on it initially. I tried my code but the lines only appear in the same way such as straight line and diagonal line. Here's my code:
Public Class Form1
Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
[Code].....
View 3 Replies
Oct 22, 2009
I've got a project where I want to be able to display a world map and draw lines between cities.I've looked at using a web browser with google maps but don't want it to have to be used while "online"
I've looked and longitude and latitude and converting these to UTM co-ordinates but i'm lost for how to place these on world map programaticly.I have a full list of all cities used in my program and have a list of their latitude and longitude co-ordinates because i need to work out thier distance apart which I have already done the code for.
View 9 Replies
Aug 4, 2009
I am using VB 2008 and wonder if there is a way to draw lines between the data elements in two listviews to bind the elements together?
View 1 Replies