|
|
|
You're right. It's already been posted there now. Thanks
|
|
|
|
|
Based on the "Visual C++ 2008 Feature Pack" sample VisualStudioDemo
I have a toolbar (CMFCToolbar) in a docking pane (CDockPane) that contains operations to be done on the content of the docking pane.
Currently, all the toolbar buttons are "aligned" from the left side; as it is expected when working with a toolbar.
Is there a way to move the right-most button in the toolbar to be at the right-most side or the rect (of the toobar) ?
for example ( in ascii art) to have something like this (toolbar is between [] )
==================================================
| [button1|button2|button3| button4] |
|------------------------------------------------|
| |
The toolbar rect spans the whole width of the docking pane (also resizes when the docking pane resizes)
Looking at the CMFCToolbar documentation and code (afxtoolbar.cpp/.h) does not seem to offer some API to do that.
So, Am I chasing a wild goose?
Thanks.
Max.
I'd rather be phishing!
|
|
|
|
|
Yes, of course...
void CYourToolBar::AdjustLocations()
{
__super::AdjustLocations();
if (GetSafeHwnd())
{
int iCount(GetCount());
if (iCount)
{
CRect crClient(0, 0, 0, 0);
GetClientRect(crClient);
CMFCToolBarButton* pcButton(GetButton(iCount - 1));
if (pcButton)
{
CRect crPos(pcButton->Rect());
if (crClient.right > crPos.right)
{
crPos.OffsetRect(crClient.right - crPos.right, 0);
pcButton->SetRect(crPos);
UpdateTooltips();
}
}
}
}
}
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
modified 12-Dec-14 7:37am.
|
|
|
|
|
Excellent !!!
plug the code right in and works nearly ok; I have some minoe redraw issue that should be easy to track down.
Thanks.
I'd rather be phishing!
|
|
|
|
|
Hi All,
I'm facing the following strange problem using MFC Grid Control (by Chris Maunder) in my VS2010 MFC application:
I've included the CGridCtrl control in a dialog in order to let the user to edit data. It works fine but sometime when I open the dialog the cells content is not displayed but it's covered by the cell background color.
Unfortunately I can't solve the problem because it only happens randomly. I tried to call Invalidate() to both the CGridCtrl control and the dialog but it doesn't solve.
Any help would be greatly appreciated.
Thanks in advance.
Gianni
|
|
|
|
|
Normally we would tell you to post this question in the forum at the bottom of the article: MFC Grid control 2.27[^], but I think it is ok for you to post it here as well.
Although Chris is around all the time, he is obviously very busy so there is no guarantee he is able to answer your question.
It is a very old project by now (it is article #8 here on CodeProject!), but I see that Chris did update it not too long ago. In your explanation of the problem, you need to include which version of Windows you are running it on an make sure to mention whether it is 32 or 64 bits.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
Hi,
I have a C++ program with MFC.
I utilize the OnPrint() mechanism to print a Cstring line by line with pDC->TextOut().
That is working the first time I print.
If I repeat the print job, the page is blank.
I don't understand why.
Here is a portion of OnPrint():
CString resToken;
I print the Cstring one line at a time.
pDC->(TextOut(pt.x, pt.y + j * m_nHautLigne, resToken);
Does it have a better way to do the printing?
Why the page is blank the second time?
Do I have to reset something?
Thanks,
|
|
|
|
|
From things you've said, I think you're talking about printing on paper instead of a screen.
There is indeed a process to follow when doing so, it involves telling the print sub-system that you've printed a page and wish to print another in the same print-job.
If indeed producing a hard-copy output is your aim, you may find the following of some use: Answer --> I want to print an image from a class library project without any gui.[^]
You can and should enumerate the available printers in your system and allow the user to choose from them. In this example, I've simply used the printer's name, as seen in Control Panel\Hardware and Sound\Devices and Printers in Win7.
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon
|
|
|
|
|
Gagnon Claude wrote:
pDC->(TextOut(pt.x, pt.y + j * m_nHautLigne, resToken); That does not really tell us anything useful. You need to show where in your code you check for end of page, and exactly what index values you start with on the second page.
|
|
|
|
|
Hi All,
I can see that exe files have file info including company name, version, ... How do I add the same information to a text file?
Thanks,
Henry
henryh
|
|
|
|
|
No way except writing that in the file itself. That informations are put in specific fields of the file with a well defined format that Windows understand and show you as field in its Property Dialog.
|
|
|
|
|
Thanks. I have a hex record file and now I have to open the file, go through the translation, just to see what version of the file!! Any suggestion is appreciated.
Thanks,
Henry
henryh
|
|
|
|
|
|
I check the link and it mainly deals with file attributes.
Thanks,
Henry
henryh
|
|
|
|
|
|
|
Hi,
Fairly certain that he is referring to the 'File Property' dialog box displayed by explorer.
Best Wishes,
-David Delaune
|
|
|
|
|
I agree, but streams do offer a potential solution, depending on what the 'real' requirements are.
BTW, haven't seen you about recently; trust you are OK.
|
|
|
|
|
Hi Guys,
Thanks for the information. The information I want to attach to a file are details as in the following:
File description:
Type:
File version:
Product name:
...
As I have a hex record file (text format), I want to know what File version so I can decide to use it or not, says for programming a device.
I can use FileVersionInfo to read these info, but I don't know to set them to a text file. I guess the text file does not have these properties.
Thanks,
Henry
henryh
|
|
|
|
|
If the file content is hex records (whatever that means) then it is not text. Why not just add the information as a header record at the beginning of the file?
|
|
|
|
|
To my knowledge, text files do not meta data, which is where you would store things like company name, author, version, etc. For text files, the file system keeps track of simple things like date, time, and attributes.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hi,
I print a CString with pDC->TextOut().
That is working.
But if I print again, the sheet is blank.
How to correct that?
Do I have to utilize GetBuffer(), etc?
Thanks,
Claude
|
|
|
|
|
Just a guess, could you be overwriting the first print? Do you have a new line character (or carraige return and line feed) at the end?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|