Solved

CSliderCtrl

Posted on 1998-05-09
7
506 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand data scrubbing tool 13 32
Detect CR LF to each line 12 161
maven archtype selection in eclipse 1 57
JQuery serialize and unserialize 8 86
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

810 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