Solved

Help DrawImage in System.Drawing Namespace

Posted on 2008-10-14
7
805 Views
Last Modified: 2013-11-26
In the past when coding using VB6 I frequently use to use BitBlt to transfer images to the visible screen. One function this offered was the ability to "AND" the source image, with the destination image. I cannot find a way to do this in VB.Net. Does anyone know if it is possible using the System.Drawing namespace ? or is there a different way to product this function ? or should I stay with BitBlt (and is API Bitblt still supported in Vista?)


 
0
Comment
Question by:Blackninja2007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 250 total points
ID: 22710856
Well... I don't know what type of operation you can do with that "AND" operation... but for sure that BitBlt (that in the past I used often, too) IS supported in Vista, at least in 32bit versions.
0
 
LVL 3

Author Comment

by:Blackninja2007
ID: 22710964
What I can do with "AND" is create a grey scale bitmap for something like a SevenSEG Display, then when I blit it in if the desitination is cleared to red first the SevenSEG display appears Red LED, if the destination is cleared to green the SevenSEG display appears Green LED, and with a little bit of maniulation you can also generate a sevenSEG display that looks like LCD or BackLit LCD all from a single bit map.

Is BitBlt still accepted as good/acceptable programming structure then for this kind of function ?



0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 250 total points
ID: 22711381
You can still BitBlt in .Net.  Just change your API declarations so that "Long" becomes "Integer"...don't forget to change variables in code as well.

For window handles you can use "IntPtr" instead of "Integer".
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 3

Author Closing Comment

by:Blackninja2007
ID: 31505821
Thanks for you assist, I guess confirmation for me to use bitblt, as .NET does not provide this functionality. Thanks again.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 22715641
If I understand correctly you can do this in .Net...I ~think~ you want something like this:

        Dim bmp As New Bitmap(someWidth, someHeight)
        Dim G As Graphics = Graphics.FromImage(bmp)
        G.Clear(Color.Green) ' fill it with green

        ' ...draw on it somehow...
        ' Manually:
        G.DrawLine(Pens.Black, 0, 0, 100, 100)

        ' Draw another Image on top:
        G.DrawImage(someMemoryImageHere, New Point(0, 0))

        G.Dispose()
        ' ...do something with "bmp"...
0
 
LVL 3

Author Comment

by:Blackninja2007
ID: 22717406
Hi Idle I have attached an image showig a sample of what I mean.
Image1.jpg
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 22717635
Ok...so more of an alpha blend image then?

That is also possible to do in .Net:
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_21302112.html#13228503
0

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question