Add regions to bitmap

Win32 Programming


  • 1. can someone explain the definition of DDB and DIB?
    I am very confused about the definition of DDB vs. DIB. I have read many articles and usenet posts about this, they just give the definition in general terms, i.e. that DDB can only be rendered directly to a certain video card, and DIB can only be rendered on any video card or printer but is slower. But I do not understand the technical aspect. Let's say we have a 10x10 pixel bitmap, with 32 bit color, that is a DIB. For each of those 100 pixels of a DIB, there is a 4 byte value that represents the colors. Correct? If this is the case, how would a DDB differ from this? What about for 24 bit and 16 bit color?
  • 2. Printing contents of RichtextBox
    HI all, I have number of richtextboxes which act as pages similar to MS-Word but the height of the Richtext boxes are limited to screen height and cannot be scrolled, I enter some text into it and draw images on the Rcihtextbox Now i want to display them in the Print Preview dialog and if the first page consists of some blank space at the bottom that space should be filled with the contents of the next page Hope you all understand the scenario Waiting for any reply at the earliest Thanks, Pramod
  • 3. making snapshots of single windows
    Hallo NG, I need to take snapshots of a window ( using the window's handle) I wrote the following code (C#, window is the handle of the window ) Image MyImage = new Bitmap(width, height ); Graphics g2 = Graphics.FromImage(MyImage); IntPtr dc1 = GetDCEx(window, IntPtr.Zero, 0); IntPtr dc2 = g2.GetHdc(); BitBlt(dc2, 0, 0, MyImage.Width,MyImage.Height, dc1, 0, 0,13369376); g2.ReleaseHdc(dc2); ReleaseDC(window,dc1); return MyImage; The problem is that I get a snapshot of the window with any window overlap it, as if I took a snapshot of the whole desktop and then cut out the rectangle of that window. I need a snapshot of only that window, even if it was covered with other windows. Can anybody help me ?
  • 4. GetDeviceCaps
    I have to set font height for a custom control of mine. If I specify it like "8" or "11", the obtained text doesn't look ok at all. I saw the height of the font specified like this: -MulDiv(11, GetDeviceCap(hDC, LOGPIXELSY), 72) instead, but, i don't now why, could you please tell me how to use GetDeviceCaps, and why is 72 used...? thanks

Add regions to bitmap

Postby Dirk Huber » Tue, 23 Dec 2003 18:19:12 GMT


i am looking for the possibility to increase size of an 
bitmap by adding white regions e.g. on top and bottom.

(I load an image having 400x300 Px from file and want to 
add white stripes to change size to 400x400 Px.)

Thank you!


Re: Add regions to bitmap

Postby Mike D Sutton @ Work » Tue, 23 Dec 2003 23:17:37 GMT

> i am looking for the possibility to increase size of an

To perform the changes graphically you'd create a new DIBSection at the size of your final image, fill it with white then blit the
original image (Presumably also in a DIBSection) over to it then write it back out to disk.  If you're unfamiliar with the API calls
involved then take a look on the MSDN or Google for example code dealing with CreateDIBSection(), FillRect() and BitBlt() - Should
be about all you need.
Hope this helps,


 - Microsoft Visual Basic MVP -
WWW:  http://www.**--****.com/ 

Return to Win32 Programming


Who is online

Users browsing this forum: No registered users and 20 guest