[2008] Find Bitmap On Screen?
Mar 2, 2009I need to find a bitmap on the screen?
View 1 RepliesI need to find a bitmap on the screen?
View 1 RepliesHow do you find out what the screen resolution is and then make a comparison. ie if the resolution is 1024 x 768 do one thing else do another.
View 2 RepliesEdit: Fixed, I created a compatibleDC for the graphics object, and a handle for the bitmap (using b.gethbitmap), then used the SelectObject function inside GDI to select those two, and used the compatibleDC instead of hDc in the BitBlt function I've been trying to draw a bitmap to the screen (device 0), however I have encountered a problem copying the graphics using BitBlt.
Initially, I was drawing directly to the desktop using SetPixel (gdi32), but it was slow, so now I am setting the pixels of a bitmap object and then creating graphics from that object, and copying the hdc of the graphics to the screen.My guess is that I am adding the HDC of the graphics object to an intptr, which essentially gives me the HDC of the container of the graphics object, which is not what I need. However even so, I have not found any information on how I could copy a bitmap to a device other than using BitBlt.
This is my current code (Windows forms app, textbox, button) The textbox is the device to copy to, and the button starts it. For testing purposes, set the textbox text to 0, and press the button. You should see a black box (50x50px) in the top left corner of your screen. The colour should be blue if it is working correctly:
Public Class Form1
Declare Function GetDC Lib "user32.dll" (ByVal hwnd As Int32) As Int32
Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As Int32, ByVal hdc As Int32) As Int32
[code]....
The way it works is it calls the function setpx, given a location and color from within a loop iterating through all of the pixels in a box (50x50 in my code). The setpx function will then call the setpixel fuction on a bitmap b. This part is working fine.Next, it will define a graphics object g from the bitmap, and I use BitBlt to copy g's hdc (g.gethdc) to the screen. This is not working correctly?
I am trying to take a png file (around 2000 x 2400) and split it into 8 smaller images of 500 x 1250 each (2 rows of 4), each of which is saved as a png file. I then which to display these smaller png files in a picture box so that they look as if they were one image.
My problem is that when I display the png files in the picture box, lines that look like grid lines show up in the picture box at the points where the png files sit next to each other.
When I view the smaller png files in Paint it appears as if the left column (x=0)and top row (y=0) of each file is set to clear (or transparent). What shows up in the picture box is the background colour of the picture box.
This clear/transparent row and column are not added on to size of the smaller png files. They are still 500 x 1250.Not every file is affected. If the smaller files are created from the original bitmap in the following order[code]...
I created a bitmap, that is supposed to be displayed on the screen, in the middle. It will have to be on top of EVERYTHING!! Even if a full screen application is running, I want it to show. My questions are: Is it possible to even display a CUSTOM MADE bitmap on the screen?
Option Strict Off
Imports System.Drawing.Drawing2D
Imports System.IO[code]....
I'm looking to make a program that would capture your whole screen, then have the picture display on the screen (simulating a frozen screen) to where the person handling the program could select a partial segment of the screen with their mouse and then save to a folder.
1. I have no idea how to go by doing this
2. My form is constantly minimized, so I have to do it without MouseDown on the form and whatnot.
How would I go by doing this?
is there a way of getting the screen coordinates of individual cells on an open Excel sheet, what I want to ultimately do is pass in a cell range say, "A5" into a function and watch the mouse cursor move slowly to that cell. I know this might seem a weird request. I already have a mouse move function but that accepts the x/y coords in pixel terms where excel using .TOP and .LEFT give an entirely different format?
View 1 RepliesThere is Bitmap data on the clipboard from a screen capture. If I paste it into a RichTextBox it works OK. That is, if I remove the first two lines below.
Dim clipboardDataO As DataObject = CType(Clipboard.GetDataObject(), DataObject)
Clipboard.SetDataObject(clipboardDataO)
RichTextBoxTxt.Paste(DataFormats.GetFormat(DataFormats.Bitmap))
However, If I capture the clipboard data and restore it before I paste I no longer get my bitmap displayed in the box. My problem is, in the real situation I need to use the clipboard before I paste which is why I save it and restore it above.
1) Do you know why restoring doesn't appear to work here?
2) I can't paste before the save/restore. Is there something else I can do?
I'm trying to create a DLL with some useful methods and subs for my use. But when I tried declaring an object for Form or using the keyword Screen, Bitmap, etc.. gives an error saying that "The type 'Screen' is not defined" and like that..
View 7 RepliesI need to write a code to find identical adjacent pixels in a bitmap image. It should work as the 'magical wand' in Photoshop. My images are always black and white (white background with car parts drawed in black). Given the x,y coordinate for a single black pixel in the whole image, the code should find (and paint with another color, say red) all other black pixels that are linked to that one, and so on, until all linked black points will be painted in red.
[Code]...
I need to write a code to find identical adjacent pixels in a bitmap image. It should work as the 'magical wand' in Photoshop.My images are always black and white (white background with car parts drawed in black). Given the x,y coordinate for a single black pixel in the whole image, the code should find (and paint with another color, say red) all other black pixels that are linked to that one, and so on, until all linked black points will be painted in red.This way, suppose that I have an image with 4 car parts drawed, then if I give the x,y coordinate of a black pixel, just THAT part to whose the black pixel belongs to should be painted in red. All other parts will remain black. Does it make sense?At the end, there are two pictures (before and after) to help understanding what I need to do to the images.I tried a simple 8-pixel adjacent approach for every pixel (starting on initial coordinate) but it turns out into a very stupid and endless looping algorhitm.
Code:
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
[code]....
I'm using Bitmap to show picture box like slideshow using Timer. For each timer interval, I've to go for new instance of Bitmap, there System memory increases to 1MB, How to resolve this, 'BG is picture box
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tic Dim img As Bitmap
img = New Bitmap(System.Drawing.Bitmap.FromFile(FileIO.FileSystem.GetFiles
[CODE]...
I'm trying to use a ToolTip directly to a Bitmap Object (System.Drawing.Bitmap), aparently I can't do this because Bitmap isnt a Windows Control.
View 1 RepliesI have been trying to make a image recognition function for a program I am making. I am having a hard time getting it to work. It does find the image, but it says pixels don't match after going so far.
The Code below works partially. It will output the program screen as Print.bmp
Will load prizes.bmp
But when it compare the images it exits after half way through like it doesn't match and ouputs test2.bmp as part of the prizes.bmp with a black area in it.
Module ImageFunctions
Public Declare Function PrintWindow Lib "user32" Alias "PrintWindow" (ByVal hwnd As IntPtr, ByVal hDC As IntPtr, ByVal nFlags As UInt32) As Boolean
Sub Print()
[Code].....
how can i create a monochrome bitmap from a semi transparent bitmap in vb.net? the bmp is for a transparency mask image for an icon i'm trying to create with the CreateIconIndirect API function.
i'm using vb2008 .Net3.5, but i would prefer an answer that would also work in vb2005
I'm trying to figure out how I would find the color of a pixle.
Say I wanted to find RGB(255, 255, 0) and get the X, Y, position of it, how would I do that?
I was thinking of a loop with BMP.GetPixel, but I wouldn't know how to check. It's not compatable with RGB.[code]...
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.
View 3 RepliesI've been looking all over the internet and can't find a decent code for an on screen keyboard, that writes letter into another application for example Microsoft word or Notepad.If someone has a code or could point in the right direction that would be awesome.
View 7 RepliesI need help to find pixel color anywhere on the screen by coordinates (for example pixel 377, 496).
View 7 RepliesI know I can find the screen resolution of the Primary screen easily, but I want to find the resolution of the screen that my form is currently sitting in (this is not the same on my setup I have three screens with two different resolutions)the form could span more than one screen so I would be happy with finding the screen that contains the most area of the form/the top left corner.Is there a simple way to do this? I can enumerate the screens, but then working out where my form is sitting within this is tricky:[code]
View 1 RepliesHow To Find Screen Pixel Of Choosen Color?
View 13 RepliesIs there an easy way to find the screen resolution in Windows?
View 2 RepliesI 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?
How do i find the cursor coordinates on the screen in VB 2005 code?
"label1.Text = e.Location.X" Only gives you the coordinates in the program window itself, i want it to be displayed in a label/textbox in relation to the whole screen.
Is there any way to invert the screen. For example, making upside down or having mirror effect?
View 1 RepliesHere is a short program to demonstrate my question. I just want to extraxct a rectangle bitmap from a big bitmap.Code as follows:
Private
Sub Button3_Click(ByVal sender
As System.Object,[code]....
Execution stops when hitting the Dim cloneBitmap statement, which should have created a bitmap out of the rectangle cut out.The message is:
"MissingMemeberException was unhandled.
No default member was found for type 'bitmap"
I just don't get it. Seems that the method Clone(Rectangle, PixelFormat was not found.
I have a grass image located here in my directory. I want to just create a Bitmap, but I am getting an error. (Parameter is not valid.) Immediate Window: A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll
[URL]
private void Form1_Load(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap("grass.jpg");
}
bertino
I was wondering if it is possible to get a bitmap from a gfx... I am painting straight to a panel in the paint method I DO NOT want to have to paint to a bitmap then return that bitmap then paint this bitmap on the panel - as this is a lot slower I am doing this as i need to obtain a bitmap sometimes (if the user has requested it) 1/2 way through a draw eg the user says i want the picture after it has drawn the 3rd curve (just explaining why I want to do it this way)
View 5 RepliesBTW 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?
View 11 RepliesI borrwed some code to capture a image with the onboard Web Cam of my Laptop. It works fine, but is is saving the image as a Bitmap, how can i convert the image to a JPG file? [code]
View 1 Replies