Re: Tip of the Day enigma
From: Pat (ebooks2goNOSPAM_at_yahoo.co.uk)
Date: 08/23/04
- Next message: Ian Semmel: "Re: Hanging in debug"
- Previous message: Casper: "How to know the size of my structures/ammount of heap in use?"
- In reply to: Joseph M. Newcomer: "Re: Tip of the Day enigma"
- Next in thread: Pat Crowe: "Re: Tip of the Day enigma"
- Reply: Pat Crowe: "Re: Tip of the Day enigma"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 23 Aug 2004 20:46:14 +0000 (UTC)
Thanks for taking the trouble to reply, Joe.
I don't think I was very precise in my description of the problem.
I was assuming that someone else had had the same problem and
was therefore familiar with the code in the MFC component.
The bit that says "// Paint the background white" is painting a rectangle
larger than the edit containing the tip text, and much larger than the
dialog item
IDC_BULB, but smaller than any other significant control in the dialog
template.
I have proved this by changing the colour from WHITE_BRUSH to GRAY_BRUSH.
The grey area painted is not related to any object in the template.
Of course I will end up writing the code so it does what I need but I was
just
amazed that it is possible to hide the way a dialog works to this extent.
I was coming to the conclusion that the term 'bounding rectangle' had
something
to do with my problem as it appears that this could in some way represent a
rectangle which was not directly defined in the visible code, but rather
pre-defined
in some mysterious way in the device context. But that's about as far as I
could reason.
There are a couple of examples of replacement Tip of the Day dialogs on the
usual web sites,
and both seem to define the painted areas explicitly, and also to specify
the large font explicitly,
so I'm clearly not alone in having to re-write this.
Pat
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:2bjki0l4cvn7ucm86c10h3cegsaa0hjbac@4ax.com...
> Nothing I saw in the code below has anything to do with setting the size
of the edit
> control. It examines the size, but in no way sets it.
>
> Dialog control sizes are usually set by using the dialog size in Dialog
Box Units (DBUs)
> and doing some arithmetic based on the default system font size. Mostly
this works, sort
> of, on good days, when the moon is full. If you don't like what it does,
or can't figure
> it out, you could set the size explicitly yourself in the OnInitDialog
handler.
> joe
>
> On Mon, 23 Aug 2004 17:10:47 +0100, "Pat Crowe" <pcjREMOVE@mqp.com> wrote:
>
> >I am in the process of adding German to an application, and
> >have just got to needing to enlarge the Tip of the Day component
> >added by the MFC wizard, in order to fit the German words in.
> >
> >For the life of me I can't work out how the size of the white background
> >rectangle is determined. Nothing in the dialog template seems to
> >affect its size. (I make everything bigger but the white area stays the
> >same size.) The size appears to come from:
> >
> >void CTipDlg::OnPaint()
> >{
> > CPaintDC dc(this); // device context for painting
> >
> > // Get paint area for the big static control
> > CWnd* pStatic = GetDlgItem(IDC_BULB);
> > CRect rect;
> > pStatic->GetWindowRect(&rect);
> > ScreenToClient(&rect);
> >
> > // Paint the background white.
> > CBrush brush;
> > brush.CreateStockObject(WHITE_BRUSH);
> > dc.FillRect(rect, &brush);
> >
> >.... but IDC_BULB is a small roughly icon sized 'Picture'
> >
> >There's obviously a concept I'm missing here!
> >----------
> >
> >The other puzzle is what sets the font size for the words:
> >
> >Did you know...
> >
> >which is much bigger than usual, but I can find no reference
> >to fonts in the code of the component.
> >
>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
- Next message: Ian Semmel: "Re: Hanging in debug"
- Previous message: Casper: "How to know the size of my structures/ammount of heap in use?"
- In reply to: Joseph M. Newcomer: "Re: Tip of the Day enigma"
- Next in thread: Pat Crowe: "Re: Tip of the Day enigma"
- Reply: Pat Crowe: "Re: Tip of the Day enigma"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|