|
s196675m wrote: Is there any way to change the row height of CListCtrl item withour owner drawing?
Increase the font size.
Another option is to set an image list. I.e Create an image list and set it to the list control. The height of the list control will increase to the height of the image list.
|
|
|
|
|
anybody have a code snippet/function to convert twips to pixels?
|
|
|
|
|
int pixels = MulDiv(twips, pixelsperinch, 1440);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How do you get pixelsperinch?
|
|
|
|
|
nevermind, I found it...
int pixelsperinch = GetDeviceCaps(hDC, LOGPIXELSX);
|
|
|
|
|
Yes
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
wsprintf(c,"%s%i %s%i %s%i %s%i",day,stLocal.wDay,month,stLocal.wYear,stLocal.wHour,":",stLocal.wMinute,":",stLocal.wSecond);
Why can't I get the value of stLocal.wHour, stLocal.wMinute and stLocal.wSecond?
My output appears as "Mon 4 Dec 2006" I cannot get the time in.
Help me modify my code.
thanks,
Jj
|
|
|
|
|
Maybe try casting those WORDs to ints when you pass them to wsprintf().
Also, your parameter list order and types needs to match the order and types of the format
specifiers (they don't match in your example code).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
What is not matching? How do I make the right match?
Thanks,
Jj
|
|
|
|
|
wsprintf(c,"%s%i %s%i %s%i %s%i", day, stLocal.wDay, month, stLocal.wYear, stLocal.wHour, ":", stLocal.wMinute, ":", stLocal.wSecond);
You have 8 specifiers, 9 passed arguments
The order of the 8 specifiers is
string
int
string
int
string
int
string
int
The order of the passed arguments is
string
int
string
int
string
string
int
string
int
Note that you're also passing the wrong types if those int arguments are WORD sized.
"%i" expects an int, not a WORD. If those are WORDs you are passing, cast the arguments
to ints (e.g. "(int)stLocal.wDay")
*edit* Or if they are WORD arguments, you can pass them like you are, but change the
format specifiers to "%hu" instead of "%i"
The passed arguments corresponding to each "%s" format specifier MUST
be a pointer (const is OK) to a char (const char *).
Mark
Last modified: 11mins after originally posted --
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You can also use %hu to print a WORD value.
|
|
|
|
|
Thanks Mike -
I had already edited my post, maybe the same time you were posting
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
thanks I got it now.
Jj
|
|
|
|
|
Hello,
I think it should be written this way.
wsprinf(c,"%s %i %s %i %i:%i:%i",day,stLocal.wDay,month,stLocal.wYear,stLocal.wHour,stLocal.wMinute,stLocal.wSecond);
Hope this will help.
|
|
|
|
|
Notice anything peculiar:
%s %i %s %i %s %i %s %i %s
day,stLocal.wDay,month,stLocal.wYear,stLocal.wHour,":",stLocal.wMinute,":",stLocal.wSecond
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
How come the guy looking over your shoulder always sees the better picture?
Nice work!
|
|
|
|
|
Is there a way to use some of .Net's numerous classes in MFC?
What I'm particulrly interested is finding a way to use .Net's DataAdapter, DataReader, SqlCommand and so on classes in MFC.
Thank you in advance.
|
|
|
|
|
Dobromir Dimitrov wrote:
Is there a way to use some of .Net's numerous classes in MFC?
Yes.
It's not trivial. To use .NET from C++ you need to understand how .NET works
and how C++ interops unmanaged code with managed code.
The top two links in this programming guide[^] have lots of info.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You can. Read up on C++/CLI if you use VC 2005, or Managed C++ for earlier versions of VC.
|
|
|
|
|
How to create one dialog box on another in MFC inVC++6.0
|
|
|
|
|
You can use of CreateWindow or use of CDialog class.
|
|
|
|
|
Hi, i want to write an App in which on button click i change size of client area in app window. Something like in some graphic app's when picture is to big the scroll bars appear. I neet client area
much bigger than screen size e.g. 5000x5000 pixels.
My app type is SDI , main window is derrived from CFrameWnd, Style:Child , Borde:Resizing.
Please help.
|
|
|
|
|
zarraza wrote: i want to write an App in which on button click i change size of client area in app window.
You can't.
It's up to you to manage what's displayed in the client area.
If you have more data than fits in the client area, you need to keep track of that.
GDI can help a bit with its window/vieport settings.
Or if you prefer, you can keep track of it yourself, drawing just the visible portion of
your data.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Why you dont want that your dialog has scrollbar?
|
|
|
|
|
What about...
CSize sizeTotal;
sizeTotal.cx = 950; sizeTotal.cy = 1400;
SetScrollSizes(MM_TEXT, sizeTotal);
and make your view derived from CScrollView.
But with SDI you may have problems, frame and client area are connected. You can always try it with an MDI App but limiting the number of opened documents to one. I make it so to have more functionality about client area and multiple views with same document.
In MDI you have the CMainFrame for the App window and the ChildFrame for the main view related with the document. You can change the size of the client area in the BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) and specify the size of the frame, change caption, properties and so on.
For example in my program.. My main frame (app window) is maximized to screen resolution. Then the MainView frame is 620x420 to be sure it has no problems in any monitor or resolution but te client area is 950x1400 (as I say in the snippet above), afterwards I have different secondary views with different frames size (some fix, some dinamics)
if (m_pDoc->m_szNewFrameName == "PCLayout")
{ cs.cx = 500; cs.cy = (40 + (25 * nMax));
}
else if (m_pDoc->m_szNewFrameName == "SPSMonitor")
{ cs.cx = 525; cs.cy = 300;
}
else if (m_pDoc->m_pObjInput || m_pDoc->m_pObjOutput)
{ cs.cx = 415; cs.cy = 260; }
else if ((m_pDoc->m_pObjRegler) && (m_pDoc->m_pObjRegler->m_nRegType == 0))
{ cs.cx = 517; cs.cy = 421; }
else if ((m_pDoc->m_pObjRegler) && (m_pDoc->m_pObjRegler->m_nRegType == 2))
{ cs.cx = 610; cs.cy = 435; }
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|