Re: Tip of the Day enigma

From: Pat Crowe (pcjREMOVE_at_mqp.com)
Date: 08/24/04


Date: Tue, 24 Aug 2004 09:58:50 +0100

OK I finally got it, and of course it was really stupid.

I had never before realized that a 'Picture Control' in the dialog
resource editor actually has a hidden size which only appears
when you start to drag the bottom right hand handle. So although
it only looked small it was of course exactly the size that it
needed to be to cause the drawing effect that I was getting.

Just in case this helps someone else...

Doh!

"Pat" <ebooks2goNOSPAM@yahoo.co.uk> wrote in message
news:cgdl2m$oq1$1@titan.btinternet.com...
> 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: I want to get rid of a beep
    ... If I press enter when the edit box has focus, ... MyEditBox::MyEditBox(CWnd *parent, UINT nID) ... You cannot possibly know the dimensions of an edit control so ... MyEditBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) ...
    (microsoft.public.vc.mfc)
  • Re: how to stop last edit date changing when record just viewed or copied
    ... (All this applies to subform just the same as main forms.) ... ruling out Dirty or BeforeUpdate??). ... of the user and then sets the visible property of Edit, Delete, Add, ... its contents to another control. ...
    (microsoft.public.access.formscoding)
  • RE: Unghosting control pages
    ... If you edit in FrontPage it is "unghosted" and disconnected from the file ... No central template-- changes to the template aren't applied globally ... object of the API to write new bytes you will unghost it and it won't be ... > Sharepoint control page. ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: programmatically initialize properties of dialog controls
    ... for font I couldn't manage without specifying font name. ... concatenating in edit box - it just occurred to me that all the same I ... >>First make sure that you have attached a variable to any control that you ... > or check boxes, you can create value variables which you initialize before ...
    (microsoft.public.vc.mfc)
  • Re: Dynamic ImageButton Handler
    ... "how do you associate the button with the edit ... do the same for your edit control. ... You could then find the controls when you retrieve your CommandArgument ... Dim btn As Button = TryCast ...
    (microsoft.public.dotnet.framework.aspnet)