Whats the best way to create a 'scrollable panel' in MFC (C++) ? In the past I have displayed different windows "attached" or "on top" of my main dialog window as a means of display different pages of an application. What I want to do this time is create a panel of controls that can be scrolled (because the virtual size of the panel is bigger than the size of the panel itself).
Can anybody recommend any good articles or tutorials on how best to do this?
Thanks
You can create an independent scrollbar control on the side of your dialog. Respond to the messages in the dialog to move your controls. Since the child windows will crop themselves to the parent client area, feel free to move them completely off the dialog as they scroll off the page.
If you place the controls in a CScrollView or a CFormView they will be automatically scrollable inside the view area.
Related
I often need loading panel, which shows an indeterminate progressbar and a textblock in fullscreen mode. I do this with a Grid and just set the visibilty so visible. Instead of copy source code from page to page, I want to re-use it as a control. Is there already an existing control I can use?
Create your own usercontrol is the best way if you want to reuse the control. There are a lot of guides on Google, search for "custom user control silverlight" or something similar.
I'm developing for Windows 8 (WInRT) and have problem with settings charm. Settings popup is based on Microsoft SDK settings charm. Settings panel is Popup. Content is wrapped by ScrollViewer -> Grid -> StackPanel. In StackPanel I have input fields. when I trying to fill last of them on screen keyboard overlaying it and I cant see field and cant scroll to it. Is there any way to see it and to scroll to it automatically?
Seems like the popups on Windows 8 suffer from the same problem as they did on Windows Phone in that when you put a TextBox on one of them - it does not get pushed up together with all the other content as it does when it is not in a popup.
My solution to that would be to not use popup for input fields and instead go for a layout that you can manage yourself.
By default the app has a Frame control at its visual root. You can modify it for example by putting your own UserControl in there (I usually call it AppShell) which has the Frame used by all pages, you can have a layer for popups, log in screens, the extended splash screen etc.
To solve your problem you would need to put your charm's UI inside of such layer instead of in a popup. Then the build-in mechanism that pushes all the UI up when the on-screen keyboard would otherwise obstruct the view of your TextBox should just start working again.
*EDIT
A simpler solution might be to make sure your settings panel popup is parented in your visual tree - e.g. by adding it as a child element to a root grid of your app or page. It turns out that in that case its content does get pushed up when the OSK shows up.
Take a look at this post
It's a popup wrapper (turns user controls into popups) that takes care of the keyboard appearing and adjusts the size of the popup (and thus the user control) accordingly.
If you open settings of wifi and choose any network you will see Password textbox and BUTTONS (not icons) in ApplicationBar. How it is made? Is it some kind of ApplicationBar template? Or it is some Border control, but how to show a Border above the SIP(keyboard)?
Any ideas how to make the same thing?
What are you describing was not created using Silverlight (all the "hero" applications are done in C++) and are therefore not limited by the current SL feature set.
In relation to your actual question, it is not possible to template the ApplicationBar nor is it even possible to determine when the SIP is displayed (or what its height is).
In short, I'd stick to icons if you want your application to work well across devices.
I am trying to create my first custom Print Dialog in C#. I found some samples online that I'm working with to do this.
What I want to do is to put a button underneath the Properties button in the upper right corner. The code samples I have seen so far put new controls on the bottom of the Dialog relative to the position of the OK and Cancel buttons. Those code samples allow one to retrieve the handle of the OK or Cancel buttons because they're universal constants in Dialog controls. Fair enough, but how would I go about getting the handle on the Properties button so I could insert my button underneath?
You can use SPY++ to figure out the control Id of any control, those ids a solid across Windows versions. You can read here (old but still relevant) on how to use SPY++ to obtain control Ids.
When laying out a WinForm in Visual Studio you get the ability to resize and align your controls very easily with drag handles and border alignment hints.
I'd like to do the same with a runtime control to enable the user to position an image on a page.
For example, if the user has a photo and they want to place it as a background on the desktop I'd like the control to help them move and size the photo thumbnail in a mini desktop visual.
I can do all of this, but my real question is, does anyone know of a way to inherit from the standard WinForms layout editor so that I can choose to use the nice docking, alignment hints and control resizing without coding it all again?
Thanks in advance
Ryan
I don't know about easy, but you can host the actual winforms designer in your own applications without too many problems.. See here.