o
k
q
u
e
s
t
i
o
n
s
.
c
o
m

Convert this code to .NET (Text to Image) -

Hi guys
I was converting my project into .net but about this part of code is like that VS 2003 and VS2005 are both unable to convert it.

Code:
Public CurrentSub As Integer
Public SelStream As Integer
Public myFont As New StdFont

Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (ByVal hdc As Long, ByVal lpsz As String, ByVal cbString As Long, lpSize As Size) As Long
Private Declare Function FillRect Lib "user32" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function StrokeAndFillPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function BeginPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function EndPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function OleTranslateColor Lib "oleaut32" (ByVal lOleColor As Long, ByVal lHPalette As Long, lColorRef As Long) As Long
Private Declare Sub OleCreatePictureIndirect Lib "oleaut32" (ByRef lpPictDesc As PictDesc, riid As Any, ByVal fOwn As Long, lplpvObj As Any)
Private Declare Sub CLSIDFromString Lib "ole32" (ByVal lpsz As Long, pclsid As Any)
Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type
Private Type Size
    cx As Long
    cy As Long
End Type
Private Type PictDesc
    cbSizeofStruct As Long
    picType As Long
    hImage As Long
    xExt As Long
    yExt As Long
End Type
Const PS_SOLID = 0

Function Text2Image(Text, Font As IFont, ByVal BackColor As OLE_COLOR, ByVal FillColor As OLE_COLOR, LineColor As OLE_COLOR, ByVal LineWidth As Long) As StdPicture
    Dim hdc As Long, hBmp As Long, hFont As Long, hBrush As Long, hPen As Long
    Dim hDC0 As Long
    OleTranslateColor BackColor, 0, BackColor
    OleTranslateColor FillColor, 0, FillColor
    OleTranslateColor LineColor, 0, LineColor
    hDC0 = GetDC(0)
    hdc = CreateCompatibleDC(hDC0)
    
    hFont = SelectObject(hdc, Font.hFont)
    
    Dim sz As Size, rc As RECT
    GetTextExtentPoint32 hdc, Text, Len(Text), sz
    sz.cx = 500
    sz.cy = 100
    hBmp = CreateCompatibleBitmap(hDC0, sz.cx, sz.cy)
    hBmp = SelectObject(hdc, hBmp)
    
    ReleaseDC 0, hDC0
    
    rc.Right = sz.cx
    rc.Bottom = sz.cy
    hBrush = CreateSolidBrush(BackColor)
    FillRect hdc, rc, hBrush
    DeleteObject hBrush
    
    hBrush = CreateSolidBrush(FillColor)
    hBrush = SelectObject(hdc, hBrush)
    
    hPen = CreatePen(PS_SOLID, LineWidth, LineColor)
    hPen = SelectObject(hdc, hPen)
    
    BeginPath hdc
    TextOut hdc, 0, 0, Text, Len(Text)
    EndPath hdc
    StrokeAndFillPath hdc
    
    hPen = SelectObject(hdc, hPen)
    DeleteObject hPen

    hBrush = SelectObject(hdc, hBrush)
    DeleteObject hBrush

    hBmp = SelectObject(hdc, hBmp)
    DeleteDC hdc
    
    Dim pd As PictDesc, IPic(15) As Byte
    pd.cbSizeofStruct = Len(pd)
    pd.picType = vbPicTypeBitmap
    pd.hImage = hBmp
    
    CLSIDFromString StrPtr("{00020400-0000-0000-C000-000000000046}"), IPic(0)
    OleCreatePictureIndirect pd, IPic(0), True, Text2Image
End Function
can you give me hand on this? and is there a chance to have antialiasing support and make the BMP file only 4 bit per pixel or 8 bit or even have option to select and at the same time have Auto sizing and Constant size... if you could put some comment in your code then I would learn it and can modify it myself.


and will it automatically support unicode or have to be adjusted?

thanks in advance

 

Convert Image into Text -
How can I take an image and convert it to text? I have not done this yet, but I intend to do the following: - Take a screen capture somewhere (which is text). - Possibly change all the color of the non-text (which I will know the color of the true text) to some other color if thi


Save or convert -
Well i have a image that im going to use in pain so i whant to convert that image to a 8 bitt image or a 256 color image that is the same thing. now the problem is: how do i convert a picturebox image to a 8 bit image ??? ty for help


Convert a picture to text -
Hi, I was wondering if I can convert an image in a picturebox to text so I can email it to myself. Then I want to convert the text back to an image on a different computer. Thanks


image conversion thru vb -
I have an image stored in a database. I need to be able to view this image in a webbrowser control as a 'logo' for the report. Is it possible to convert this image to a jpeg format, or any format viewable from a web browser. Currently, I am able to extract the image from the d


How do convert image files -
Hi all, I'm trying to write a object in VB which is supposed to take a image file (for exmaple .tiff) and convert it to 2 new files (jpg and gif) My problem is that I have no clue whatsoever how I should solve the conversion part. Anyone have any code examples of how to con


How can i convert an image from 24 bit to 16 bit -
How can i convert an image from 24 bit to 16 bit Hai, I am developing an application in vb in which i had to transfer images from a client system to the server. I need to convert these images from 24 bit to 16 bit pixels. Can anyone help me in doing this ? I need some method


*URGENT* Coverting a Image to a string/number -
I want to be able to convert a image (already in a image box) to a string. I will then send it over winsock, and want to convert it back. Making the image quality a slinch lower would be a bonus (to make it faster). Thanks, ___ Dan


Reading Image Document - URGENT -
hi to all I have Image Files which have Convert as Document to Image file Image format is .jpg or .gif. Now i want Read this Image file and need to get that Documnet Data. I tried with some freedownloaded Softwares. they are help less. Can any one give me a Sample Code to


Convert Image to String -
Hello, How we can convert an Image to String and then String to Image. The goal of this conversion is to store an small image(Max 50KB) into a nvarchar field of a SQL database. Regards, Parham


[02/03] Image Convertor -
Hi there, Is it possible for a person to browse to an image of any type (.jpg,.gif,.bmp,.png, etc) and then convert it into a selected format and size? i.e. i select c:\1.bmp (1024 x 768) and i want to convert it into a c:\1.gif (100 x 100) does anyone have any idea how i would code


Image to Text convertor -
Hi, I want my application to recognize the text available in image file(.jpg or .bmp or.img) and copy the same text in image format like Readiris(OCR-Optical charecter Recognizer) or Autocad 2000(there is a option to convert image to text). Is there any third party dll availab


convert tiff to pdf and display pdf via aspx page -
Hi All My aspx page retrieves the path to a tiff image on the server, I would like to convert the tiff image to pdf and display the pdf. I have found various converters that iether convert on the command line or via a printer driver. I created an activex library which basicaly


picture colour depth. -
Hopefully someone here can help, ive spent the last 3 nights searching the forums and the web trying to find example code of how to do this. I need to take a 32, 24 or 16bit image and be able to convert it to another picture box as a 32,24,16,8 and 4 bit image. My gf wants a (don


API for converting image format. -
Hi all, I am developing a small utility in VB to convert image from one format to another format. For example if a image is in *.BMP this has to be converted to *.GIF/*.JPG... etc... Is it possible using an API to convert image format or an other possible way to do this... T


help convert C++ into VB code -
Hi all. I have got some code that takes a bitmap, loads it, does some calculations and then displays the new image. My porblem is that is in Borland C++ version 3.1 for windows 3.1 My c++ is not great, so I am trying to convert the code into visual basic code. Firstly, will that be


can any body help me plz. -
can any body help me to write this code: i want to convert an image to text like convert this image to this text "10:01" plz help me coz i'm realy need it bye


Gif image looks like as a little square texture -
Hi all, I have an app which uses encoder to convert an image to some image formats. The problem I have is that when I convert the image to “Gif” format the image looks like as a little square texture. The color depth is 8 and I use Gif encoder. Does any one knows what would be the


Qs: Convert image to Hex -
Hi, How can i convert image file(GIF or JPG or BMP or...) to Hex? Very thanks . Greeting.


[2008] Imaging\drawing help -
hi guys i've never worked with imaging or drawing classes before... i know how to convert an image from one format to another other than that i dont know much... i need to make a code that reduces a colored bmp image to a black and white tiff image... now i know how to convert it


Image to text Conversion -
Hi Friends .......... i need to convert image file to text............ e.g i have driving liscence . i scan it and save it as a image and then from that image i get the values and insert them in a database in their respective fields............ really have no idea rite now


Convert Image to Icon -
Hi Its 1:30 am here and I've still not figured not been able to convert the attached image into an icon. I just want those grey areas to show and the rest to be transparent. I'd greatly appreciate if someone could use IconForge or whatever tool they have and do it for me. I need it


Convert RichTextBox to Image (or another way to edit text to an image) -
Hi, I want to put the content of a rich textbox into an image, so I can use it as a texture in my 3D application... Can I do this, or, otherwise, is there another way to edit stuff with rich text formatting etc and get it into an image? Thanks, Rich Bosworth


Convert My VB6 Form To a Jpeg or BMP -
Is it possible to capture the image of a form within my VB6 app and convert this into a graphic image which I can paste into MS Word. This is a document which will be used to HELP the user and illustrate various forms within the app


Need assistance Converting tiff to pdf! -
Hi All My asp.net app retrieves the path to a tiff image on the server, I would like to convert the tiff image to pdf and display the pdf. I have found various converters that iether convert on the command line or via a printer driver. I created an activex library which basica


Beginners Help -
Hello all out there - I need some help. I am a complete newbie to any form of image processing in VB6 so any help or direction would be much appreciated. What I need to do is this (i)Load an image from a file (ii)Convert the image to a greyscale (iii)Get the bits that make up t


Conveting BMP to GIF -
I was looking through all of the image tutorials and source code and saw one that mentioned "VB will open up an image in BMP format regardless of what kind of image it is.." Is it possible to use VB to convert that image into a GIF format? Or possible even JPG - although G


Image Data Conversion in VB6 -
Hi, I need to read the Images from an Optical drive convert it to PDF file and save that into Oracle Database as BLOB. Total Images I need to read are arrond 500000. I am using Mircosoft Image Control and third party ocx controls such as ImgAdmin, ImgEdit to read the image. In this


Save image to Strongly typed dataset -
I'm making a strongly typed DataSet and i want to know what type of element do i need to use to store an image and if i need to convert an image how do i convert it? Thanks Rick


Bitmap in hMemDC -
Bitmap in hMemDC Hello again everyone, I have the following situation and am wondering if any of you clever people would be able to help me resolve it (I know CornedBee has been very helpful in the past). I have managed to place a bitmap within a hMemDC, only I would like to


JPEG Image conversion -
I'm looking for some code which will allow my vb program to scan images of different sizes from my scanner, convert the image to a standard size and store the image as a .jpeg file. If anyone knows how to do this, I'll take my hat off to you.


*** RESOLVED *** AutoComplete with an Image Combo -
I have searched and found autocomplete code similar to the feature of the AccessVBA combobox, BUT... it only is written for regular combo boxes. I am using an image combo and the code does NOT convert over to use with that. The reason I am using the image combo is I need to tra


Image Convertor & transparent image maker. -
I want to make 2 things. And then hopefully combine them into one. 1) Image Converter very basic. Load an image (BMP or JPEG etc.) and convert it to another filetype (GIF, TIFF etc.) without any loss in quality. 2) Transparency adder You load any image (BMP, GIF, JPG etc.)


[2008] image converting help -
I really need some help with an image converting program I'm working on. I need to convert a file that the user selects in an openfiledialog to the following file types in a folder that the user selects: .ICO .PNG .JPEG .BMP .GIF The user will select which type they want to


Help to save image -
My job is to convert a text into an image and save it as bitmap file. I did it using bitblt function. When I saved the bitmap I found that the attributes of the file is color not black and white and is using 1,900 KB for a page of text. My picturebox, used to create the image, contains


creating a Dll(*.cls) to convert text to images. -
Hi, Is there a way to convert text to a image using a dll. (*.cls) I have all the 255 characters of a font in a folder by the name f1.jpg,f2.jpg ......f255.jpg It's a font i developed and I don't won't others to downlaod it. So is there a way that the user can still use it by ente


Verify an image was actually created -
I am using a third party control to convert a file to a tif image. After the image is done, I need to move it and rename it. My problem is that the third party software is slower than my program and I do not know when the image has been fully written. Is there a way I can communi


Convert bitmap to byte... -
I have managed to put together some code (with help from other coders) that will capture my desktop into a bitmap variable, however now I need to convert this into a byte variable so that I can then insert into my image field within SQL server db. Is anyone able to help me, I have s


[2005] Convert images -
I am making an image converting program. I have made it convert all files types like PNG, JPG, TIFF, BMP and GIF to PNG, JPG, TIFF, BMP and GIF. The code for converting all the above image formats keeps them at the smae size. But for converting an Image (PNG, JPG, TIFF, BMP and G


Image 2 Text - Help Needed -
hi guyz, pls i need help in changing an image to text, say for example i have a scanned page from the New York Times. and i want to convert it to text so that i can use the text. reason: too lazy to type(about 12 pages - front/back=24 pages)


converting an image to a byte array -
I tried creating an Image object using Image.FromStream() and passing a MemoryStream parameter to it, but it said invalid parameter. I cant think of a way to do this. I have an image variable, and I want to convert the image data to a byte array (without writing anything to any files,