Solved

CSliderCtrl

Posted on 1998-05-09
7
512 Views
Last Modified: 2013-11-20
I wnat to make ownerdraw on a CSliderCtrl. My bitmaps will be loaded from the ressources. I will have 2 bitmap for the track button and an other for the background. What I want it's just to know how to make ownerdraw on that control.
0
Comment
Question by:fmichaud061597
[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
  • 3
  • 3
7 Comments
 

Author Comment

by:fmichaud061597
ID: 1308908
Adjusted points to 100
0
 

Expert Comment

by:Raffaele
ID: 1308909
You have to handle the WM_DRAWITEM message. Depending if you write your own control derived from the original CSliderCtrl or you want to control the ownderdrwa in another CPP you have to write the handler for either OnDrawItem (WM_DRAWITEM) or OnChildNotify.
To make a test you can create both handlers, put two breakpoint in each, and see where your program break into.

If you choose to trap OnChildNotify you'll have to do something like this:
BOOL CMyView::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult)
{
if(message != WM_DRAWITEM)
            return CListView::OnChildNotify(message, wParam, lParam, pLResult);


You'll have to write your own OnDrawItem handler (WM_DRAWITEM).
PreSubclassWindow(
0
 

Expert Comment

by:Raffaele
ID: 1308910
Could you write a sample code that uses custom bitmaps in ressources?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:fmichaud061597
ID: 1308911
Sorry but during the week I'm in hurry.
Anyway:
The DRAWITEMSTRUCT describe the status of your control so that you know what and where to draw.
With LoadBitmap, you load the Bitmap from resources and than you can BitBlt it to the screen.
If you can fit your image(s) in an ImageList (drawing all the status images in a toolbar resource), you can use CImageList::Draw.

Good luck,
Raffaele
0
 

Expert Comment

by:Raffaele
ID: 1308912
I want a sample code to overdraw the slider.
0
 

Author Comment

by:fmichaud061597
ID: 1308913
Raffaele is completely steering you the wrong way. Slider (aka trackbar) controls don't support ownerdraw, and don't send WM_DRAWITEM messages!

Your only hope is to subclass the control and handle WM_PAINT messages yourself. It's likely that you'll need to completely draw the control from scratch in order to have flashing or artifact problems. The control itself double buffers its image and that means it's painting is completely atomic--you can't let the control paint some visual features and paint other features yourself... you have to overwrite them or clip them.

.B ekiM

0
 
LVL 11

Accepted Solution

by:
mikeblas earned 100 total points
ID: 1308914
Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
method notes when mouse over in eclipse 5 96
haveThree challenge 22 127
MaxSpan challenge 9 139
changeXy challenge 13 98
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

738 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