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

  • 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: How to calculate the text length in an edit box?
    ... How can I detect if the text in an edit box control exceeds the edit box's ... I doubt that the window rect is the proper rectangle to use. ... actual font your control is using. ...
    (microsoft.public.vc.mfc)
  • RE: Id guess I cant do this
    ... Templated User Control. ... Creating the Template Class ... When you have a dynamic template available, you can instantiate it in code. ... Add a data-binding event handler to the controls you create in the template. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Envelope font/size
    ... and a document is cut off from its template at the ... > Word, I click on the "letter" icon and Word opens, and everything is set ... > including my address in the middle at the tab - exactly as I want it. ... > to font style was mine, ...
    (microsoft.public.word.docmanagement)
  • RE: Resolving datasource expression
    ... | a custom ASP.NET template databound control and the control will display ... | DataItem is just a propety of the "Container", ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)