|
Change text and background color to imply selection.
Use DrawFocusRect()
|
|
|
|
|
Thanks for your answer, but my question should refer to the rectangle you drag with the mouse when you select multiple items. The standard listview just shows a grey border, but Windows Explorer fills this rectangle transparently with the selection color.
|
|
|
|
|
If your control is owner drawn, then you get that 'transparent' effect by changing the background color prior to drawing the text. The 'grey frame' you see by default is the DrawFocusRect.
If you mean the outline of the folders as they are dragged, then I think there is an interface for creating the bitmap mask used for the 'drag image'.
|
|
|
|
|
I did not mean the selection of the icons, but the rectangle you draw with your mouse.
Perhaps a picture can say more than thousand words.
By the way, the control is not owner drawn.
|
|
|
|
|
I really wish I could help you more, but I do not know what else to do. I briefly searched for some interface to create a draggable image or change the hilighting, but everything I found seemed to require owner drawing.
|
|
|
|
|
|
Hello friends,
Im working on a big VC++ project consisting of several .c and .h files.
Now I had included a new library which is written in C++ with many .hpp and .cpp files.
Now the main program, is a mixture of both c and c++ code and Im getting some errors when complied.
If this main program is main.c , Its unable to recognize "Class" in the first header file included and also its showing some >100 syntax errors which refers to C:\programfiles\microsoft visual studio\vc98\include\iosfwd directory.
If this is written as .cpp,
Its showing >100 syntax errors,where I couldnt find any error when its .c
Can anyone gimme an idea,how to deal with this?
Thanx in advance.
Regards.
|
|
|
|
|
don't use C++ code in .C files, and don't #include headers that use C++ code in .C files.
the compiler compiles .C files as C and that means any C++ code it sees while compiling a .C file is just syntax errors.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
prgr wrote:
Can anyone gimme an idea,how to deal with this?
You need to use extern to Specify Linkage[^]
Here's an example:
#ifdef __cplusplus
extern "C" {
#endif
int c_func_in_c_file(int someParm);
int c_func_in_c_file2();
#ifdef __cplusplus
}
#endif
#include "cFunctions.h"
#include "cppFunctions.h"
int c_func_in_c_file(int someParm)
{
return someParm + c_func_in_cpp_file();
}
int c_func_in_c_file2()
{
return 42;
}
#ifdef __cplusplus
extern "C"
{
#endif
int c_func_in_cpp_file();
#ifdef __cplusplus
}
int cpp_func_in_cpp_file();
#endif
#include "cppFunctions.h"
#include "cFunctions.h"
extern "C" int c_func_in_cpp_file()
{
return cpp_func_in_cpp_file() + c_func_in_c_file2();
}
int cpp_func_in_cpp_file()
{
return c_func_in_c_file2();
}
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I have to read and store data in a series of unsigned short variables in Shared Memory.
Now these variables are scaled and I need to convert them into their proper units. I display them as either float or integers.
For example for one variable:-
Max Val = 0.999969
Min Val = -1.000000
Least Sig Bit = 0.000030517578 = scaleFactor1.
So what I do is:-
unsigned short currentField = *(unsigned short *) fieldPtr;
float scaleFactor1 = (float)GetScalingFactor(scaleFactorStr);
float rescaledDataEng = currentField * scaleFactor1;
This works OK (rescaledDataEng ) for positive numbers, but for negative numbers it fails, e.g. I get for -0.44 the incorrect value displayed as (rescaledDataEng = 1.560028).
Are they a neat soultion to this problem other than adjusting for out of range data.
if(rescaledDataEng > maxValue) rescaledDataEng = -(1 -(rescaledDataEng - maxValue)); Also I dont think that I store the data (negative value corectly) when writing to the Sared Memory:-
*(unsigned short *) fieldPtr = (unsigned short)(fEngValue/m_fScalingFactor);
For example for one variable:-
Max Val = 179.999
Min Val = -180.000
Least Sig Bit = 0.005493 = m_fScalingFactor.
I enter -20 and 159.01 is displayed.
Any suggestions please as the more I look at the problem the more confused I get.
|
|
|
|
|
How can you read in negative values into an unsigned variable? e.g.
unsigned short currentField = *(unsigned short *) fieldPtr;
You can never have currentField = -0.44 or -20 and have correct results.
|
|
|
|
|
This may help to show the problem:-
For example for one variable:-
Max Val = 179.999
Min Val = -180.000
Least Sig Bit = 0.005493 = m_fScalingFactor.
I enter 20 and 20.00 is displayed; i.e. 20/0.005493 = 3640.9976 is stored
(0E38 Hex)
When I come to display the value I do the following:-
Get the value (0E38) and re-scale it = 0E38 * m_fScalingFactor = 20.00.
Works fine!
But for this example:-
Max Val = 179.999
Min Val = -180.000
Least Sig Bit = 0.005493 = m_fScalingFactor.
I enter -20 and 159.01 is displayed.
How to handle negative numbers?!?
grahamfff
|
|
|
|
|
Additionally, you can use below formula to scale any value from one range to another:
a = (q - p)/(s - r)*(b - r) + p
if you'd like to convert value of b belonging to range (r,s) to value a belonging to range (p,q).
|
|
|
|
|
will this equation cope with signed and unsigned data; e.g. could have a counter defined as unsigned with range 0 to 65534 with LSB = 64.
Also have angle, signed range -1 tp +1 with LSB = 0.0055
(Range -180 to +180 degrees)
Cheers,
Graham.
grahamfff
|
|
|
|
|
The formula I gave is the most appropriate for floating point arithmetic. It does work in all cases where you have to scale one set of values from an interval to another interval. In the case of integer values there is a matter of precision loss but at some level of accuracy it works as well. LSB converts from t (old) to v (new) as follows:
v=((q-p)/(s-r))*t
PS. If I understood you well...
|
|
|
|
|
hi
i want to create chatting applicatoin for LAN for that i m using the CAsyncsocket class. i had searched the MSDN for that purpose.
i made the client and server from the help of MSDN but i works on the single computer but not on lan.
The steps specified in the MSDN for making the server is
create (portno);
listen( );
accept();
but the server is not binded with any adress. what i should do use the bind ( ) function or give these paramter on create ( ).
there is no description what is the default values are.
can anybody help me and give the names of functions for making the Lan server and client with paramete bcos no decription what are defaul
and what not.
ddd
|
|
|
|
|
|
Why don't you trace the code to find out what CAsyncSocket::Create does?
This is the easiest way of learning MFC .
Don't try it, just do it!
|
|
|
|
|
I need a good and smart way to pick a number and then make it "occupied". This is needed on 9 lines with 9 numbers from 1-9. I have a system allready with a class that makes a bool true when its occupied but there's some leak=/ because it's looped and must be applied on every line.
Does someone have a good general way to do this?
I'm trying to make a solver for this puzzle.
http://www.puzzle.jp/letsplay/applet/sd_sample_002-e.html[^]
|
|
|
|
|
One way might be:
int nNumbers[9][9] = {0};
...
while (1)
{
int nRow = rand() % 9;
int nCol = rand() % 9;
if (0 == nNumbers[nRow][nCol])
{
nNumbers[nRow][nCol] = 1;
break;
}
} There are several other approaches to this.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks for answering but it's not really what I'm looking for.
You see, I have a class called Number.
I create a [9][9] array of it.
It is preset with 1-9 for every line:
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
myNumbers[i][j].setNumber(j + 1);
}
}
It is suppose to return a value:
//The puzzlecell is a class too.
//The random picked number for the line is put at the current position in the PuzzleCell which stores a value and will be presented in a Label when done.
myPuzzleCell[i][j].setTheValue(myNumbers[i][tempRand1].getNumber());
All this has to have the ability to preset and reset stuffs since I have all this in a huge loop which checks if the lines are good due to the Puzzle rules, which you can find at the page I linked previously. Please check the puzzle out so you get a hint.
Notice that I cannot only set random values and wish for it to be done in a century, I also have a system where I if a Line == 45 // (1+2+3+4+5+6+7+8+9) then save that line (by setting them to permanent true).
|
|
|
|
|
can any one tell me how to display a web page using MFC? just like we do in VB making use of the web controls...
regards,
Rookie
|
|
|
|
|
One way is to create an SDI application using a view derived from CHtmlView . Then you can use the Navigate() or Navigate2() methods to display the page.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Another way is to directly use a web browser control. See this[^] link.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Nice link Ravi.. thanks.. i cant believe how fast i'm getting help with codeproject..!
vivek
|
|
|
|