VS 2008 Dragging A Drawing?
Sep 12, 2009Dim fnt As New Font("Verdana", 16)
Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
Dim g As Graphics = pe.Graphics
[code].....
Dim fnt As New Font("Verdana", 16)
Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
Dim g As Graphics = pe.Graphics
[code].....
I am trying to make a rectangle that can be resized by the userby clicking and dragging the edges/corners of the rectangleTypically, if the mouse enters the rectangle region, then smalladjustment boxes should appear at the corners of the rectangleand also at the middle of the rectangle's edges (to allow the userto drag and resize the rectangle). When the mouse leaves therectangle region, then the adjustment boxes should disappear.I have the code to draw the rectangle and to produce the smalladjustment boxes, but I'm not sure how to accomplish thedrag and resizing steps (or if it's even possible with the way mycode is written).
Code:Imports SystemImports System.DrawingImports System.Windows.Forms
Private bBlocking, bValidBox As Boolean Private pt1, pt3 As Point Private rectBox As Rectangle Private cornerRect1 As Rectangle Private cornerRect2 As
[code]....
Right now I have checkboxes on my form, and depending on what check box I check, the value of it gets put into a text box. So if I check "Right Eye", the texb ox below it gets "Right Eye" placed there.
I would like to do away with the check boxes and instead have a new form pop up with a list of words that gets populated from a table. Is it possible to be able to drag and drop these words into a text box? I guess I could use a List Box control for that but I'm unsure how to implement drag and drop. Maybe be able to multi-select words and then drag them all to a certain text box.
I'd like to have give the user the option of adding and deleting words from that form as they see fit, so could I just let VS do that for me by dragging the datasource onto the form and have it create a bindingnavigator or should I do it myself?
I have a datagridview showing data from an Access database. I have dragged the datagridview from "Data Sources" window - and not written any code. In bindingsource I have choose to sort on an autonumber field. Is it possible to let the user use the mouse to change the order, and the database to remember this the next time the user starts the application.I guess I have to have a number field in the database, and write code to change the value in number field as the user change order - and then save this back to the database? Does the datagridview support changing order by mouse at all?
View 1 Replieshow to handle a single attachment being dragged from Outlook - basically this code gets the filename:
Dim fStream As Stream = DirectCast(e.Data.GetData("FileGroupDescriptor"), Stream)
Dim fileGroupDescriptor(512) As Byte
fStream.Read(fileGroupDescriptor, 0, 512)
[code]....
How can i disable a user from dragging a form , with using form border style (None). I want to use a fixed singl border style.
View 3 RepliesI know how to drag a file to a listview, my question is regarding folders... How can I add a folder to the listview? I know a folder is not a file, but, is there a way to "recognize" it as a folder and then add any icon in its place?
View 2 RepliesIs there a way to disable a user from dragging a form other than setting the form border style to "None" ?
View 8 Repliesdraw individual pixels, without resorting to drawing a line and setting it's length to 1. Is there an actual ability to draw a pixel that is just 1 pixel big?
View 2 RepliesI have a little experience with drawing using GDI+ in VB.NET, but not so much with more complex shapes. All I ever used were lines and rectangles, and the occasional ellipse.I need to draw an 'arc' like this:I can specify the starting angle (0 in the picture), ending angle (angle from the horizontal (left side)), and the starting and ending radius, and I'm sure any other things I need can be calculated from that.The problem is that I have no clue which drawing function to use. Can I do it using FillPath, or FillClosedCurve, or? Of course, I could create a pie shape and then draw a second pie shape (slightly less radius) on top of that to make it appear like it's a single shape, but what if it needs to be 'transparent'? I don't want it to draw a solid shape on top.
View 17 RepliesI need some code to draw a resizable, draggable rectangular cursor (or selection box) on a picturebox. I found some excellent code (albeit rather old) that does just that, but on a form rather than a picturebox. I have tried converting the code - basically moving things to the picturebox events (Paint, MouseDown, MouseMove etc). It nearly works but leaves a trail behind it when you move or resize the cursor. In other words, the selection rectangle is not being erased before being drawn in the new position.
Is there some fundamental difference between drawing graphics on a form and drawing on a picturebox that would cause this behaviour? Something like, when you invalidate a form and cause a redraw it erases what you did last? If not, then I just need to dig a bit further and work out how the cursor is being erased from the previous position.
Here's the original code that works fine on a form:
Private DragRect As New RectangleF(20, 20, 100, 80)
Private Adornments(7) As RectangleF
Private MouseInRect As Boolean = False
[Code]....
I have made a program in which a small space ship rotates, with some tutorials I found, then when i tried to move it I realized that .location does not work for bitmaps..
View 1 RepliesI have a Custom Groupbox that overrides the OnPaint event to do some custom drawingbackgrounds, etc. The problem I have is that when I use it in an application and want to draw text on the control, it gets drawn first, then immediately afterwards the OnPaint from the control gets called and draws on top of the text. Is there any way to get the text drawn after the control's OnPaint?
View 1 RepliesI am having a bit of trouble drawing a grid with GDI+ and VB.net 2008. The grid is designed as one point perspective. The horizontal lines are not correctly positioned, and the form is taking a long time to draw. Could anyone suggest a faster, and mainly more accurite method?
Here is my code currently:
Public Class Form1
Const VanishPoint = -200
Dim g As Graphics = Graphics.FromImage(New Bitmap(Me.Width, Me.Height))
[Code]...
I want to draw a line on a image, easy enough in principal the image is a map and the lines is between city pairs?
View 12 RepliesI have my application to where you can load up an image and draw on it with the mouse left down and drag.Only problem is, if the form becomes the inactive one or is minimized/maximized the drawings go away until I scroll the image in the form (I put the redraw functionality in the picturebox.Paint event).How can I make the lines I draw stay permanently? I've put picturebox1.refresh in the minimizedchanged/maximizechanged and form.activated events and still nothing..Even tried the picturebox's resize event and nothing?
View 18 RepliesI'm trying to draw text on the progressbar. This code below works, but when the progress bar re-paints itself the text disappears.
ProgressBar1.CreateGraphics().DrawString(Vaule & "%", New Font("Arial", CSng(8.25), FontStyle.Regular), Brushes.Black, New PointF(ProgressBar1.Width / 2 - 10, ProgressBar1.Height / 2 - 7))
jmcilhinney suggested i look into the PaintEventHandler.
I read the MSDN documents, but they used PictureBox(). I made this code below, but no luck.
[code]....
my assignment is to draw a graph within my VB form with a some variables I have. I was told by my boss that I should use Microsoft Chart Control 6.0, but I don't think it matters if it is in another software.I currently have a few variables, each with a lot of values, "Frequency", which is user entered from maximum to minimum, CH (channel) 1-4 which are given by a machine output I use at my company. My graph, is supposed to have the Frequency values in the X-Axis (horizontal) and the CH 1-4 values within a range of each other in the Y-Axis. Can anybody help? My code for extracting the data and getting the frequency is below. How I got most of it is thanks to Stanav, the thread is over here: url...It comes with 3 buttons (I have not put in the code for button 3), the 3rd button will be used for plotting the graph when clicked.
View 3 RepliesI have a Custom Groupbox that overrides the OnPaint event to do some custom drawing,backgrounds, etc. The problem I have is that when I use it in an application and want to draw text on the control, it gets drawn first, then immediately afterwards the OnPaint from the control gets called and draws on top of the text. Is there any way to get the text drawn after the control's OnPaint?
View 3 RepliesSay I have 3 Buttons, labelled: Unit 1, Unit 2 and Unit 3. When I click on any button I want a drawing of that unit to appear on screen at a pre-specified starting point. Thereafter when I press any other one of the buttons the unit drawings appear alongside each other in a line. So I could end up with:
[Code]...
With this line...
If PictureBox1.Image = My.Resources._2star Then
I get this error: Operator '=' is not defined for types 'System.Drawing.Image' and 'System.Drawing.Bitmap'.Is there another way to say = with images?
I'm trying to draw a simple rectangular gradient but I keep getting this one error. Here is the code below: Drawing::Rectangle^ myRectangle =
gcnew Drawing::Rectangle(10, 10, 100, 100);
Drawing2D::LinearGradientBrush^ myGradient =
gcnew Drawing2D::LinearGradientBrush(myRectangle ,Color::Red, Color::Blue, 50);
e->Graphics->FillRectangle(myGradient, 20, 30, 100, 100);
I have been looking through the code bank and i cant find anything that is helping me with my problem what i have is a print button that when clicked it goes to my print preview page, then i can print the file. i have got all the other controls on my page to display correctly using this example
e.Graphics.DrawString(sType, New Font("Arial", 10, FontStyle.Underline), Brushes.Black, 110, 650)
but how can i get my ListView header and content to preview on the page as well. my listView has 5 columns and i am using the PrintDocument control.
I've got a fun little question for you all. I am designing a program that allows you to click on a picture to input data in certain areas. What I want to do it pretty allow someone to take a look at a picture. Click the add point tool, then select an area on the picture where it places a circle. I then want them to be able to go back to the circle and modify data if necessary
View 8 RepliesThis may be a stupid question, but is it possible to add things like lines to a form easily? Without creating the line manually using System.Drawing?
View 5 RepliesI'm trying to draw on screen using the mousepath, as I understand I should use the GetDC function and ReleaseDC function, what I want to do is when the mouse left button is down I want to draw anywhere on the screen the path the mouse did (like painter but on the screen), The main problem is that when I draw I have to clean it up later (After the left mouse is up). How can I use the Mousepath to draw on screen?
View 2 Replieshow to draw an unknown amount of images to a form
the amount of images should be determined during runtime.
I have been struggling with this issue for like 3 days now. What I need is ONLY a printcopy of a receipt. To do this, I made a template with labels to display respective values(pulled out by SQL statements).
View 1 RepliesIs it possible to convert an object form System.Drawing.Graphics to System.Drawing.Image?
View 4 RepliesHere is my favicon code
Dim oURL As Uri = New Uri(e.Uri.AbsoluteUri)
Dim favicon As Image
If oURL.HostNameType = UriHostNameType.Dns Then
[code]....
The error is Value of type System.Drawing.Image cannot be converted to System.Drawing.Icon Is it even possible to make the favicon be the icon of the form?