SetTextAlign not working

Win32 Programming

    Next

  • 1. How to display a .gif image?
    Hi everybody, I'm new to C++ and I'd like to show a .gif file on my screen. I figured the easiest way was to handle the WM_PAINT message, load the .gif file with LoadImage and display it. However, I seem to be stuck halfway through: here's what I have so far... --- WM_PAINT --- case WM_PAINT: { HDC hDC; PAINTSTRUCT ps; hDC = BeginPaint(hwnd, &ps); Paint(hwnd, hDC); EndPaint(hwnd, &ps); return 0; break; } --- Paint function --- void Paint(HWND hwnd, HDC hDC) { HANDLE hBitMap = (HBITMAP) LoadImage(NULL, "c:\temp\image.gif", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); if (hBitMap == NULL) { TextOut(hDC, 10, 10, TEXT("error"), 5); } } My first problem is that the bitmap is NULL, so the error message is displayed. My second problem is that I don't have a clue as to how I need to show the image on the screen. The image does exist, by the way, so that should not be a problem. I've tried BMP files as well, but to no avail. If somebody would be so kind as to explain to me what I'm doing wrong, I'd be very grateful. A pointer to a faq or article of sorts is just as welcome, of course! Thanks in advance, Ikke
  • 2. To avoid lockbits
    Hi, My goal is to load an image as a bmp and get to its pixels. So what i do is: Bitmap::FromFile(<filename>); // i guess this loads the file as a bmp LockBits(...); // this coppies the bitmap's bits into another buffer //now i can use the pixels Is there any way to avoid the extra copy at LockBits(which is expensive)? I want direct access to the bits loaded from the file. Is there any way to do this in mfc/.net?
  • 3. GDI+ PNG invisible disappears 16bpp mode
    When the display mode is set to 16bpp my UI disappears. The UI is comprised entirely of PNG images with alpha channels and I use GDI+ to display them. My project is written using Win32 libraries and C++. It appears that some netbooks switch automatically to 16bpp as a power-saving feature. Is anyone aware of some kind of dithering mode that needs to be set or is available to handle dithering the images automatically for 16bpp? I don't imagine it is possible to support alpha channels in 16bpp? Other thoughts? Thanks.

SetTextAlign not working

Postby VG9tIFBhcmtl » Fri, 01 Feb 2008 01:18:01 GMT

I just upgraded from Windows XP Pro to Vista Ultimate.  I have been using 
code like:
     SelectObject( hPrndc, UniverseFont );
     SetTextAlign( hPrndc, TA_CENTER );
     TabbedTextOut( hPrndc, leftmarg, line, buf, lstrlen(buf), tabpos, tabs, 
0 );
Now under Vista, the settextalign doesn't seem to work, nor does TA_LEFT or 
TA_RIGHT.

Has something changed in between XP and Vista?
Tom





Return to Win32 Programming

 

Who is online

Users browsing this forum: No registered users and 93 guest