Solved

CSliderCtrl

Posted on 1998-05-09
7
502 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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 …
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 explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now