IO80141@MAINE.MAINE.EDU (Steve Trefethen) (06/26/91)
I would like to know how to make dialog boxes that look like the ones used in TPW. Basically I would like to change the background of the dialog box using bitmaps. I have used the WRT to look at the dialogs that come with TPW but I can't seem to figure out how the background is made. The bitmaps that are in the resources of TPW are very small so the patterns just must be repeated repeated and that is what I would like to know how to do. I asked a question similar to this not too long ago but from the one response that I got I can see that I did not give enough information the first time so I hope this time I have given enough detail. Thanks in advance -Steve IO80141@maine.maine.edu
craig@cosc.canterbury.ac.nz (cantva) (06/27/91)
From article <91176.212130IO80141@MAINE.MAINE.EDU>, by IO80141@MAINE.MAINE.EDU (Steve Trefethen): > I would like to know how to make dialog boxes that look like the ones > used in TPW. Basically I would like to change the background of the > dialog box using bitmaps. I have used the WRT to look at the dialogs > that come with TPW but I can't seem to figure out how the background > is made. The bitmaps that are in the resources of TPW are very small > so the patterns just must be repeated repeated and that is what I would > like to know how to do. Here are some thoughts about how to go about constructing TPW-style boxes (I haven't tried these out) Firstly, for the background, try loading the bitmap, creating a brush out of it, then assigning this brush to the hbrBackground field of a TWndClass record, and registering this window class. To expand: you will need to call LoadBitmap, then CreatePatternBrush(bitmapName), then go through the process described in page 124... of the Windows Programming Guide from TPW. Basically you override the GetClassName and the GetWindowClass methods of your window. It's not too difficult (easier than I thought). For the custom buttons, look at bitbtn.pas and bitbtnapp.pas. Also look at the bs_OwnerDraw button styles. You will need to provide methods for the wm_DrawItem message to draw them selected and unselected yourself. Something I had trouble with at first: the hDC element of the PDrawItemStruct that you get passed in your wm_DrawItem handler just encloses the button area; it does not relate to the whole window, so when you draw the button, make its top left corner at 0, 0! All the best, Craig Nevill (craig@cosc.canterbury.ac.nz)