There is probably something obvious I'm missing here. It's been a while since I've used Firefly and PowerBASIC.
I create a new project
Rename the form to frmMain
Add a button named btnLoad
Add a graphic control named gfxPic
Add this code to the button's clicked function:
Graphic Attach HWND_FRMMAIN, IDC_FRMMAIN_GFXPIC
For y = 0 To 255
Graphic Line (0, y) - (255, y), Rgb(0, 0, y)
Next
I want to eventually load a bitmap to the control so:
Graphic Attach HWND_FRMMAIN, IDC_FRMMAIN_GFXPIC
Graphic Bitmap Load "b:\thing.bmp", 100, 100 To hBmp
Graphic Copy hBmp, IDC_FRMMAIN_GFXPIC
Nothing happens.
Eric,
Since we are using Jose's includes and PB10 in FF3 now (assuming you are using FF v3.5 or greater), why not upgrade your code from PB graphics to Jose's handy GDI & GDIPlus classes?
Replace the code in your button's click function with this: Local y As Integer
Local hdc As Dword
Local pGdip As IGdiPlus
Local Graphics As IGdipGraphics
Local pPen As IGdipPen
pGdip = NewGdiPlus
hdc = GraphCtx_GetDc(hWnd_FrmMain_gfxPic)
Graphics = pGdip.Graphics(hdc)
For y = 0 To 255
pPen = pGdip.Pen(pGdip.Color(255,0,0,y),1)
Graphics.DrawLine pPen, 0,y,255,y
Next
FF_Control_Redraw hWnd_FrmMain_gfxPic
It's functionally equivalent to the code you were using. You will need to add this include to to bottom of FF_AppStart: #INCLUDE "CGdiPlus.inc"
You won't need the help files to test this out, but you should pick them up from Jose's site should you choose to use the classes. They will help you with the second step. Just ask if you need any help.
Paul, I know you host a copy of the WINAPI headers here. Any chance you can host the entire suite of help files here?
David
I would be happy to host whatever I can on this site. Most people don't realize the enormous number of functions available through Jose's includes. The Help files are incredibly comprehensive and useful.
Quote
There is probably something obvious I'm missing here.
What you're missing is that the GRAPHIC statements are DDT and only work with the DDT Graphic control, that only works with a DDT dialog. I had to write my own SDK graphic control because of that. It does more or less the same that the DDT one, and if someone can improve it, please do it.
@Paul,
In this thread ( http://www.jose.it-berater.org/smfforum/index.php?topic=4833.0 ) there are a bunch of help files. Feel free to host them in your site.
Don't be fooled by the version of the headers (1.05). There are no new help files for version 1.06 since it was just a maintenance release.
With GDI+, you can use the flat API of my wrapper class. The class allows to write code very similar to the C++ examples provided by Microsoft, that does not provide examples for the flat API. I have posted hundreds of examples, both using the flat API and the wrapper class, in my forum and in the PB forum.
See: http://www.jose.it-berater.org/smfforum/index.php?board=417.0