Yuri Kirilenko | 1 Mar 2001 09:47

Re: misunderstanding CFont

Hi Brandon,

> I don't know where this "10 decipoints/point" is coming in.

See CFont::CreatePointFontIndirect() from MFC. MSDN say:
"This function is the same as CreateFontIndirect except
that the lfHeight member of the LOGFONT is interpreted
in tenths of a point rather than device units."

Yuri.

----- Original message ----- 
From: "Brandon Corfman" <bcorfman@...>
To: <wtl@...>
Sent: 28 February 2001, 14:50
Subject: [wtl] misunderstanding CFont

> CreatePointFontIndirect uses the following calculation to convert the 
> user-supplied point height:
> 
> pt.y = ::GetDeviceCaps(hDC1, LOGPIXELSY) * logFont.lfHeight;
> pt.y /= 720; // 72 points/inch, 10 decipoints/point
> 
> It seems, however, that the last statement should contain a 72, not 
> 720. (The calculation works correctly if I make it 72.) I don't know 
> where this "10 decipoints/point" is coming in. I'm assuming mapping 
> mode MM_TEXT. Is this calculation assuming another type? What am I 
> missing?
> 
> Thanks,
(Continue reading)

sweiler | 2 Mar 2001 00:20
Picon

CBitmapButton not displaying properly

Sorry if this is a stupid quesion, but I don't seem to be able to get 
the CBitmapButton class to dsiplay any bitmaps.

I have created a member variable for a button, CImageList and some 
CBitmaps. 

In my InitDialog() I attach the bitmapbutton member variable to the 
dialog item, create the image list, load and add the bitmaps and then 
set the image list of the bitmap button.

The button is resizing to the size of the images, but the bitmaps are 
not being painted (DoPaint() is not being called). 

I'm pretty sure I'm missing a simple step here.

Any help is appreciated.

Shawn

Jon Dee | 2 Mar 2001 00:28
Picon
Favicon

RE: CBitmapButton not displaying properly


did you remember to add a CHAIN_MSG_MAP(CBitmapButtonImpl<yourclass>) in the
class you derive from CBitmapButtonImpl?

-jon

-----Original Message-----
From: sweiler@... [mailto:sweiler <at> bigfoot.com]
Sent: Thursday, March 01, 2001 3:20 PM
To: wtl@...
Subject: [wtl] CBitmapButton not displaying properly

Sorry if this is a stupid quesion, but I don't seem to be able to get
the CBitmapButton class to dsiplay any bitmaps.

I have created a member variable for a button, CImageList and some
CBitmaps.

In my InitDialog() I attach the bitmapbutton member variable to the
dialog item, create the image list, load and add the bitmaps and then
set the image list of the bitmap button.

The button is resizing to the size of the images, but the bitmaps are
not being painted (DoPaint() is not being called).

I'm pretty sure I'm missing a simple step here.

Any help is appreciated.

(Continue reading)

sweiler | 2 Mar 2001 00:46
Picon

Re: CBitmapButton not displaying properly

I haven't derived my own class but instead am attempting to use the 
CBitmapButton derivation of CBitmapButtonImpl. Should I be deriving 
my own class?
> 
> 
> did you remember to add a CHAIN_MSG_MAP
(CBitmapButtonImpl<yourclass>) in the
> class you derive from CBitmapButtonImpl?
> 
> -jon
> 
> 
> 
> -----Original Message-----
> From: sweiler@... [mailto:sweiler <at> b...]
> Sent: Thursday, March 01, 2001 3:20 PM
> To: wtl@...
> Subject: [wtl] CBitmapButton not displaying properly
> 
> 
> Sorry if this is a stupid quesion, but I don't seem to be able to 
get
> the CBitmapButton class to dsiplay any bitmaps.
> 
> I have created a member variable for a button, CImageList and some
> CBitmaps.
> 
> In my InitDialog() I attach the bitmapbutton member variable to the
> dialog item, create the image list, load and add the bitmaps and 
then
(Continue reading)

Jose Morris (Aditi | 2 Mar 2001 01:32
Picon
Favicon

FW: CBitmapButton not displaying properly

When you are setting the images you have to detatch them from CImageList
otherwise the images are destroyed when the function goes out of scope.
Either declare CImageList in the dialog class itself or do a detatch. For
eg,

CImageList MyImgLst;
MyImgLst.CreateFromImage(IDB_BITMAP, 75, 0, CLR_DEFAULT,
IMAGE_BITMAP, LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_CREATEDIBSECTION);
m_btn.SetImageList(MyImgLsg.Detach());

Jose

-----Original Message-----
From: sweiler@... [mailto:sweiler <at> bigfoot.com]
Sent: Thursday, March 01, 2001 3:20 PM
To: wtl@...
Subject: [wtl] CBitmapButton not displaying properly

Sorry if this is a stupid quesion, but I don't seem to be able to get 
the CBitmapButton class to dsiplay any bitmaps.

I have created a member variable for a button, CImageList and some 
CBitmaps. 

In my InitDialog() I attach the bitmapbutton member variable to the 
dialog item, create the image list, load and add the bitmaps and then 
set the image list of the bitmap button.

The button is resizing to the size of the images, but the bitmaps are 
not being painted (DoPaint() is not being called). 
(Continue reading)

sweiler | 2 Mar 2001 02:01
Picon

Re: FW: CBitmapButton not displaying properly

I really am starting to feel stupid. The image list (CImageList) and 
bitmaps (CBitmap) are member variables of the form view. Therefore 
they should not go out of scope.

The source for a FormView WTL SDI app that matches what I am trying 
to do is included below (NOTE: I have excluded the wizard 
generated "BOOL PreTranslateMessage(MSG* pMsg)" code for clarity). 
Hopefully someone can see the mistake I am making. 

I do appreciate your time and effort.

Shawn

#include "ATLCtrls.h"
#include "ATLCtrlx.h"

class CBMPBTNView : public CAxDialogImpl<CBMPBTNView>
{
public:
enum { IDD = IDD_BMPBTN_FORM };

~CBMPBTNView()
{
m_bmpbtnNext.Detach();
}

// PreTranslateMessage(MSG* pMsg) code goes here

BEGIN_MSG_MAP(CBMPBTNView)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
(Continue reading)

Jose Morris (Aditi | 2 Mar 2001 02:06
Picon
Favicon

RE: FW: CBitmapButton not displaying properly

You should not do 
m_bmpbtnNext.Attach(GetDlgItem(IDC_BUTTON1));
instead do 
m_bmpbtnNext.SubclassWindow(GetDlgItem(IDC_BUTTON1));

-Jose

-----Original Message-----
From: sweiler@... [mailto:sweiler <at> bigfoot.com]
Sent: Thursday, March 01, 2001 5:01 PM
To: wtl@...
Subject: Re: FW: [wtl] CBitmapButton not displaying properly

I really am starting to feel stupid. The image list (CImageList) and 
bitmaps (CBitmap) are member variables of the form view. Therefore 
they should not go out of scope.

The source for a FormView WTL SDI app that matches what I am trying 
to do is included below (NOTE: I have excluded the wizard 
generated "BOOL PreTranslateMessage(MSG* pMsg)" code for clarity). 
Hopefully someone can see the mistake I am making. 

I do appreciate your time and effort.

Shawn

#include "ATLCtrls.h"
#include "ATLCtrlx.h"

class CBMPBTNView : public CAxDialogImpl<CBMPBTNView>
(Continue reading)

sweiler | 2 Mar 2001 02:15
Picon

Re: FW: CBitmapButton not displaying properly

Thank you, I knew it was a silly mistake. I stared at that code for 
almost an hour and never saw that line.

Thanks again.
Shawn

vlasov | 4 Mar 2001 16:00
Favicon

Creating CPropertySheet

Just wanted to center CPropertySheetImpl<COptionsDlg>, but how? There 
is no WM_INITDIALOG or WM_CREATE to catch.

I know it is possible to catch WM_INITDIALOG within each property 
page. I hope there is a more ellegant way.

Thanks,
Vladimir

Richard Crossley | 5 Mar 2001 02:03

RE: Creating CPropertySheet

The property sheet is not subclassed untill after WM_INITDIALOG has been
sent.
This appears to work but there must be a better way.

Richard

class COptionSheet : public CPropertySheetImpl<COptionSheet>{
private:
typedef CPropertySheetImpl<COptionSheet> base;
public:
BOOL SubclassWindow(HWND hWnd)
{
BOOL bRet = base::SubclassWindow(hWnd);
if(bRet){
PostMessage(WM_APP,0,0);
}
return bRet;
}
LRESULT OnWMApp(UINT,WPARAM,LPARAM)
{
CenterWindow(GetParent());
return 0;
}

BEGIN_MSG_MAP_EX(COptionSheet)
MESSAGE_HANDLER_EX(WM_APP,OnWMApp)
CHAIN_MSG_MAP(base)
END_MSG_MAP()
};

(Continue reading)


Gmane