News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GDI+ Help

Started by lilljocke, October 10, 2008, 02:34:21 PM

Previous topic - Next topic

lilljocke

Hello I am new here  :bg
I got a few questions i would like to ask about GDI+
My current project is a new shell to vista and im going to use GDI+ to render the images and icons. But as many of you may already aware about is that when the GDI+ library loads and icon with GdipCreateBitmapFromHICON destroys the alpha bits in the icon so it becomes ugly  :'(
Is there anyone who knows how to fix this problem??

Also i would like to ask how to change the image that is currently rendred on the screen. It should be quite easy task to do i think. I'm drawing an image that should be a button when someone clicks on it i want it to change, now how do i change to current image or delete it and draw the new one??

Thank you

n00b!

I'm not much with GDI, so I can't help you with your Icon-problem, sorry.

I would do it with the Buttons like this (abstract):

[... (WndProc)]
case Image_Rect_Mouse_Down: ;Mouse-down Message, check if Cursor in specified area (GetCursorPos)
var = 1
case Image_Rect_Mouse_Up:
var = 0
case WM_PAINT:
cmp var, 1
call draw_button_down
cmp var, 0
call draw_button_up
else hackpentagon
[... (Rest)]

lilljocke

Thank you for the reply but accually im already done with that part. What i ment was that i want to change the current displaying image with another one for example the user wants to click on the button. First i rendrer the first image wich i know how to rendrer i do it like this:

      invoke   BeginPaint,hWin,ADDR lpPaint
      mov   ebx,eax
      invoke   GdipCreateFromHDC,eax,OFFSET hBuffer
      invoke   FindResource,hInstance,100,RT_RCDATA
      mov   hRes,eax
      invoke   SizeofResource,hInstance,hRes
      push   eax
      invoke   LoadResource,hInstance,hRes
      mov   hMem,eax
      invoke   GlobalAlloc,GPTR,eax
      mov   edi,eax
      mov   esi,hMem
      mov   hMem,eax
      pop   ecx
   @@:
      dec   ecx
   je   @F
      lodsb
      stosb
      jmp   @B
   @@:
      invoke   CreateStreamOnHGlobal,hMem,0,ADDR spStream
      invoke   GdipCreateBitmapFromStream,spStream,ADDR OutBuffer
      invoke   GdipDrawImage,hBuffer,OutBuffer,0,0
      invoke   EndPaint,hWin,ADDR lpPaint


Then when i want to show the next image how do i do?? it seems like i cant just rendrer the other image on this one, if i do it wont be visible