Click here to Skip to main content
15,907,687 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralReturning Integer value from a VB (NOT .Net) Command line application Pin
Jobby Joseph15-Sep-04 3:54
Jobby Joseph15-Sep-04 3:54 
GeneralRe: Returning Integer value from a VB (NOT .Net) Command line application Pin
Dave Kreskowiak15-Sep-04 4:22
mveDave Kreskowiak15-Sep-04 4:22 
GeneralRe: Returning Integer value from a VB (NOT .Net) Command line application Pin
Jobby Joseph15-Sep-04 4:37
Jobby Joseph15-Sep-04 4:37 
GeneralDropdownlist Pin
jr121415-Sep-04 2:53
jr121415-Sep-04 2:53 
GeneralRe: Dropdownlist Pin
Purple Monk16-Sep-04 1:27
Purple Monk16-Sep-04 1:27 
GeneralRe: Dropdownlist Pin
jr121416-Sep-04 3:56
jr121416-Sep-04 3:56 
Generalprinting contents behind scrollbar Pin
vjer00114-Sep-04 19:12
vjer00114-Sep-04 19:12 
GeneralAdjusting PictureBox contrast/brightness Pin
Jason2314-Sep-04 14:29
Jason2314-Sep-04 14:29 
I am attempting to adjust the contrast/brightness of a 256 color, paletted bitmap in a VB PictureBox using the Windows API in VB 6.0. My first attempt was to change the palette using something like:

tempDC = CreateCompatibleDC(0&)
call SelectObject(tempDC, Picture1.Picture.Handle)
PaletteSize = GetDIBColorTable(tempDC, 0, 256, pal)

' Do stuff with the palette

Call SetDIBColorTable(tempDC, 0, 256, pal)
DeleteDC tempDC

That's just a basic outline of my code, not exact. Anyway, it worked but what I noticed was that if the user tried to readjust the brightness/contrast to the way it was before, the image did not look the same. An extreme case is when the user adjusts the brightness to as bright as it will go, thus producing just a white box. Upon trying to re-adjust to the default brightness, instead of the image the picturebox just displays a black box. It looks like changing the palette saturates some of the pixels, thus losing that information.

What I really need to do is take a device-independent bitmap created in VC++, and then somehow get that into VB and draw it on the picturebox. I also need to be able to adjust image brightness/contrast, but not permanently alter the image pixels in case the user wants to "undo" what they did. I've tried any number of Windows API calls to accomplish this, but to no avail. Right now, I am just writing the bitmap to file in C++, and loading it in VB like so:

Dim MyPic as StdPicture
Set MyPic = LoadPicture("the_image.bmp")

Then, when I need to display the image, I pass it to another function which calls PaintPicture on my PictureBox control:

Picture1.PaintPicture(MyPic, 0, 0, Width, Height, etc...)

I know there has to be a better way. How can I go from a set of pixels in VC++ to a device-dependent bitmap in VB that is adjustable and can have any adjustments performed on its palette "undone"? If somebody could give me some direction, that would be great! Thanks a lot.

Jason
GeneralRe: Adjusting PictureBox contrast/brightness Pin
Anonymous14-Sep-04 18:24
Anonymous14-Sep-04 18:24 
GeneralConnecting to Oracle database Pin
pathuknown14-Sep-04 10:49
pathuknown14-Sep-04 10:49 
GeneralRe: Connecting to Oracle database Pin
Anonymous14-Sep-04 18:30
Anonymous14-Sep-04 18:30 
General.NET and Integer, Long, and Short Pin
GregOsborne14-Sep-04 10:05
GregOsborne14-Sep-04 10:05 
GeneralRe: .NET and Integer, Long, and Short Pin
Charlie Williams14-Sep-04 10:26
Charlie Williams14-Sep-04 10:26 
GeneralRe: .NET and Integer, Long, and Short Pin
GregOsborne14-Sep-04 16:28
GregOsborne14-Sep-04 16:28 
GeneralRe: .NET and Integer, Long, and Short Pin
Charlie Williams14-Sep-04 17:38
Charlie Williams14-Sep-04 17:38 
GeneralRe: .NET and Integer, Long, and Short Pin
Greg Osborne21-Sep-04 10:10
Greg Osborne21-Sep-04 10:10 
GeneralGetIfTable and VB.NET Pin
andrew|14-Sep-04 5:46
andrew|14-Sep-04 5:46 
QuestionHow to select the the Launch Conditions in View menu? Pin
ATC14-Sep-04 4:29
ATC14-Sep-04 4:29 
GeneralPROGRAM HELP!!! Pin
ISUstudent14-Sep-04 4:17
ISUstudent14-Sep-04 4:17 
GeneralRe: PROGRAM HELP!!! Pin
Dave Kreskowiak14-Sep-04 4:51
mveDave Kreskowiak14-Sep-04 4:51 
GeneralWorking with a database Pin
Britnt714-Sep-04 2:14
Britnt714-Sep-04 2:14 
GeneralRe: Working with a database Pin
Mekong River14-Sep-04 5:24
Mekong River14-Sep-04 5:24 
Generalbuild calss structure to store data Pin
Anonymous14-Sep-04 2:13
Anonymous14-Sep-04 2:13 
GeneralActiveX problem Pin
archetype14-Sep-04 1:32
archetype14-Sep-04 1:32 
GeneralRe: ActiveX problem Pin
Dave Kreskowiak14-Sep-04 3:46
mveDave Kreskowiak14-Sep-04 3:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.