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
Solved

CSliderCtrl

Posted on 1998-05-09
7
509 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 79
ODBC Connection Logging, ADO.NET 6 69
notReplace  challenge 53 141
mapAB Challlenge 35 156
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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 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 quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

856 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