|
the type of Report for ListCtrl
LVCFMT_CENTER have been setted ,but the first colum shows like LVCFMT_LEFT
How can I make the text to the center of the head?
Thanks a lot!
E-mail:
wushlimail@163.com
|
|
|
|
|
How are you inserting that column?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Remember that the CListCtrl methods are zero based. So the first column starts at 0.
Maybe thats the problem.
I Dream of Absolute Zero
|
|
|
|
|
This is a well-known bug with the list control. The first column is always left-justified. Solution? Create an extra column as the first, and then delete it after you've added the second. Now the second is the first, actually uses the alignment you set for it, and everyone is happy.
(For reference: Microsoft's wonderfully-helpful writeup )
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
I have a problem making a program, that takes one fraction and simplifies it....
for example the fraction (2/4) is simplified to (1/2)....
that´s my small problem..
my larger problem is then adding/substracting two fractions....
With previous thanks...
JohnnyIce
C++ Beginner
|
|
|
|
|
you need to define a "fraction" structure to hold the numerator and the denominator, and do basic operations as defined there link at mathworld[^]
and to reduce the fraction you need to find the greatest common divisor of the numerator and denominator.
( I will let you have a look at it ... since my connection to mathworld is really slow this morning)
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
thanks..
but i know the mathmatical definitions of fractions.....
my largest problem is to put it on C++ form...
So that i can simplify fractions.....
My weakest link in this chain, is the programming it self...
Having the program figuring out the smallest fraction of f.example (2/4).
with previous thanks..
JohnnyIce
C++ Beginner
|
|
|
|
|
To simplify, or reduce, 2/4, you must divide both the numerator and denominator by their greatest common divisor, which is 2. To simplify 12/16, you must divide both the numerator and denominator by their GCD, which is 4, yielding 3/4.
Here is a code snippet:
CString strFraction = "12/16";
int nSolidus = strFraction.Find('/');
int nNumerator = atoi(strFraction.Left(nSolidus));
int nDenominator = atoi(strFraction.Mid(nSolidus + 1));
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
well.....actually tis the programming part that comez to be easy.....
letz split that up ur problem into small functionalitiez.....
like said above u r to find the GCD.....
so from thiz u can conclude that there are three thingz u ought to do .....
1)
(a)write a function to find all the possible factorz of the numerator(place the factorz in an array say a[])
(b)write a function to find all the possible factorz of the denominator(place the factorz in an array say b[])
2)write a function which findz the greatest comman factor from the arrayz a & b
3)divide the numerator and denominator with this GCD......and voila....
u did it.....
Happy Programmin....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
or u could just
compare the two (the denominator and the numerator) .....find out which one is the greatest......and find all the factorz of the greatest number.....then divide these factorz with the other number(which happenz to be the smaller one).....the greatest factor for whch u get no reminder will be ur GCD.....
Happy Programmin.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
When I need to call my function
<br />
<br />
CreateSplitters(int nRows, int nCols, int m_actRow, int m_actCol, CCreateContext*<br />
pContext)<br />
<br />
I need to give parameter CCreateContext* pContext. How can I do it?
Thanks in advance, bilas.
|
|
|
|
|
Without knowing what CreateSplitters does with a CCreateContext struct!
CCreateContext context;
CreateSplitters(nRows, nCols, nActRow, nActCol, &context);
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Is there any difference between private: and private:\ in c++/vc++?
rajesh
|
|
|
|
|
Do you mean private:\ as in
<code>
class CClass
{
private:\
public:\
};
</code>
then the \ is used as a continuation character. Usually used to continue the current line, if it gets too long.
I Dream of Absolute Zero
|
|
|
|
|
Rajesh_K_Sharma wrote:
Is there any difference between private: and private:\ in c++/vc++?
'vc++' is a compiler to compile 'c++' codes.
suhredayan There is no spoon.
|
|
|
|
|
Hi,
how can i change the arrow cursor to hand cursor when the mouse is on the button?
i tried this:
HCURSOR m_hCursorHand;
m_hCursorHand = AfxGetApp()->LoadCursor(IDC_HandCursor);
m_ExitButton.SetCursor(m_hCursorHand);
and this:
m_TestButton.SetCursor(::LoadCursor(NULL,"IDC_CURSOR1"));
but its not working.
Thanks,
Eli
|
|
|
|
|
the prob is that when u set the cursor to an another type.....and when u move the Onmousemove getz called and the previous cursor getz put it.....u can sove this by overriding the OnSetCursor function
all mouse messages that are recieved call the in the end the OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) function.....make sure that in this function you specify the code that in this function(it is better).....
if(m_DragOn==FALSE)
{
hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR1 );
SetCursor( hIcon );
}
else
{
hIcon = AfxGetApp()->LoadCursor( IDC_CURSOR2 );
SetCursor( hIcon );
}
Like for example declare the variable say m_DragOn and keep setting/clearing this variable in places where u want the handcursor(assume handcursor is IDC_CURSOR2 and is set when m_DragOn is TRUE)
hope that helpz.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
hi, anyone got any idea how to convert a bitmap to a jpeg without using an already made libary? (please explain it, because i dont know visual c++ very well)
Thanks
|
|
|
|
|
Without an already made library? Hmm, good luck trying to implement the JPEG compression code yourself...
Why not using the free CxImage library? I've used it several times and did everything perfectly. http://www.codeproject.com/bitmap/cximage.asp[^]
|
|
|
|
|
thanks for the reply, the problem is that im a complete muppet and can never get libary's to work. anyone care to explain how too? (And yes im know it may seem usless but i aint been use visual c++ for very long)
Thanks
|
|
|
|
|
I want to add an new item to the New option of the right click pop-up menu on the desktop?
I do I do that?
|
|
|
|
|
I am using an OCX ActiveX control which was written in VB within my MFC project.
After successfully inserting the OCX into my project, I can use the few methods declared within it and can use them successfully.
My problem is : I don't see the Event , that OCX is able to raise.The function just doesn't appear in the interface class the wizard created, to help me use the OCX.
How can I intercept the raised Event ?
Rubi
|
|
|
|
|
I currently trying to create mouse input using the SendInput method. I've currently got it so that I can change the mouse location however my program will in future take the new co-ordinates from a seperate program, does anyone know if there are any system methods to convert the users input (say in DP) to the 'display surface map'(i.e. 65535,65535)) used by the SendInput method?
Just in case I haven't explain clearly I paste what it says in MSDN about this:
"If MOUSEEVENTF_ABSOLUTE value is specified, dx and dy contain normalized absolute coordinates between 0 and 65,535. The event procedure maps these coordinates onto the display surface. Coordinate (0,0) maps onto the upper-left corner of the display surface, (65535,65535) maps onto the lower-right corner. "
The full article on MSDN is at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/mouseinputreference/mouseinputfunctions/mouse_event.asp[^]
|
|
|
|
|
Hello hello,
So...I am working on a ActiveX control, where when the user clicks the mouse and lets go of the mouse with the cursor over a specific area in the control, a CEdit control is made visible at the position of the ActiveX control. The user can enter a number into the CEdit control, and then when clucking outside the CEdit control, that value entered gets stored in a variable and the CEdit control becomes invinsible.
The problem comes when trying to click on that area of the ActiveX control again. the CEdit control will apear but can no longer enter any values. I cannot get that vertical line in the CEdit box that allows me to type in characters/numbers.
If I run it in debugging mode, with breakpoints at the point where the CEdit is to be shown, and where the CEdit is to be hidden, then it works pefrectly as many times as I like. I can keep clicking on that area of the control, showing the CEdit, entering a number, clicking elsehwere and hiding the CEdit, and so on and so forth.
It turns out that the reason why it works when debugging and not when not debugging is that when I have breakpoints in parts of the code, the focus leaves my control in the ActiveX control container, and goes to the VS window to show me the break point. Then when I press F5 and return back to the ActiveX container then it all works again.
Similarly, when I run the control out of debug mode, clicking on other windows or applications solves it and makes the control work.
so a sequence like this works:
1)click on the area over which the CEdit should appear,
2)CEdit appears
3)Enter a value
4)click outside the CEdit
5)CEdit disapears
6) >>click on other window/application/desktop etc<<
7)click back on ActiveX container
8) Go to step 1.
Without step 6, I canot get step 2 to happen more than once.
We thought it maybe a matter of focus. So, the code was changed so that when the CEdit control appears it also gets the focus, and when the user clicks elsewhere and the CEdit hides, that the parent control gets the focus.
I have put the code below...anybody who has actually read so far into this post might as well have a look at it. thanks!
<br />
LRESULT CKnob::OnLButtonUp(UINT , WPARAM , LPARAM lParam, BOOL& )<br />
{<br />
m_bMouseDown = false;<br />
<br />
RECT tempRect;<br />
GetClientRect(&tempRect);<br />
int nLeft = (tempRect.right - tempRect.left) / 2 - KNOBSIZE / 2;<br />
int nTop = (tempRect.bottom - tempRect.top) / 2 + KNOBSIZE / 2;<br />
if((LOWORD(lParam) >= nLeft) && (LOWORD(lParam) <= nLeft + KNOBSIZE) <br />
&& (HIWORD(lParam) >= nTop) && (HIWORD(lParam) <= nTop + TEXTAREA))<br />
{<br />
m_bShowCEdit = true;<br />
CString tempString;<br />
tempString.Format("%ld", m_nPosition);<br />
m_editValue.SetWindowText(tempString);<br />
int a = m_editValue.ShowWindow(SW_SHOW);<br />
m_editValue.SetFocus();<br />
}<br />
else<br />
{<br />
if(m_bShowCEdit == true)
{<br />
CString strTemp;<br />
m_editValue.GetWindowText(strTemp);<br />
m_nPosition = _ttoi(strTemp);<br />
int b = m_nPosition = max(m_nMin, min(m_nPosition, m_nMax));<br />
m_editValue.ShowWindow(SW_HIDE);
this->SetFocus();<br />
}<br />
m_bShowCEdit = false;
}<br />
<br />
return 0;<br />
}<br />
|
|
|
|
|
I have 2 printers installed, i need to switch from one to another without user interface. how to set the printinfo properties programatically?
were rgrtgrtvrtrt rtrtb brt tyuhjghj hbhbnh hnjm 1234567?
|
|
|
|