473,385 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

bitblt Function in VB 2005

Is there a way to use the windows bitblt function in a VB 2005 app? bitblt
requires device context parameters for the source and destination controls
but those are not used in VB 2005. Is there some way around this? I have a
program that uses a timer ... when it fires I want to copy a small block on
the screen to a particular location.

Thanks

Feb 21 '06 #1
3 2191
Have you checked the System.Drawing namespace ?

Basically .NET is about providing access to OS capabilities as a library of
classes (that do not necessarily model the underlying API). For device
context, try System.Drawing.Graphics...

--
Patrice

"fripper" <yo***@indiana.edu> a écrit dans le message de
news:Ob**************@TK2MSFTNGP09.phx.gbl...
Is there a way to use the windows bitblt function in a VB 2005 app? bitblt requires device context parameters for the source and destination controls
but those are not used in VB 2005. Is there some way around this? I have a program that uses a timer ... when it fires I want to copy a small block on the screen to a particular location.

Thanks

Feb 21 '06 #2
"fripper" <yo***@indiana.edu> schrieb:
Is there a way to use the windows bitblt function in a VB 2005 app?
bitblt requires device context parameters for the source and destination
controls but those are not used in VB 2005. Is there some way around
this? I have a program that uses a timer ... when it fires I want to copy
a small block on the screen to a particular location.


If you cannot use the 'Graphics' object to blit the bitmap, you can use a
'Graphics' object to get and release a device context handle (methods
'GetHdc', 'ReleaseHdc').

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Feb 21 '06 #3
Here's a bit of code using bitblt and the Graphics object..should work in
2005 but don't know since I use 2003:

Private Function CopyRect(ByVal Src As Graphics, ByVal RectF As Rectangle)
As Bitmap
'Create Empty BitMap in Memory
Dim srcBmp As New Bitmap(RectF.Width, RectF.Height, Src)
Dim srcMem As Graphics = Graphics.FromImage(srcBmp)
'Get Device contexts for Source and Memory Graphics Objects
Dim hdcSrc As IntPtr = Src.GetHdc
Dim hdcMem As IntPtr = srcMem.GetHdc
'Get The Picture inside the Rectangle
BitBlt(hdcMem, 0, 0, RectF.Width, RectF.Height, hdcSrc, RectF.X,
RectF.Y, 13369376)
'Return Clone of the BitMap
Dim rb As Bitmap = CType(srcBmp.Clone(), Bitmap)
'Clean Up
Src.ReleaseHdc(hdcSrc)
srcMem.ReleaseHdc(hdcMem)
srcMem.Dispose()
srcMem.Dispose()
Return rb
End Function
--
Dennis in Houston
"fripper" wrote:
Is there a way to use the windows bitblt function in a VB 2005 app? bitblt
requires device context parameters for the source and destination controls
but those are not used in VB 2005. Is there some way around this? I have a
program that uses a timer ... when it fires I want to copy a small block on
the screen to a particular location.

Thanks

Feb 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DraguVaso | last post by:
Hi, In the override of the Paint-method of a DataGridTextBoxColumn I want to show an image with BitBlt, to see what I can gain there on performance. The problem is: It doesn't show me the image...
5
by: JackS | last post by:
I am trying to use GDI32 bitblt to write a bitmap to a control's window, but all I get is an empty rectangle of some rop-dependent color. In short, I use the following logic in a paint event handler:...
5
by: _R | last post by:
I need to establish a canvas for sorts, for painting primarily single line pictures. Lines and images are currently drawn into raw graphics space which is derived from a control, using LockBits. ...
7
by: VB Programmer | last post by:
I am using the BitBlt operation to capture various controls into jpegs. It's almost like a screen capture, but of just the control. (This is a VB.NET application.) Because of BitBlt limitations...
0
by: Qwert | last post by:
Hello, kind of a specific question, but here it goes: The following code works: Dim objGraphicsSource As Graphics = PictureBox1.CreateGraphics Dim bmpSource As New Bitmap(PictureBox1.Width,...
7
by: matt | last post by:
Hallo, I have to create a simple sprite movement; in VB6 I used the API BitBlt and all was very good. Using the NET graphical methods (not API) , the result is slow. Do you have a NET...
7
by: Galen Somerville | last post by:
I'm doing something wrong. I made up a test app and put the ZIP file on my website http://home.surewest.net/galen/index.html under Downloads. Basically I have a Panel that will get continuous...
6
by: Martijn Mulder | last post by:
/* BitBlt.cs C# code using P/Invoke I have good reasons to use P/Invoke to get access to the Win32 API function BitBlt(). But I have trouble understanding the workings of it. Below is a...
5
by: =?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?= | last post by:
I'm trying to copy a part of an image (a rectangle) width the bitblt api function, bu i receive an error when i try to do it. The error is the following, that i will try to translate because its in...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.