How do I programmatically scroll a control in Windows? - windows

I have some controls like TWebBrowser, TRichText etc. which I want to scroll them (horizontally and/or vertically) from my program.
How do I achieve this?
PS: I think that it is doable by sending some messages to their handles but I don't know now which ones.
TIA.

WM_VSCROLL and/or WM_HSCROLL. GetScrollInfo() to find out how far you can go.

For edit controls, look at the EM_SCROLL and EM_LINESCROLL messages.

Related

Is it possible to customize a CPToolbar in Cappuccino

I may need to change toolbar background, heading font and position.
Is it possible to do that with the standard CPToolbar? I was looking through the ThemeDescriptors.j, and there is nothing about a Toolbar.
It seams not so difficult to create my own. Should I go that way?
The toolbar isn't themeable as is (although, feel free to implement that for us. :) )
That said, you could do something like this depending on what exactly you want to do…
https://github.com/cappuccino/issues/blob/master/Client/AppController.j#L273

Localize MS Chart control

Is it possible to localize MS Chart Control's print preview form? If so, then how?
.net4/c#/winforms/vs2010
Good question. It seems that they did some custom dialog and forgot to localize it. I might be wrong but it appears that the only way would be to create your own dialog similar to .Net's and draw the chart on the CustomControl's surface using PrintPaint() method.
Sounds like a lot of work but it is actually fairly easy. The only problem I can think of is how to make sure that WYSIWYG :|

Does Windows allow to have a window with both the help button and the min/max buttons?

I want to put help buttons on all my windows, like this:
But when I put the help button in, the minimize/maximize buttons disappear. Does Windows forbid having the min/max buttons together with the help buttons? That would be disappointing because that would mean I could put the help button only on dialogs and not on frames.
If Windows does forbid this, it would be nice to see an official Microsoft document which talks about this policy.
It is not possible through setting windows styles. If you really wanted to you could set some hooks that would probably let you do what you want, but I would not recommend doing that. You can mimic the functionality of the help button by sending the WM_HELP message.
According to MSDN, the styles WS_MAXIMIZEBOX and WS_MINIMIZEBOX can not be combined with WS_EX_CONTEXTHELP.
Although it is true what daalbert says, with some effort it is indeed possible to draw just about anything properly on the window frame. Of course this is in no way "official" and the limitation that daalbert mentions still stands.
You can listen for WM_NCPAINT and draw the button yourself with the help of DrawFrameControl with DFC_BUTTON (which makes sure it will look like the real thing). Use WM_NCHITTEST and friends (WM_NC*BUTTON*) to find out whether the button you draw gets clicked.
So yes, it's technically possible to achieve what you want but usually not worth the extra effort.
Just wanted to have this on record for completeness.

How to change font of a menu item to regular from bold?

I want to change font of a menu item from bold to regular.
I looked few API's like
ModifyMenu
SetMenuItemInfo
but looks like there is no direct API to change the font.
Any suggestions whats the easiest and best way to do that.
At least as far as I know, this requires an owner-drawn menu. As mentioned in the link, if you're willing to code strictly to Vista and newer, owner-drawn menus aren't necessary as often as they used to be, but:Most developers still need to support XPThis case doesn't really fit what they're talking about anyway.

windows.form c# moving between forms

I am designing an installer interface for a already written program. It is my first windows.form. I see three approaches to solving my "problem" of needing multiple "screens". I can add all the labels/buttons/interface, and then hide/show them at events. Or I can close and open a new windows? Or do I somehow load my next form into the window frame (sortv like an iFrame approach)? Can somehow help explain how to do this?
Thanks!
Though there is nothing stopping you from using any of the approaches that you mentioned,
using separate windows and opening/closing them would be cleaner. If the code for individual windows gets complicated it would be clearer if they were separate.
Since you said you are doing installer's particulary take a look at Wix. It was meant to be used for creating installer's. It has it's own approach of building UI from XML's.
I would design my "screens" as unique frames with each frame having the controls it needed. Then I would just swap them in and out of the main window.
Its sort of like an IFrame (visually at least).
I agree that WiX is worth a look. An alternative to WiX that some people like more (it's just different, some people like one approach, some like the other) is NSIS.
When I have a requirement that calls for swapping out the controls in a single window, I tend to create a user control for each "page".
Have you considered using The Panel control? You can group certain controls together and have them placed inside one or more Panels.
You could Hide/Show each panel when required.

Resources