I cannot see text/graphics at the very bottom of my win32 window, because it extends larger than my screen can fit. Even when I go in fullscreen mode, I cannot see the bottom text.
Is there a way for me to adjust my window or zoom-out of my window in order to see the stuff at the bottom? Or am I supposed to shrink all the contents inside the window?
I'm not exactly sure what I should do, but any guidance would be appreciated. Also I'm using C++.
Thanks.
You pretty much have two options:
Add a scrollbar (Adjust the window style or add a scrollbar control)
Stretch/shrink/resize the content
Related
I need to add a clear button inside the CEdit control like this:
And I used CMFCEditBrowseCtrl, as described in this article:
MFC Feature Pack - CMFCEditBrowseCtrl.
But the problem is that it shows a very small icon on monitors with high pixel density:
I tried to set a big icon, but the button remains narrow:
Could you please advice some solution?
I am having a static control in which I am setting some text. When I am trying to set lengthy text in the static control the text is getting clipped.
Can anyone please let me know, how can I prevent the text from getting clipped.
The problem is that a static control always clips a word, that is longer than the width of the control. If you use the SS_LEFT style words are wrapped into the next line. So a higher control would help (I can read in the comments that this is possible).
But the Style must be SSLEFT and not SS_LEFTNOWRAP!
Another solution would be to use a Read Only Edit control without a border In this case you can scroll inside the edit control, because it is possible to give it the focus. Also you are able to use a vertical or horizontal scrollbar.
As long as you don't use WS_TABSTOP you will se no real difference between a read only edit control without a border and a static control. Except that the edit control can be activated with the mouse.
Make the static text control larger than the text you a putting in it. A window draws in its client and non-client space. It clips to its window.
If you're concerned about space on a dialog or form, or, language translation could be a possible issue, then you should consider using a CStatic tool tip. Using a tool tip would allow you to keep the current size for the control and provide a mechanism to display its full text. When the user mouses over the CStatic, a tool tip pops up to display the entire text. It's a compromise I've had to use to balance UI design with space on a dialog.
In windows: I would like to know if it is possible (and if so, how) to make a program in C++ that displays images/text on the screen directly, meaning no window; if you are still confused about what I am after some examples are: Rocketdock and Rainmeter.
you can do it certainly without using Qt or any other framework. Just Win32 API helps you do that and internally, every framework calls these API so there is no magic in any of these frameworks
First of all, understand that no image or text can be displayed without a window. Every program uses some kind of window to display text or image. You can verify it using the Spy++ that comes with windows SDK. click the cross-hair sign, click the image or text you think is displayed without any windows. The Spy++ will show you the window it is contained in.
Now how to display such image or text that seems like not contained in any window. Well you have to perform certain steps.
Create a window with no caption bar, resize border, control box, minimize, maximize or close buttons. Use the CreateWindowEx() and see the various windows style WS_EX_XXX, WS_XXX for the desired window style.
Once the window is there you need to cut the window. Much like a cookie cutter. for this you need to define an area. This area is called region and you can define it using many functions like CreateEllipticRgn(), CreatePolygonRgn(), CreateRectRgn(), CreateRoundRectRgn() etc. all these functions return a HRGN which is the handle to the region. Elliptical or rectangle regions are OK as starter.
Now the last part. You have to cut the window like that particular region. Use the SetWindowRgn() function which requires a handle to your window and a handle to that region (HRGN). This function will cut the window into your desired shape.
Now for the image or text. Draw the image or text inside the window. I assume you must have cut the window according to your image, You just need to give window a face. so just draw the image either on WM_ERRASE BACKGROUND or WM_PAINT messages
Use the SetWindowPos() to move the window to the location you wish to on screen. If you have used correct parameters in CreateWindowEx() then this step is not necessary
You can set any further styles of windows using SetWindowLong() function.
Congratulations, you have your image displayed without using any windows ;)
I am implementing drag and drop of button on windows application.During dragging I want to display some dragging effect. I think image of the button would be appropriate to display during dragging.
Also I think cursor should be changed during dragging.
My doubts are:
How to capture the image of button and display while dragging.
What type of cursor should be displayed during dragging.
Application is in C++, win32.
Drag image:
If it is a standard button control then you should be able to use WM_PRINT or WM_PRINTCLIENT to ask it to draw itself to a GDI HDC (i.e. into a bitmap that you then use as the drag-image).
Note that not all controls support those messages and some of them support them in slightly different ways. Sometimes you have to experiment a bit or have custom code-paths for different controls.
Another way is to draw the button yourself using the visual styles (themes) API, with a fallback on DrawFrameControl for when themes are disabled. But that is much more tedious than using WM_PRINT/WM_PRINTCLIENT if you don't need it.
Cursor:
Depends what the operation is doing, really. Note that you get the copy and move cursors for free with the shell drag object, if you want them. Sometimes it makes sense to use a custom cursor, though.
I have a CDHTMLDialog in a BHO that I want to be partially transparent, in the sense that the transparent area changes according to the logic of the dialog. I got it to become transparent visually (using SetLayeredWindowAttributes), but it is critical to make this region truly transparent, because otherwise when I click on the transparent region my clicks do not reach the IE window which is below the transparent part of my dialog. I temporarily fix this by constantly resizing my dialog according to the size of the active part of the dialog, but I can't keep up with this forever...
I think the solution has something to do with what windows calls "regions" (http://msdn.microsoft.com/en-us/library/dd162915%28VS.85%29.aspx) but I'm not exactly sure how to work with them. Can anyone point me in the right direction?
I don't think you want to make parts of your window transparent, what you want to do is (I think) set the window region (like you mention). Read the MSDN on SetWindowRgn() - basically you define a GDI object of type HRGN (if you're using MFC, CRgn) which described a surface of a certain shape, and eventually with parts cut out. Windows then considers only the 'region' that you set on a window as the part of the window to use. Basically it's how you make non-rectangular windows. A 'region' isn't a 'transparent' part of a window, it's a way to discard areas of a window, in a way.
I found the way to make an entire window transparent and click-through here:
http://www.codeproject.com/KB/wtl/transparent.aspx
But it's not useful for my case where I only want the transparent part of my window (transparent by HTML/CSS definitions) to be click-through...
Update: Apparently, the clicks are supposed to go through the transparent parts (see http://jalaj.net/2007/02/05/form-with-a-hole/), but in my CDHTMLDialog they don't. My best guess is that a sub-window of the BHO catches my clicks, but I don't really think that makes much sense...