Re: Tip of the Day enigma

From: Pat (ebooks2goNOSPAM_at_yahoo.co.uk)
Date: 08/23/04


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



Relevant Pages

  • Re: Changing a Controls Font Size during runtime
    ... I think you are now facing the limitations of HTML even dynamic HTML. ... That is where I need to control the font size as I ... wish to use an image map as a template for plotting numbers, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Resizing DialogBox along with controls inside it
    ... In these cases I typically just make the control large enough to accomodate the largest size font I would use. ... If you always want a different font, why not change it in the dialog editor and they you can see how it affects the controls right in the editor. ... // get pointer to the modified dialog template ... checkbox,RadioButton inside the DialogBox during Runtime in this case.... ...
    (microsoft.public.vc.mfc)
  • New Table Style wont accept font setting
    ... I added it to template, ... For some reason, in some of the documents I use it in (as I test scenarios ... I am unable to change the font size. ... (generally the ones I have already done much to control, stylistically), I am ...
    (microsoft.public.word.tables)
  • Re: Changing a Controls Font Size during runtime
    ... That is where I need to control the font size as I ... wish to use an image map as a template for plotting numbers, ... I get this error message: ...
    (microsoft.public.dotnet.languages.csharp)
  • Font on dialog control
    ... I'd like to show a text in quite large letters on a dialog control. ... Preferably a rectangle but it could also be a button. ... Now I try to set the font with CWnd::SetFont but it doesn't ...
    (microsoft.public.vc.mfc)