|
I haven't tried, but I felt that it will work. (It's a little bit complicated.)
Make a region with a rectangular hole for the Y Axis window and set it to the scrollview. So you will get space to place the Y Axis window. The parent of Y Axis window should be the same of that of scrollview. Position the Y Axis window right there.
Steps to make such a region can be as follows
1. Create a rect-region with size of scrollview.
2. Create another rect-region with size and position of Y Axis window.
3. Combine both regions
Apply this combined region to scrollview.
- ns ami -
|
|
|
|
|
Thanks for the reply
I did the same before.
I am having a class CGraphicsView derived from CScrollview
Then CYAxis derived from CWnd
Then i am dynamically creating the CYAxis to CGraphicsView in OnCreate function.
Then in OnDraw function i am displaying the CYAxis.
But the problem i am facing is that while horizontal scrolling the YAxis values is getting disturbed ie is not aligned properly.
|
|
|
|
|
Can you please show some relevant code snippet of CYAxis creation, region creation and setting, and positioning of CYAxis?
- ns ami -
|
|
|
|
|
YAxis is created inside CGraphicsView as follwing
int CGraphicsView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CScrollView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
//CYAxis m_wndYAxis2;
if (!m_wndYAxis2.Create(0,0,WS_BORDER|WS_CHILD,
CRect(0,0,50,150), this, 0 ))
{
TRACE0("Failed to create Power Bar\n");
return -1; // fail to create
}
m_wndYAxis2.InitializeVariables();
return 0;
}
Positioning of YAxis is done inside OnDraw() function
void CGraphicsView::OnDraw(CDC* pDC)
{
//------------------- my code ---------------------------
CChildFrame* pChildFrame = NULL;
pChildFrame = (CChildFrame* )this->GetActiveWindow();
CSize size = GetTotalSize();
if ( pChildFrame!=NULL )
{
CRect rectFrm;
pChildFrame->GetWindowRect( rectFrm );
m_wndYAxis2.SetWindowPos(&wndTop, rectFrm.left, rectFrm.top,rectFrm.right/12, size.cy, SWP_SHOWWINDOW );
}
}
Please help me if u get any clue.
|
|
|
|
|
But you are not using a region clip as I suggest. In that case you need to create the CYAxis window with parent as scrollview's parent (Instead of 'this', you need to pass 'GetParent()').
As I said earlier my solution would be complicated. You can try for the other reply too that you got...
- ns ami -
|
|
|
|
|
Your problem has an easy solution...
In your CMyScrollView::OnDraw function, just call GetScrollPosition, and add the ptScroll.x value to your drawing code for the Y scale.
I might be 100% wrong and you need to subtract the ptScroll.x value instead, but you can find that out faster than I can!
It won't be flicker free, but it will help. For a flicker free solution, you'll have to get more complicated. I use my own view class and handle scrolling myself, and also make a non-zero nonclient area around the edge for a scale / ruler. But that's too much for a quick forum reply!
Good luck,
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Thanks Ami and Iain for your replies..I am trying in all ways possible.
modified on Monday, February 23, 2009 3:02 AM
|
|
|
|
|
I put up a post around a week ago asking for some help to fix a broken class view in visual studio 2008 which prevent me from seeing class function in the tool bar.
Although I recived a couple of replies they did not help. I decided to try to repair my class view this morning.
I have repaired the class view by backing up all of the classes which were not visable. Then deleting the classes from my project and creating new classes with the same names as the broken classes. And finaaly copying back the backed classes to the project over writing the new ones.
I can now see all my classes in the class view and have access to all the function from the tool bar.
Hope this is useful.
Desmond Mardle
RF/ATE ENG
|
|
|
|
|
Update
Restarted browser and all my hard work dissipeared.
I will keep trying to fix this problem.
Desmond Mardle
|
|
|
|
|
Hi Friends,
I am new to code project, so I want to say a hello to all of you. and I am also new to programming. So I have a problem for you.
Can anybody please write a C++ code for solving Travelling Salesman Problem using dynamic programming algorithm?
Thanking You.
|
|
|
|
|
Hi, welcome in the C++/MFC forum. As you're new, I strogly suggest reading carefully the messagge at the top of the forum [^] before posting any question (for instance, "please send me code that solve my problem" should be avoided here).
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]
|
|
|
|
|
I think you are not aware of this forum much, I sincerely suggest you to google for any code (if available) that you needed. And once you tried that and tired , then asking for help to solve that issue will help you.
- ns ami -
|
|
|
|
|
Runish Kumar wrote: Can anybody please write a C++ code for solving Travelling Salesman Problem using dynamic programming algorithm?
Yes, I'm sure somebody can.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Runish Kumar wrote: I have a problem for you
Here's a starter[^] for you...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Hi Experts
I am accessing the database using VC++ and want to read a row at a time. Is there any API to read a row?
Thanks in advance
RYK
|
|
|
|
|
Usually recordsets do exactly what you want (you know: vague question => vague answer).
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]
|
|
|
|
|
I am using RDLC and i want to add dynamic text in header as well as in footer and some images in to the header but i cant understand how to add it in same rdlc.
i can add static text in header as well as footer and when i add dynamic text in header it will be displayed in the first page only(after saving report in PDF format) but i cant get same text in next continuing pages
will you help me please as early as possible
|
|
|
|
|
Hello,
I want to serialize structure like this:
struct FRAME{
int Len;// size of Text following
char Text[];
} ;
the problem is that this is not a fixed length variable! how could I read the structures after being serialized?
Thanks
|
|
|
|
|
Read 4 bytes first to get the length value.
Now read the number of bytes identified by length.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
The way it's usually done is something like this:
- Read
Len from whatever you're reading from - Allocate a buffer of size
Len + sizeof Len bytes. - Copy
Len into the first sizeof Len bytes of the buffer - Read
Len bytes into the buffer after the copied value of Len - Cast the buffer pointer to FRAME* and return it
Let's presume you're reading from a C FILE :
FRAME* ReadFRAME(FILE* file)
{
int Len;
fread((void*)&Len, sizeof(Len), 1, file);
char* space = (char*)malloc(Len + sizeof(Len));
FRAME* gotFrame = (FRAME*)space;
gotFrame->Len = Len;
fread((void*)gotFrame->Text, 1, Len, file);
return gotFrame;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Is there any new version of NtDsAPI.lib available for 64 bit application? If anybody knows plz reply.
Thanks & Regards
VIJITH VIJAYAN
|
|
|
|
|
|
I'm working on an application which uses a GDI+ bitmap and graphics object to double-buffer to the CView class (I don't use any Windows controls at all). This is all working very well, and I've certainly found GDI+ a little easier to work with than my previous experience working with GDI.
However, there are times when I need to be able to sustain refresh rates of around 50Hz on certain small portions of the screen. The drawing to the background bitmap isn't a big problem here, but the call to DrawImage() in OnPaint() is as it's taking a long time and chewing up a lot of processor time.
I've tried doing a GDI BitBlt() instead but while that function is fast, the creation of the HDC and HBITMAP and everything else needed isn't, and there's no speed advantage.
Has anybody got anybody got any ideas on how to speed up these calls to DrawImage()? I just don't believe that it should take up so much processor time to do so little - I know the GDI+ calls don't use hardware acceleration, but still...
|
|
|
|
|
Another idea:
Use two temp memory image(first is display,second is create in memory; change them when second is ready).
|
|
|
|