I'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?
I have a bit of an issue here. I made a "Colour picker" dialog in my program with which you can pick the colour at the mouse. It is a simple topmost form with an OnPaint handler used to draw a coloured border around the cursor:
It uses a transparency key to make the non-drawn parts of the form transparent.
It uses the following code to prevent the mouse from clicking through the screen:
It sets Layered to True and Transparent to False. This works in Windows 7, but on a XP machine it fails. When moving the mouse the event does not go to the forms' event handler and you can just click through. For a screen region selector I simply made a screenshot, but I want the Colour Picker to remain updated. (just in case you want to get the colour of an animated control)
How can I get this to work on a Windows XP machine?
Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As IntPtr Dim g As System.Drawing.Graphics Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
I'm upgrading to VB2008 from VB6 and have noticed that when drawing a small diagram on the screen it is much slower. In VB6 is is drawn 'instantly' in VB2008, 34 lines, 5 arcs and 15 text items are taking 112000,000 ticks to draw- I can see it being drawn line by line. The codes contains the code to draw the diagram and some minor calculations to determine what to draw. If I just draw 4 lines directly it takes 80,000 ticks which looks 'instant'. It looks as if the calculations are slowing it down. Is there some reason for this, is there a box I have not ticked that makes it slow?
how to Draw text directly to the screen - effectively overlapping anything underneath it - but have it out side a form area! I would really like to have no user interface at all if possible I know what I wanted after recently using FRAPs.
I'm putting together a small program in Visual Basic Express 2010, and part of it is to take a delayed screen shot.
I've got the main code working, I've got Visual Basic delaying taking the screen shot with System.Threading.Thread.CurrentThread.Sleep(5000), but what I'm looking for is a way to draw directly to the screen the number of seconds remaining.
You know how in Windows, in the Display Properties under Settings, when you click on Identify you get a huge number displayed on each monitor?
I'm trying to recreate that, with the number counting down until the screen shot is taken, giving the user plenty of notification to get their required applications in focus for the screen shot.
Is it possible to do this? Or is it something that will take a heck of a lot of coding?
I send a message a while ago and no one answerd, how can I draw directly on the screen (not on a specific window) just on the screen, neither if it's on the desktop or anything else.Is there is any option to bring up the switch between applications window (Alt + Tab), I don't want to use sendkeys because the user need to keep the key down and I just want the user to select the application with his mouse.
I have a button btnRegEx that when pressed shows a ContextMenuStrip, similar to the '>' button in the Find/Replace dialog in Visual Studio when you are using Regular Expressions. I have a ContextMenuStrip cms which I show using its Show(x,y) method.
At first I was simply setting x and y (the location of the ContextMenuStrip) to some point next to the button, but I noticed that when the button is close to the edge of the screen it goes off screen. I wanted to prevent that so I built some logic into the x-y calculation. When the ContextMenuStrip width is larger than the 'remaining space left' I simply show it more to the left. Same for its Height of course. I am using the Screen.GetWorkingArea(point) method to determine the 'remaining space left'. As I understand it, it returns the working area closest to the point you specify (to which I pass the button's location).
As long as I stay on my first monitor, it is all working perfectly fine. The problem occurs when I move the form to my second monitor. The contextmenustrip is still showing on the first monitor for some reason...
Here is the code I am using:
vb.net Private Sub btnRegEx_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRegEx.Click Dim p As Point = PointToScreen(New Point(btnRegEx.Left, btnRegEx.Top)) Dim x, y As Integer
[CODE]...
I have noticed that when I click the button when the form is on the second monitor, the buttons location (p) is calculated with the first monitor's top-left corner as (0,0), even though it is on the second monitor. This way, the GetWorkingArea function returns something like 1280, while the buttons x-location is something like 1700... So, how do I get the buttons coordinate relative to the actual screen it is on, rather than the entire dual monitor screens as a whole?
BTW this issue occurs in any MS office program when the VB.Net (or even VBA) is processing information.Example: In Excel, a worksheet is displayed on the screen. I start either, a VB.Net or VBA procedure and within 30 seconds the Excel worksheet (previously displayed) blanks out. In both VB.Net and VBA,ScreenUpdating = False. My expectation is that the previously displayed screen would stay static as if I left my desk to get a cup of coffee; came back and the same ole Excel worksheet was still there?Of course, setting VBA Screen Updating = False accomplishes two goals: 1) speeds up processing and 2) saves the user from seeing unnecessary "garbage-processing" steps.Why does VBA or VB.Net ScreenUpdating = False not freeze the screen at the time of its invoking?
draw 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?
I 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.
I 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
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..
I 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?
I 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))
I 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?
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.
I 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?
Say 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:
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
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).