|
You need to read up on how messages are handled/pumped/routed, WM_PAINT, Begin/EndPaint, Rebar controls, and OnCtrlColor.
I'm afraid the MSDN docs for all are too lengthy to replicate here.
In short, i think you may be making things harder than they need to be.
Try using a rebar and handle OnCtrlColor in the parent control.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
hi
i am using TableLayoutPanel ,and i have created some rows and columns and i want to work with cells.
my problem is that i want to control one cell by changing it color when the cursor in on it.
|
|
|
|
|
hey all,
iam trying to do the following.
the data gets stored in a group of files. the files have to be called back or opened at a later stage to plot.
on selecting a checkbox, the default or the first file name (of say, 4 files) should be displayed in an edit bar. the edit bar goes active only on clicking the check box. the edit bar should be able to scroll through to find all the available files. the files are stored with .txt extension.
the file that gets selected gets plotted which is done by clicking another pushbutton "plot".
I cannot get the file names to be displayed in the edit bar. how do i do it?
Thanks in advance.
|
|
|
|
|
I didn't understood what was your problem exactly. If you don't know how to search for the files (and find the appropriates one), take a look at CFileFind[^] class.
|
|
|
|
|
thathvamsi is it possible to say your problem i cant understand your problem is plot or files or get files or datas in files?
|
|
|
|
|
Hi Guys,
Need a clarification...
I have an MFC Server/Client multithreaded Application, now i'm looking to rewrite in C#.Net. It uses Oracle 9i as database. Before i jump to my development work, i need to clarify if it is a right move to write in .net when it comes to performance (server), ease of development, etc.
Could any one please suggest an idea?
Thanks
Rove
|
|
|
|
|
MFC is not managed, C# is...
choose your performance side.
|
|
|
|
|
If someone agrees to pay enough money and is enough patient, then no problem, go ahead!
Else, my sincere advice is to let it as it is.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
raserove wrote: have an MFC Server/Client multithreaded Application, now i'm looking to rewrite in C#.Net. It uses Oracle 9i as database. Before i jump to my development work, i need to clarify if it is a right move to write in .net when it comes to performance (server), ease of development, etc.
.Net is new technology, better you switch over to it or become extinct
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ThatsAlok wrote: .Net is new technology, better you switch over to it or become extinct
.Net may be new, but native applications will never be extinct. There are many types of applications that managed code does not perform well enough to replace non-managed code.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: .Net may be new, but native applications will never be extinct. There are many types of applications that managed code does not perform well enough to replace non-managed code.
i don't want to go in discussion of same! better leave this topic here only!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ThatsAlok wrote: i don't want to go in discussion of same! better leave this topic here only!
You were the one that brought it up
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote:
You were the one that brought it up
thats why he he he
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello,
I am trying to implement drag within my shell namespace extension. I noticed that in MFC you are able to set up a message area to attach to the events such as OnBeginDrag.
My question is; How do I attach to those events using c#?
Thank you,
Rick
Rick
|
|
|
|
|
|
I am working on a drawing application using MFC and GDI+.
Now I am checking the following method
virtual BOOL OnDraw(CDC* pDC, CSize& rSize);
in my class derived from COleServerItem.
(This method is called to draw OLE item to metafile by framework.)
In this method, (actually pDC is pointer to CMetaFileDC object.)
following code
Metafile mf(pDC->m_hDC);
is failed, as lastResult = GenericError
also,
Graphics g(pDC->m_hDC);
is failed, as lastResult = OutOfMemory
Naturally, GDI grawing using pDC is OK.
How do I manipulate pDC with GDI+?
My environment is Visual Studio 2003 Version 7.1.3091.
If anyone has any suggestions about what I am doing wrong,
it would be greatly appreciated!
|
|
|
|
|
shinano wrote: Graphics g(pDC->m_hDC
Whats pDC? CDC or CMetaFileDC
|
|
|
|
|
Thanks,
pDC is a pointer to CMetaFileDC object.
I checked it by debugger.
|
|
|
|
|
Is your problem solve?if not how to create CMetaFileDC?
|
|
|
|
|
The method
virtual BOOL OnDraw(CDC* pDC, CSize& rSize);
is called by framework to draw a OLE item to a metafile.
so, CMetaFileDC object is created by framework.
According to MFC library reference "COleServerItem::OnDraw".
-- modified at 20:15 Sunday 17th September, 2006
GDI+ can record metafiles in the EMF and EMF+ formats, but not in the WMF format.
according to "Metafiles in GDI+"
http://msdn2.microsoft.com/en-us/library/zbk7dbtb.aspx
But OnDraw's pDC is Windows Metafile (WMF) .
So, we cannot use GDI+ in COleServerItem::OnDraw.
|
|
|
|
|
I'm creating a custom control which has a child control. My custom control draws a border and positions the child control.
When the parent control scrolls, it moves the child control to give the appearance of scrolling.
The problem is, when part of the child control goes beyond the edge of the parent control, it overdraws the border.
How can I go about limiting where the child control can draw? Is there some clipping I need to do, adjusting the clipping dynamically as I move the child around?
I've tried a few things with clipping with no luck. Any ideas?
|
|
|
|
|
I am just beginning at this stuff, but after long hours... here is how I managed to clip child windows:
<br />
..... OnPaint(....)<br />
{<br />
::GetClientRect(m_hWnd,&test_rect);<br />
<br />
::GetClientRect(m_ReadRssWnd,&bk_rect);<br />
<br />
hRgn2= CreateRectRgn(test_rect.right/3,test_rect.top,test_rect.right-300,test_rect.bottom);<br />
hRgn = CreateRectRgn(bk_rect.left+200,bk_rect.top,bk_rect.right-100,bk_rect.bottom);<br />
<br />
hDC2 =::BeginPaint(m_hWnd,&ps2);<br />
hDC =::BeginPaint(m_ReadRssWnd,&ps);<br />
<br />
::SelectClipRgn(hDC2,hRgn2);<br />
::SelectClipRgn(hDC,hRgn); <br />
<br />
::SetTextColor(hDC,RGB(255,255,255)); <br />
::SetBkColor(hDC,RGB(255,0,0));<br />
<br />
::FillRect(hDC2,&test_rect,hBr2); <br />
::FillRect(hDC,&bk_rect,hBr);<br />
<br />
::EndPaint(m_ReadRssWnd,&ps);<br />
::EndPaint(m_hWnd,&ps2);<br />
<br />
return 0;<br />
}
Now, this is probably not the best solution (or even the right one), but you will get your clip regions...
Now, if you could help me with my problem... just take a look at the message above "EraseBacgnd - mfranco_neto".
Thanks in advance
Mfranco
|
|
|
|
|
Hey,
I've a MFC-Based DLL calling a special drawing function in another DLL (MFC extended). All works fine in debug-mode. But when I tried to test my DLL in release mode, the program crashes in the line with SetMapMode.
Function in calling DLL (OnPaint):
...<br />
CPaintDC dc(this);<br />
<br />
PaintSpecialGraphics(&dc);<br />
...
Function in DLL:
int WINAPI PaintSpecialGraphics(CDC *pDC)<br />
{<br />
...<br />
pDC->SetMapMode(MM_LOMETRIC); <<<< CRASH !!!<br />
...<br />
}
Thanx for your help.....
P.S: When I try to call the "PaintSpecialGrafics" from my Application (.exe) all works fine...
-- modified at 18:09 Thursday 31st August, 2006
|
|
|
|
|
First I'd make sure you're building the release build with debug info. Follow these steps in MSVC 6:
- Select "Project->Settings...".
- Select the "Release" configuration.
- Select "C/C++" tab.
- Select "General" in the "Category" combo.
- In the "Debug info" combo select "Program Database".
- Select the "Link" tab.
- Select "Debug" in the "Category" in combo.
- Tick "Debug info" and "Separate types" and choose "Microsoft format".
- Select OK.
- Rebuild all.
If you're using a newer version of visual studio you'll have to adjust these steps.
Now reproduce the error are see where the error occurs in the MFC source code; this might give you more chance of understanding what's going wrong.
Steve
|
|
|
|
|
I suspect it's due to the passing of the DC object between two DLLs, but I can't be sure where exactly the problem is. To narrow it down, check the following:
1) Check the validity of pointer pDC in PaintSpecialGraphics(CDC *pDC);
2) Add thhis code to the calling DLL and see if it works locally:
CDC* pDC = &dc;
pDC->SetMapMode(MM_LOMETRIC);
3) To further test, you could change the function signature from PaintSpecialGraphics(CDC *pDC) to PaintSpecialGraphics(CPaintDC &dc).
Etc.
Best,
Jun
|
|
|
|