i am trying to rezize dailog which are added to property sheet using move window function but nothing is affecting. it taking same size as in resource file.
how to resize it in code ?
this->MoveWindow(xPosInScreen, yPosInScreen, Width, Height);
You can use it on initialisation function.
Related
I have created some (CMFCToolBar) toolbars and added buttons and icons to them. I read on Microsoft's official website that CMFCToolBar takes 23x22 button size and 16x15 icon size (ref: link).
If I use 16x15 for the icons, then icons appear blurry. This is because the icons are originally with size 16x16. I used the function SetSizes(CSize (23,23), CSize(16,16)) to change icon size but the icons do not appear right:
Is there another way to set icon and button size?
Update
I called the SetSize function before create toolbar but the icon still appear a little blurry:
I want to know if there is a way to set Icon/button Transparent or make it clear like we can set toolbar transparent through TBSTYLE_TRANSPARENT in CreateEx function.
SetSizes is a static function that affects the complete library.
It should be called before you create any toolbar or menu object.
Best location is in InitInstance of you applicxation.
But my tipp: Use the sizes that are recommended! 16x15 and 23x22....
Transparency can be done with standard 32bit RGB/A bitmaps.
If you have a 16 color bitmap you should use RGB(192,192,192) as the standard color for the background. It is automatically replaced with the needed background color.
This has been answered here too.
I have tried to change orientation property of CSpinButtonCtrl in C++ MFC.
By default I have specified orientation property as vertical, nevertheless when I try to change property style to horizontal (UDS_HORZ) during execution, it doesn't work...
Sample code
CRect rect;
CWnd *pWnd;
pWnd = GetDlgItem(IDC_SPIN_GRAD_CONTRAST);
pWnd->GetWindowRect(&rect);
((CSpinButtonCtrl*)pWnd)->Create(WS_VISIBLE | UDS_HORZ, rect, pWnd->GetParent(), IDC_SPIN_GRAD_CONTRAST);
It creates a horizontal spin button control.
What I pretend to do is find any way to change the style without changing position and behaviour of the control previously created
I will appreciate any kind of help.
Some styles of controls can only be used when you create the control.
AFAIK you have to recreate the control.
On the other hand I looked into the source code of the CMFCSpinButtonCtrl. Using this allows dynamically changing the orientation. Make sure that you force to redraw the control.
PS: Changing this at runtime seams to be a strange scenario for me.
How to get the (text size or height) of the titlebar.
I tried to use GetSystemMetrics(SM_CYCAPTION) but it returns the height of the titlebar not the text size.
Any suggestions?
Call SystemParametersInfo passing SPI_GETNONCLIENTMETRICS. This will populate a NONCLIENTMETRICS structure. Within that structure is lfCaptionFont which contains the information you desire.
I have a CTabCtrl in my program and 3 "child" *CFormView*s that I show/hide whenever the user changes the active tab.
Instead of using a fixed size, I'd like to resize the enclosing CTabCtrl to match the size of the largest CFormView.
You can use this:
GetDlgItem(IDC_YOURCONTROL)->MoveWindow(xPosInScreen, yPosInScreen, Width, Height);
Hope it helps.
If I create a full screen window where m_winw and m_winh is the full screen size, it seems to create a window for me where the outside dimension is the full screen and the inside is smaller based on the "decoration" (window border) size. Is there a way to query the window to get it's inside width and height?
m_win=XCreateWindow(m_display, m_rootwin, m_winx, m_winy, m_winw, m_winh, 0,
CopyFromParent,CopyFromParent,m_visual,CWColormap|CWEventMask,&attributes);
This is on linux.
See XGetWindowAttributes, XGetGeometry. According to the man page:
The width and height members are set tothe inside size of the window, not including the border.