|
|
Thanks, but the function is not working on Win2K - our users may use win2k.
|
|
|
|
|
i did'n got what your saying
|
|
|
|
|
GetComboBoxInfo[^] does essentially the same and is supported by Windows 2000. I can't find the OS requirements of CComboBox::GetComboBoxInfo[^] but if you are sure it isn't supported in Windows 2000, you could give that one a shot.
modified on Thursday, February 10, 2011 11:29 AM
modified 13-Sep-18 21:01pm.
|
|
|
|
|
i do a HMI software, need on canvas into a text, the text can be through user operations to change size ,
It required text font will adapt to the text frame's size change, to fill the whole text frame's purpose
OnSize
{
CString title="我是中国人";
CRect rect=GetRect();
int len=title.GetLength();
m_logFont.lfHeight=LONG(rect.bottom-rect.top);//LOGFONT m_logFont;
m_logFont.lfWidth=LONG(rect.right-rect.left)//len;
}
OnDraw()
{
CFont Font;
Font.CreateFontIndirect(&m_logFont);
dc->SelectObject(Font);
dc->DrawText( GetTitle(), GetRect(), DT_WORDBREAK );
}
When drag rectangle sometimes can be complete shows the whole string, sometimes only display several characters, behind of appears not to come out, high is no problem,width sometimes is small,why???
|
|
|
|
|
Cannot you use DrawRect with DT_CALCRECT format specifier (see MSDN[^]) to obtain the correct size for the rectangle?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Can say the concrete spot ???
|
|
|
|
|
Use DrawText with the DT_CALCRECT format flag to just obtain the rectangle dimensions (the [in,out] lpRect parameter) then use again the function to actually write the string in the properly sized rectangle.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks you, but, when the rectangle increases toward right ,rect.left is Fixed ,rect.right is changed,it's good, but increases toward left time, the rect.left and rect.right has had the change,why???
|
|
|
|
|
You could try to draw in a calculated (CDC::GeTextExtent(..) ) rectangle with a some fixed font and...
...in an applied zooming transformation (CDC::SetWorldTransform(..) ) to the context.
So you can stretch the rectangle (with its content) like a gummi bear...
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
Hi guys,
I wanted to find out whether one can set up a test fixture to apply all tests to the same instance of the fixture object ?
Let's us take for an example the following Testclass implemented.
class SampleTest:: public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( SampleTest);
CPPUNIT_TEST( doTest1);
CPPUNIT_TEST( doTest2);
public:
void doTest1();
void doTest2();
}
For each test in a test fixture, CppUnit creates a new instance of SampleTest class.
Thus for fixture SampleTest containing tests doTest1() and doTest2(), CppUnit will
create 2 instances of SampleTest class and calls doTest1 on the first instance, doTest2 on the second instance.
I would like to know if it is possible to create only one instance of SampleTest class that can call both the test functions?
Thanks in advance.
|
|
|
|
|
cydd wrote: For each test in a test fixture, CppUnit creates a new instance of SampleTest class.
Correct, but it is not just before the test case function is called. The cpp unit is designed to collect all the test cases initially (this happens with macro CPPUNIT_TEST - see its definition), and map them against the an instance created for them. This is to make each test case purely independent. You have to set all the possible preconditions in each test case method in such a way that the testing will be meaningful for the context.
|
|
|
|
|
Thanks for your reply.
Is there any other way to create only one instance of SampleTest class that can call on both the test functions?
|
|
|
|
|
Can't you simply write a test function that in turn calls the other two functions?
|
|
|
|
|
That will work.
But, the error report generated will not be of much help.
Say,if I have a function called testCaller() which in turn calls the two functions, doTest1 and doTest2 respectively.
If there happens an assertion failure in doTest1,the control returns without executing assert statements written in doTest2.
Also the report will say the test name only as testCaller and not the relevant function (doTest1 in this case).
|
|
|
|
|
I understand, but is that not an imaginary problem? The test should succeed. If you get an error, you would probably just go back and debug the test case anyway?
|
|
|
|
|
Hi everyone,
I am trying to do simple line plotting, i have used a CStaticCtrl on which i am trying to plot a line on a button click event,this works fine for the first time,when the button is pressed for the second time,the value is not updated,i mean the previous line is not erased and the new line is drawn
My Code
void CMainWindow::OnPumpOffClicked()
{
CRect rect;
CDC *dc=m_pic1.GetDC();
CPen pen,*oldpen;
m_pic1.GetClientRect(&rect);// m_pic1 is variable for the static control
//dc->Rectangle(&rect);
pen.CreatePen(PS_SOLID,10,RGB(255,0,0));
oldpen=dc->SelectObject(&pen);
dc->SetMapMode(MM_ISOTROPIC);
dc->SetViewportOrg(0, 148);
dc->MoveTo(x1,y1);
dc->LineTo(x2,y2);
}
Any help is appreciated
|
|
|
|
|
You really shouldn't put your drawing code in the mouse event. What you have to do instead is store the new lines coordinate when the button is clicked and refresh your control. This will call the OnPaint method in which you erase the background and draw all the lines that you stored.
If you want to use an existing charting control, you can also look at my sig: there's a link to such a control that I developed.
|
|
|
|
|
Hey,
Thanks for the reply,sir i would be very kind of u if u please explain it more detail, i mean if u can just edit my code and show me in short,i know i am asking for too much from u,but the ctrls u have developed are like a bouncer for me,thanks again
|
|
|
|
|
It's a bit too much code to write here but if you want an example, simply look at my chart control (the CChartCtrl class and more specifically the OnPaint method). What you are doing is drawing your stuff on your main window. You should in fact create a custom control and put the drawing code in your custom control (search for articles about custom controls, there are a couple for beginners on this website).
|
|
|
|
|
Hi,
I have a dialog box application. It contains one list control (CListCtrl). It filled with some data. After double clicking on any row of it new modeless dialog gets opened.
My problem is after opening new modeless dialog box, the main dialog box's row on which i have double clicked should remain selected means display it partially that it is selected. So the user can see on which row he has double clicked previously though a modeless dialog box is opened.
If have any idea please reply.
Thanks in advance.
Regards
Rajendra
|
|
|
|
|
Add the style LVS_SHOWSELALWAYS to the CListCtrl.
|
|
|
|
|
Use List Control Properties Dialog.Select "Show Selection Always" so you can see your the item as selected item in List Control
I am a HUMAN. I have that keyword in my name........
_AnsHUMAN_
|
|
|
|
|
I want to fix the number of threads to spawn for a particular task and I do'nt know if that should depend on the number of logical processors or on the number of physical processors available to the system.
The number of physical processors can be read using the ::GetSystemInfo API while the ::GetLogicalProcessorInformation API returns the number of logical processors.
Any insight please ?
thx in advance.
Push Framework - now released !
http://www.pushframework.com
|
|
|
|
|
[ADDED]
What follows is based on the assumption a lot of homogeneous work, mainly calculations, is to be performed and can be organized in a (small) number of threads without needing lots of synchronization. It would not apply to inhomogeneous operations, say some threads performing calculations, others disk I/O, others network I/O, etc.
[/ADDED]
In general I would base my considerations on the number of threads that can be active at the same time; this would ignore the physical aspects involved such as separate packaging, multi-core, hyper-threading... So the number of (logical) processors returned by GetSystemInfo() is what I would use.
The one exception would be applications where performance is dominated by cache efficiency; if so, what really matters is the number of separate level-2 caches available, which could be better approximated by the number of physical processors.
Hint: what would be keeping you from trying both? As your threading code would be dynamic anyway, why not perform an experiment? or even make it automatic: run with N threads for a while, then try 2*N and see if that is an improvement, then decide.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Tuesday, February 8, 2011 5:10 PM
|
|
|
|