how to call drawitem() function in ower draw Clistbox

Another question about ower-draw listbox: I created an ower-draw
Listbox and override the drawitem(LPDRAWITEMSTRUCT lpDrawItemStruct)
function. Is there any way to refresh the listbox by calling
DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) after the user click on a
button? 

Thanks, 

Eileen

0
eileenlxh (13)
7/6/2006 3:24:31 PM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
1685 Views

Similar Articles

[PageSpeed] 45

> Another question about ower-draw listbox: I created an ower-draw
> Listbox and override the drawitem(LPDRAWITEMSTRUCT lpDrawItemStruct)
> function. Is there any way to refresh the listbox by calling
> DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) after the user click on a
> button?
>

Call Invalidate followed by UpdateWindow to force a redraw which will
in turn call your draw item. You can also invalidate only a portion of
listbox if you want (InvalidateRect instead of Invalidate).

--
Ajay

0
ajaykalra (6842)
7/6/2006 3:28:36 PM
Thank you!

Ajay Kalra wrote:
> > Another question about ower-draw listbox: I created an ower-draw
> > Listbox and override the drawitem(LPDRAWITEMSTRUCT lpDrawItemStruct)
> > function. Is there any way to refresh the listbox by calling
> > DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) after the user click on a
> > button?
> >
>
> Call Invalidate followed by UpdateWindow to force a redraw which will
> in turn call your draw item. You can also invalidate only a portion of
> listbox if you want (InvalidateRect instead of Invalidate).
> 
> --
> Ajay

0
eileenlxh (13)
7/6/2006 3:55:25 PM
eileen wrote:
> Thank you!
>
> Ajay Kalra wrote:
> > > Another question about ower-draw listbox: I created an ower-draw
> > > Listbox and override the drawitem(LPDRAWITEMSTRUCT lpDrawItemStruct)
> > > function. Is there any way to refresh the listbox by calling
> > > DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) after the user click on a
> > > button?
> > >
> >
> > Call Invalidate followed by UpdateWindow to force a redraw which will
> > in turn call your draw item. You can also invalidate only a portion of
> > listbox if you want (InvalidateRect instead of Invalidate).
> >
> > --
> > Ajay


i personally prefer in this case the function "RedrawItems()" so i
don't have to calculate myself what rectangle of the listctrl has to
invalidated. much easier to use.
regards,
martin

0
7/7/2006 6:10:01 AM
> i personally prefer in this case the function "RedrawItems()" so i
> don't have to calculate myself what rectangle of the listctrl has to
> invalidated. much easier to use.

Thats good to use if you dont want to draw the entire control. Its a
replacement for InvalidateRect. UpdateWindow still needs to be called
for immediate redrawing of items.

---
Ajay

0
ajaykalra (6842)
7/7/2006 2:58:58 PM
Is RedrawItems() a member function of CListbox?

Eileen

Ajay Kalra wrote:
> > i personally prefer in this case the function "RedrawItems()" so i
> > don't have to calculate myself what rectangle of the listctrl has to
> > invalidated. much easier to use.
>
> Thats good to use if you dont want to draw the entire control. Its a
> replacement for InvalidateRect. UpdateWindow still needs to be called
> for immediate redrawing of items.
> 
> ---
> Ajay

0
eileenlxh (13)
7/7/2006 4:36:02 PM
> Is RedrawItems() a member function of CListbox?

It doesnt look like it. I was thinking about CListCtrl::RedrawItems,
which does not apply to you.

---
Ajay

0
ajaykalra (6842)
7/7/2006 4:45:41 PM
sorry, my fault.
i mixed it up with CListCtrl, seems i didn't use CListBox for quite
some time.
regards,
martin

0
7/10/2006 6:24:25 AM
Reply:

Similar Artilces:

Is there any function which gets called when the dialog receives the focus??
Hi all, I want a function which gets called when ever the dialog receives the focus. Is there any function like that available or else how can I call a user defined function which gets called when the dialog receives the focus. Thanks in Advance Use OnActivate(...) handler for the dialog. -- Vipin Aravind "aarya" <kk.simhadri@gmail.com> wrote in message news:1138084577.419720.26300@g14g2000cwa.googlegroups.com... > Hi all, > I want a function which gets called when ever the dialog > receives the focus. > Is there any function like that availabl...

where is the drawing tool bar?
trying to group objects and the help menu told me to find the grouping button on the drawing tool bar, problem is, i don't know which one is the drawing tool bar and i can't find the group button Select multiple items. Look for the little puzzle piece picture in the lowest right corner of your items. Click that. They are now grouped. -- JoAnn Paules MVP Microsoft [Publisher] "ang" <ang@discussions.microsoft.com> wrote in message news:6484A7BA-16EB-45B8-9CDD-3D7CFEB49A2F@microsoft.com... > trying to group objects and the help menu told me to find the groupin...

Trim function #3
In cell A2, I use the trim function to trim cell A1 containing a date eg 1202/09, the result in A2 is 39856. However, this 39856 is text and not date value. I therefore cannot convert it back to date after the trimming. Can someone please help? Many thanks... -- exalan Just format the cell as date to display: 2/12/2009 -- Gary''s Student - gsnu200833 On Feb 14, 7:17=A0am, exalan <exa...@discussions.microsoft.com> wrote: > In cell A2, I use the trim function to trim cell > A1 containing a date eg 1202/09, the result in A2 > is 39856. However, this 39856 is text an...

Accessing the call stack in an Excel VBA macro?
There is a control which lists the call stack members when you are in the VBA programming environment. I need to access this from within a VBA macro at run time. Does anybody have a clue how to do this? According to Ken Getz in the VBA Developer's Handbook... "VBA doesn't provide any method for retrieving this information" -- You would have to write your own code to keep track of calls/releases. -- Jim Cone Portland, Oregon USA (compare stuff, find stuff, remove stuff: http://tinyurl.com/XLCompanion) "Mike Suman" <mcsuman@eptsystems...

Getting a custom function to work in a criteria
Hello all, I have written the following function and I want to use it in the criteria of a query. However, when placing "BaseFacility()" without quotes in the [FAC_ID] field's criteria nothing is returned. Please help. Thank you. Fred Function BaseFacility() As String Dim frmReport As Form Set frmReport = Forms("frmReports") Dim dblBinary As Double dblBinary = 0 If frmReport!cboFacility = "[All Facilities]" Then If frmReport!chkMUTC = -1 Then dblBinary = dblBinary + 1 If frmReport!chkJSTEC = -1 Then dblBinary = dblBinary + 2 If f...

Need Excel Function that will return # of char in preceding cell
I used it before and cant remeber the function command that will allow me to copy just the 1st 5 numbers in a cell to another cell. Thes cells are like C & D. Thanks for your help. Command just slipping my mind. Are you perhaps talking about: In D1, enter, =LEFT(C1,5) OR =--LEFT(C1,5) to retain numerical format. -- HTH, RD --------------------------------------------------------------------------- Please keep all correspondence within the NewsGroup, so all may benefit ! --------------------------------------------------------------------------- "klafert" <klafert@dis...

Change words color within one item in CListBox
Hello, I can't find a solution how to change the color of certain words in a CListBox within one item. I can change the text color of the whole item but not of certain words. Thank you You will have to do owner draw of listbox. When owner drawing, you can change the color of anything you want. There are several samples at codeguru/codeproject which will help you do this. ------ Ajay Kalra ajaykalra@yahoo.com ...

density dependent random draw without replacement
Wow, this works indeed as I described. And thank you for introducing arrays (-; The only thing is that I did not completely describe my problem as I had in mind. I should have included density dependent. If I again refer to the list below, I want to randomly draw 5 unique values but the chance of drawing 4 should be 3 times as high as drawing 1 etc. Something like a density dependent random draw of unique values. I hope you or anybody else can help me out, best, Niels > identifier > 1 > 2 > 2 > 3 > 4 > 4 > 4 > 5 > 5 > 6 > 7 > 7 > 8 > 9 > 9 >...

Null Return on Count Function
I have the following Query: SELECT IIf(Count(*) Is Null,0,Count(*)) AS [No longer in Facility] FROM Residents GROUP BY Residents.[Last Status Date] HAVING (((Residents.[Last Status Date]) Between [Forms]![Open_PIP Report]![DateStart] And [Forms]![Open_PIP Report]![DateEnd])); The query is still returning a null value. Many of the other queries in my project require this to be at least a zero value to calculate properly. I have tried using the NZ function also. Perhaps I am using it incorrectly....any ideas? Hi - I don't quite understand your question. First, Count(*) never retu...

How do I create Trigonometric function graphs?
I need to know if it is possible to create Trigonometric function graphs (charts) in Excel 2003. If so, how is it done? Any help greatly appreciated. G_Freeman76 ...

NORMINV statistical function
I need a statistical function which calculates an inverse of the normal cumulative distribution. Visual Basic for Excel supports NORMINV function which is exactly what I need. Do you know if there is a library for Visual Basic for Access which includes NORMINV function? Thanks a lot for your help. DoDev You could reference the Excel library and tap into its worksheet function. Something like: Application.WorksheetFunction.NormInv(0.5, 4, 1) -- Hope this helps, Daniel Pineault http://www.cardaconsultants.com/ For Access Tips and Examples: http://www.devhut.net...

inline class member function
There is a class named CGOEntity,it's declaration is in GOEntity.h as followed: class CGOEntity { public: CGOEntity(); virtual ~CGOEntity(); public: long GetID(); ... protected: long m_nID; ... }; The implementation of CGOEntity is in GOEntity.cpp as followed. CGOEntity::CGOEntity() { } CGOEntity::~CGOEntity() { } inline long CGOEntity::GetID() { return m_nID; } .... It's very odd that VC++6 IDE will output linking error message while compiling like that [error LNK2001: unresolved external symbol "public: long __thiscall CGOEntity::GetID(void)" (?GetID@CGOEntity...

using the sum function in excel 2003
When I sum the cells horozontally in a spreadsheet, the total becomes a hyperlink - turns blue, launches my e-mail and has the blue underline. I've tried reformatting the cells as accounting number - but it doesn't change it. Try Edit, Clear, All Bob Flanagan Macro Systems http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "ehfcpa" <ehfcpa@discussions.microsoft.com> wrote in message news:9800E913-0574-4B73-82A9-A00A7BA91DF2@microsoft.com... > When I sum the cells horozontally in a spreadsheet, the total becomes a > hy...

How do I plot the function 0.95*e^-0.0206*t on a graph in excell?
I can't figure out how to plot the function as a graph? Where do I go? Charts seem to only work with data. Hi, Here are some examples Stephen Bullen's ChtFrmla http://www.oaltd.co.uk/Excel/Default.htm Tushar Mehta's Plot manager http://tushar-mehta.com/excel/software/plot_manager/index.html Cheers Andy Sean wrote: > I can't figure out how to plot the function as a graph? Where do I go? Charts > seem to only work with data. -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info On Tue, 12 Sep 2006, in microsoft.public.excel.charting, Sean <Sean@discuss...

Flawed scatter plot function
I always use scatter plots to visualize my data and after I upgraded to Excel 2007, something weird started to happen. What I do to is to Insert --> Scatter --> "Scatter with only markers", then I get a blank chart. Now I select the chart and type in "Series(, x range, y rang, 1)" and hit enter, now it gives me a chart with both markers and lines, so I have to go back to Insert --> scatter --> "Scatter with only markers" again and get rid of the connecting line. I'd love to hear suggestions on how to fix this, this is really annoying. I don...

OLE does NOT function after OFFICE SP3
I have confirmed twice that when I install the Office SP3 update ACCESS 2003 will no longer allow me to insert any object into an ole object field. I have tired the suggestions on other sites but all fail. ONLY a complete uninstall then reinstall of Office 2003 will revive the ole insert. I can use Office update 2 and there is no problem. Ideas dear community? I cannot be the only one suffering. Badboy from Chiapas ...

Error in Copying "Exact" Function
I have an excel spreadsheet with two columns, legal forename and preferred forename. I ran a "exact" function so it would appear true if the two surnames were the same or false if not. There are 180 odd rows so I wanted to just copy and paste or drag the "exact" formula instead of having to manually entering it for each row. However whatever method I try the cells all display TRUE, if I then click into one which I know should be false and click enter then it changes the result to FALSE. I don't want to have to do this for every row It sounds like you'...

Sorting a CListBox
If I have an array of CString objects that have been entered randomly and I add them to a CListBox with the "Sort" box checked in the Wizard, how can I keep track of the index of my array when the array is displayed differently (sorted) in the list box. For instance I have an array [0] = 5 [1] = 2 [2] = 4, it will be display in a sorted CListBox as 2 4 5. If I select 4 the index will be [1] which in my array is a value of 2. What is the best way for me to select an item out of a sorted List box and be able to tell which item in my array it is selection because indexing will...

CListBox
I have a multiple select CListBox... my problem is when I select a button (or other element) on my dialog, the list box elements that were previously selected appear to be unselected, but the code logic recognizes them as still selected. If I click the column heading or if I shift/ctrl select another list item.. they appear selected again... I'd rather have the elements remain apparently selected! Any suggestions? Thanks, MS Have you tried LVS_SHOWSELALWAYS. If not look at it in the MSDN. "Martin Schmid" <martinschmid@sbcglobal.net.nospam> wrote in message news:%2...

If Function 12-04-09
I want a cell to show the highest value based on the criteria below, Could somebody provide me with a simple formula to show this, I presume I would have to use the If Function. For example If cell F11 = £200 & Cell N11 = £146 I would like cell O11 to return the highest value (£200) You could use the IF function, such as =IF(F11>N11,F11,N11), but the better bet would be the MAX function. =MAX(F11,N11) -- David Biddulph "Hammer" <Hammer@discussions.microsoft.com> wrote in message news:6CA18FA3-9317-4FBC-A3FE-2DA15176E26A@microsoft.co...

Drawing trackbar thumbs
Hi, Does anyone know how to draw the thumb of a trackbar control (pointed arrow thumb of a slider) easily? I had a look at DrawFrameControl but it looks like it only draw buttons, captions, menus and scrollbar. Thanks all The CSliderCtrl give you adequate functionality when it comes to tick marks (if that is what you are talking about). You have SetTickFreq(..) and SetTick(..) Or do you want to draw your own tick marks? Take a look at these examples http://www.codeproject.com/miscctrl/csliderctrlex.asp http://www.codeproject.com/miscctrl/CustomDrawCSliderCtrl.asp both are very good art...

Error calling the function HrESERestoreComplete
Hello All, I am writing an application to backup and restore M.S. Exchange server programatically. I am using the Exchange Backup and Restore API and am developing the application in VC++ 6.0 on a Windows Server 2003 Enterprise Edition. I am able to do the backup successfully but I am getting error in the function "HrESERestoreComplete" during the resore. I am trying to call the function HrESERestoreComplete as follows: //<step 8> //HrESERestoreComplete CString strTempLocationPath; CString strTempLocationPath1; strTempLocationPath = _T("C:\\viraj\\exchangedata_b...

Dialog member function protection
Hello When you subclass CDialog into CMyDialog and know that you won't subclass CMyDialog anymore. Where do you put subsequent utility or misc member functions? In private, protected or public? Is it a matter of style or there is a reason for taking a specific choice? (Knowing that your dialog is not intended to be overwritten). -- Elias They should only be public if you want to allow other parts of your application to access them. A good OOP design should leave as little public members as possible. In general, it's a good idea to leave most hidden members protected. There is ...

Making calls through CRM
Can I make calls to customers through CRM? The purpose of this is to automatically log or record the duration of the calls within the CRM system attached to the contact. I have been told that this capability is available in outlook, someone please let me know if and how I can do this within CRM. Thanks in Advance, -- Angie Cravens, CRM Rep You will need 2 things; 1. A TAPI compliant phone system, such as a 3com NBX unit or one of the many other newer phone systems. The TSP included will most likely give you the ability to start a phone call by clicking on a button in Outlook, b...

Need to create an assembly call for Workflow Activity Creation
We're creating an Activity via a Manual Workflow on the Order. When creating an Activity from that starting point, you only have access to fill a handful of fields (Assign To, Type, Subject, Description, Priority, and Due Date). We need the Activity that's created from this starting point to be able to fill some customized fields that we have on the Task. The only way we figured out that we might be able to accomplish this is by adding an assembly call to the Worfklow. I'm not familiar with coding an assembly callout for CRM in .NET. Does anyone know what resources I co...