Solved

CButton question

Posted on 2002-05-18
8
268 Views
Last Modified: 2013-11-20
Is there any way to avoid the surrounding line which appears on a button when it gets the focus? (the button may be an ownwerdrawn button).

Code would help for solution.

Thank.
0
Comment
Question by:Iraklis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 4

Expert Comment

by:mblat
ID: 7020137
IF button is ownerdrawn button then you are in full control of it's appearance.  So don't draw focus rectangle.

Basically WM_DRAWITEM receives DRAWITEMSTRUCT as a parameter.  

It has itemState member var, that can be inspected to find out if item is in focus and draw focus rectangle.  If you won't do that no rectangle will be drawn.

goto to www.codeguru.com they have many, many examples of owner drawn buttons....

hope it helps...
0
 
LVL 3

Expert Comment

by:Crius
ID: 7021667
You can save your button images as resources, and then use CBitmapButton::LoadBitmaps(), which allows you to tell the application what you want the face to look like very easily.

CBitmapButton works like a button, but you can load the 4 different images into the button with LoadBitmaps().

BOOL LoadBitmaps( LPCTSTR lpszBitmapResource,  //The button looks
 LPCTSTR lpszBitmapResourceSel = NULL,  //When it is selected
 LPCTSTR lpszBitmapResourceFocus = NULL,  //When it has focus **You want this to be the same as lpszBitmapResourceSel I believe
 LPCTSTR lpszBitmapResourceDisabled = NULL  //When it is disabled
);

0
 

Expert Comment

by:amarzee
ID: 7023671

Regular messages like WS_SETFOCUS will reach directly to controls like CButton.CButton::SetFocus has implemetation for focus rectangle.If you can override this you may not get input focus rectangle.
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 3

Accepted Solution

by:
Crius earned 38 total points
ID: 7024247
The problem with that though is the button wouldn't actually get focus if you overrode WM_SETFOCUS. Without the button getting focus, the button will react differently than expected. For instance, you couldn't ever use the button with only the keyboard.
0
 

Author Comment

by:Iraklis
ID: 7045090
Ok. I'll split up the points.
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7045223
Iraklis

I reduced the points, please accept Crius comment as an answer.

armaze and mblat, there will be a separate question with points for your help.

** Mindphaser - Community Support Moderator **
0
 

Expert Comment

by:amarzee
ID: 8794764
hi Iraklis ,
I think you partially agreed with my answer.
0
 
LVL 3

Expert Comment

by:Crius
ID: 8798244
Mindphaser created a separate question with points for your help Amarzee.
0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question