15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Changing MFC - I SHOULDN'T!!!

Brandon Knitter -- knitterb@sol.net
Tuesday, January 23, 1996

** VC++ 4.0/MFC 4.0/Win95/Novice **

Well the response I got was to not change the MFC.  Understood.

Now since I am not a VC++ programmer, but more on the VB or PowerBuilder =
level, could you give me some simple instructure on how to change the =
color of a, normally black, 2-d text box, to make the border dark grey.  =
You needn't supply code, since I will pass these instructions over to =
people who do know VC++.

I would also like to MIX 2D and 3D controls!  I have been told this is =
VERY difficult.  Could you let me know of how to do this?  I really need =
all 3D controls except anything I would be putting on a white background =
(excluding commandbuttons).  I would need to make controls like =
TextBoxes and ListBoxes (dropdown control would be 3-D as usual).

Please let me know if this is possible, and maybe if you could give me a =
20 word or less explanation of Owner-Draw.  I don't need anything too =
techinical, but an understanding.

Thanks for your help, I greatly appreciate it!

-bk



Mike Blaszczak -- mikeblas@interserv.com
Thursday, January 25, 1996

[Mini-digest: 3 responses]

On Tue, 23 Jan 1996, Brandon Knitter  wrote:
>** VC++ 4.0/MFC 4.0/Win95/Novice **

>Now since I am not a VC++ programmer, but more on the VB or PowerBuilder 
level, could you give me some simple instructure on how to change the color 
of a, normally black, 2-d text box, to make the border dark grey.  You 
needn't supply code, since I will pass these instructions over to people who 
do know VC++.
>

Powerbuilder certainly doesn't have the capability to do what you want.  VB 
doesn't either, I don't think.  These things are the the kind of details that 
those environments sweep away to make sure you can get more work done with 
less fuss.

>I would also like to MIX 2D and 3D controls!  I have been told this is VERY 
difficult.  Could you let me know of how to do this?  I really need all 3D 
controls except anything I would be putting on a white background (excluding 
commandbuttons).  I would need to make controls like TextBoxes and ListBoxes 
(dropdown control would be 3-D as usual).
>

Out of curisoity, why?

>Please let me know if this is possible, and maybe if you could give me a 20 
word or less explanation of Owner-Draw.  I don't need anything too 
techinical, but an understanding.
>

It isn't the kind of thing that can be described in twenty words or less.  
Here's as close as I could come:

"Look up WM_CTLCOLOR and learn how to use it.  Look up CWnd::SubClassWindow() 
and learn how to use it.  Learn what the /WINDOWS:4.0 option in the Linker 
means.  Read up on dialog templates and their format.  Read up on 
CreateDialogIndirect()."

That's barely complete but still way over twenty words.

Again: doing what you're doing is not trivial for the developer and quite 
undstandard for the user--you really need to carefully consider why you wanna 
do it.

.B ekiM
--
TCHAR szZZTop[] = _T("I got nailed and arraigned last night,"
" they tried to haul me off to jail.");

-----From: Brad Wilson 

Brandon Knitter wrote:
 
> ** VC++ 4.0/MFC 4.0/Win95/Novice **

Ah, isn't this breaking the rules?    J/K of course.

[Moderator's note: Yes, I'm afraid it is, and I've mentioned it
to Brandon.]
 
> I would also like to MIX 2D and 3D controls!  I have been told this is
> VERY difficult.  Could you let me know of how to do this?

You need to use the native CTL3D APIs to achieve this.  In particular,
look at the APIs Ctl3dSubclassCtlEx() and Ctl3dCtlColorEx().  You'll also
need to find some documentation on the complete CTL3D API, since I didn't
seem to find much in MSDEV's online help about it.

--
class CBradWilson : public CWorldWatchProgrammingTeam {
  public:
    void GetInetAddr  ( CString& s ) { s = "bradw@exptech.com";      }
    void GetE164Addr  ( CString& s ) { s = "+1 (810) 620-9803";      }
    void GetURL       ( CString& s ) { s = "http://www.exptech.com"; }
    void GetDisclaimer( CString& s ) { s = "All I say is fact :-p";  }
};

//  QOTW:  "Don't think of yourself as the least intelligent creature in this
//          room ... if you consider the entire planet, you're smarter than
//          literally hundreds of people."  - Dogbert to Dilbert

-----From: bobe@tiac.net (Bob Edison)

>** VC++ 4.0/MFC 4.0/Win95/Novice **
>
>Well the response I got was to not change the MFC.  Understood.
>
>Now since I am not a VC++ programmer, but more on the VB or PowerBuilder
>level, could you give me some simple instructure on how to change the
>color of a, normally black, 2-d text box, to make the border dark grey.
>You needn't supply code, since I will pass these instructions over to
>people who do know VC++.
>
Use that standard edit control in your dialog only make the control
borderless . Then subclass the CEdit control class and include a
OnDraw(...) memeber function that determines the edges of the control and
uses a grey pen to paint draw along the 4 edges. Petzold has some good GDI
examples, you
could also get a book called Visual C++ Power Tools that has excellent
examples of controls etc.





| Вернуться в корень Архива |