|
Hi,
I am using DC 's ScrollDC to scroll the contents of a custom control.
There are some problems though...
Whenever a window is hovering the control, the DC does not scroll the contents properly. Example:
Custom Control's pos/size: [0,0] - [100, 200]
Now imagine a window hovering at [75, 60] - [outbounds control]
The DC does not scroll from [75,0] - [100,60] !!!
Why?
Note: I am calling ScrollDC without passing (nulling) pRgnUpdate and lpRectUpdate (the last two parameters), as I don't really understand their meaning.
BOOL ScrollDC( int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip,
CRgn* pRgnUpdate, LPRECT lpRectUpdate );
|
|
|
|
|
hi friends,
i m working on a radar display in vc++.i.e.i want to plot a trajectory using xyz coordinates.i have to display a number that should move with the trajectory.as i know the xyz co ordinates and the no as well, i m able to display it.but the problem is that as the trajectory moves the no should also move with it.so that the no now gets displayed on the new coordinates and the one that was on the last coordinates gets deleted.so that it also seems to be moving witjh the trajectory. i m displaying the no using textout function.if anyone can give some idea on how to delete the no on the previous points so that it gets erased as soon as we get the new coordinates or if there is some other method of displaying the no so that it is visible only on the current point.
waiting for a reply....
Aarti Vimal
Scientist 'B'
Defence research & Development Organisation,
Bangalore,
Karnataka,
India.
|
|
|
|
|
I once did something like this in 2D. I'm not sure if I <i>deleted</i> the textobject, or I drew a rectangle over it. I think it was the second though. Draw a rectangle over your text and draw new text @ new position.
good luck!
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Keep track of the point's current coordinates. When the point moves, first overwrite the existing text using a pen whose color is that of the background, then write your new text.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
okay...i understood whatever u said but i suppose my problem is somewhat different.i have something drawn in the background of the view.Whenever i draw a rectangle over the text or overwrite it with the pen, the background also gets erased and if the trajectory is circular the previous path also gets erased.So please if there can be some solution specific to my problem..............
Aarti Vimal
Scientist 'B'
Defence research & Development Organisation,
Bangalore,
Karnataka,
India.
|
|
|
|
|
Hi all the guru, I am currently using ODBC to access MS SQL. Can anybody tell me how to get number of columns if given table name? Thanks thanks thanks!!!
vivi
|
|
|
|
|
Try Desc "tablename" query. Get the recordcount from the recordset. The count you get is the column count.
|
|
|
|
|
Vikram,
You need to be careful if you are suggesting to use CRecordset's GetRecordCount() function. According to MSDN, this function only returns the number of seen records in the set. So, right after opening the set, the function will return only 1. You would want to execute another SQL query that counts the records in the resulting set using the COUNT aggregate, or (more inefficiently) loop through the recordset with CRecordset, and then call GetRecordCount().
If your suggestion did not depend upon CRecordset, this, of course, doesn't matter.
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
I was also told the same thing that you just said, but was told to use MoveLast, then MoveFirst, and the count should be right.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hmm, that's interesting. I've never tried that, but MSDN says this:
[MSDN]
Caution The record count is maintained as a "high water mark," the highest-numbered record yet seen as the user moves through the records. The total number of records is only known after the user has moved beyond the last record. For performance reasons, the count is not updated when you call MoveLast. To count the records yourself, call MoveNext repeatedly until IsEOF returns nonzero. Adding a record via CRecordset:AddNew and Update increases the count; deleting a record via CRecordset::Delete decreases the count.
[/MSDN]
It might work, though that paragraph seems to mention it specifically.
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
I've never seen that before, so thanks!! BTW, when I was told this it was in reference to an ADO recordset object I was using in VB; don't know if that makes any difference.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
If you have MSDN I would also suggest searching for the file "catsets.h". This is a bunch of CRecordset-derived classes that allow you to use a table name to get the names, types, and everything else you want to know about the columns. There's also ones to list all the tables, stored procedures,queries, views, primary keys, foreign keys, etc. Hope this helps!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hi!!! How am I be able to Get all URLs placed in the History Folder?! I have a Code here but it has an Error in its Include (unexpected end of file...)... Im trying to find another way... thanks in advance!!!
|
|
|
|
|
Liger_Zero_X wrote:
How am I be able to Get all URLs placed in the History Folder?!
One way, among others, would be the CFileFind class.
Liger_Zero_X wrote:
I have a Code here but it has an Error...
And that error would be ??
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello,
I have stumbled across one odd (in the very least) situation.
According to what MSDN makes reference to, almost all pos/size changing methods understand left/top as the topmost coordinates and right/bottom as the width/height. But that doesn't work in my programs, for some reason, as right/bottom are understood as screen coordinates and not as width/height.
Should I be doing any coordinate mapping of some sort? What am I missing out here?
David
Example:
In MSDN:
CWnd::MoveWindow
void MoveWindow( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE );
void MoveWindow( LPCRECT lpRect, BOOL bRepaint = TRUE );
Parameters
x Specifies the new position of the left side of the CWnd.
y Specifies the new position of the top of the CWnd.
nWidth Specifies the new width of the CWnd.
nHeight Specifies the new height of the CWnd.
bRepaint Specifies whether CWnd is to be repainted. If TRUE, CWnd
receives aWM_PAINT message in its OnPaint message handler as usual. If this
parameter is FALSE, no repainting of any kind occurs. This applies to the
client area, to the nonclient area (including the title and scroll bars),
and to any part of the parent window uncovered as a result of Cwnd’s move.
When this parameter is FALSE, the application must explicitly invalidate or
redraw any parts of CWnd and parent window that must be redrawn.
lpRect The CRect object or RECT structure that specifies the new size and position.
|
|
|
|
|
Technicaly, if you want to move your windows inside another window then you should perform some mapping. However, why don't you post some code so everyone can see what you mean?
// Afterall, I realized that even my comment lines have bugs
If the sun were to blow up, it would take us 7-8 minutes to realize it.
|
|
|
|
|
If you are working with CRect s, use the Width and Height members respectively. Otherwise, deduct the left coord from the right and the top from the bottom, and you'll get the height and width. You might also want to check SetWindowPos , where you can select SWP_NOSIZE to just move the control.
There is otherwise no need for any coordinate manipulations.
|
|
|
|
|
Johan Rosengren wrote:
If you are working with CRects, use the Width and Height members respectively.
So you mean, width/height only apply to CRect objects?
Johan Rosengren wrote:
Otherwise, deduct the left coord from the right and the top from the bottom, and you'll get the height and width.
That's exactly what I have been doing...
I was just confused with the information you can find in MSDN -- they make no mention (or actually little) to CRect objects, but instead to (LP)RECT structures; they mention width/heights of rects and NOT coordinates; ...
This is why I thought you didn't really need to use screen coordinates -- after all you do. (isn't it?)
Thanks for the replies, everyone.
David
|
|
|
|
|
dNimrod#X wrote:
Johan Rosengren wrote:
If you are working with CRects, use the Width and Height members respectively
Width and Height of CRect are calculated by subtracting the coordinates and they do not represent the actual coordinates of the rectangle. So you shouldn't use them directly as coordinates in your MoveWindow function.
Width and Height in CWnd::MoveWindow() are coordinates, not sizes. CRect is similar to RECT struct. You initialize these two with coordinates, not sizes. MoveWindow API takes coordinates (not sizes) as parameters and CWnd::MoveWindow encapsulates this function. I hope this is not confusing you because as I am reading it now I am starting to have second thoughts about my explanations.
// Afterall, I realized that even my comment lines have bugs
If the sun were to blow up, it would take us 7-8 minutes to realize it.
|
|
|
|
|
Toni78 wrote:
I hope this is not confusing you because as I am reading it now I am starting to have second thoughts about my explanations.
You should From MSDN, on MoveWindow :
nWidth
Specifies the new width of the <code>CWnd</code>.
nHeight
Specifies the new height of the <code>CWnd</code>.
It is the height and width, not the coordinates.
|
|
|
|
|
Johan Rosengren wrote:
It is the height and width, not the coordinates.
Yes, you are so right. Sorry, for the confusion that I created.
// Afterall, I realized that even my comment lines have bugs
If the sun were to blow up, it would take us 7-8 minutes to realize it.
|
|
|
|
|
dNimrod#X wrote:
So you mean, width/height only apply to CRect objects?
Yes, RECT is a simple structure
Here you have an example of moving a control using MFC:
CRect rect;
m_ctrl.GetWindowRect( rect );
ScreenToClient( rect );
m_ctrl.MoveWindow( rect.left - 10, rect.top - 10, rect.Width(), rect.Height() );
|
|
|
|
|
How do i find whether a file is present in a directory or not?
|
|
|
|
|
/* Check for existence */
if( (_access( "filename, with full path", 0 )) != -1 )
{
//file exists
}
This will do the trick for you
|
|
|
|
|
will the same trick work to find the existence of a directory
|
|
|
|
|