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
1726 Views

Similar Articles

[PageSpeed] 57

> 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:

auto archiving functions
hi all just wanted to aks if there is any kinda of *_auto_*- fucntion that ca archive a worksheet separatly wihout needing to save the acctual file. like i have "book1" and i add an entry then print the sheet but i don want to save it cuz its a template-like but i want to have a record o it some where else with same date. like "book1 05-10-2005", "book1 06-10-2005" and so on to be saved i given path(folder). i know i can do this by "save-as" but then i must always give the fil name over and over and i must choose where to save everytime -- torpid ----...

Calling Charles Allen--Crystal Calculate Checks Report
Hi Charles: I tried e-mailing you, but the e-mail came back undeliverable. I saw in a previous posting that you have a payroll Calculate Checks Crystal report. Could I please have this? If you have it in version 9 of Crystal, that would be wonderful. I would appreciate it, Charles! You can e-mail me at childofthe1980s@hotmail.com. Again, I would really appreciate it! childofthe1980s You have to make sure you take out the nospam part. I'll see what I can find. -- Charles Allen, MVP "childofthe1980s" wrote: > Hi Charles: > > I tried e-mailing you, but the ...

New, Reply Forward functions not enabled
I tried everything recommended by other users. I can't even disable add-ins as administrator (message says can only b e disabled by administrator and I am the only user and I am logged on as administrator). I activated a trial version of Office 2007 Pro, and Oulook imported all my AOL messages but I can't send a message or reply forward etc.. Microsoft says they don't provide any phone support or live chat support. Without being able to send a message on Outlook its like reading a book. Help please!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! When those button are no...

Better Multi-Bin functionality
Better Multi-Bin functionality. It seems it is just an afterthought. But most reports (which I'm still looking for a PO receiving report alone) don't include anything more then just the Site ID. Not to mention better multi-bin sales allocations, and maybe bin ranking to allocate with. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft W...

using a time format in a count function
I have a spreadsheet that has the following: A B C Start Time Run Day Run Time 11/14/09 12:20 AM Sat 12:20 AM 11/15/09 3:30 PM Sun 3:30PM The cells are formatted as: A= Date & Time B=TEXT(A2,"ddd") C=A2(cell reference with a time format) My goal is to count how many times the event occurred on a particular day of the week and count how many times it occurred during a time frame. EG Monday between 5:00 AM & 8:00 AM I have the count for the day...

Excel Calculator always requires an = before a math function, can be turned off setting?
I often use excel as a fancy calculator. But often I forget to start the calculator with the = sign. So if I want to add 44 + 66, I forget to type in an = sign first, an it gives me an error message. Is there a setting to turn that off, so I can type in 44 + 66 and it gives me an answer. I always have Excel running and it's also my calculator. I never use use a calculator anymore! The answer to your question is no. The equal sign tells Excel that you're entering a formula that needs to be calculated. You can use a plus sign (+) instead of the equal sign (=) if you alwa...

LookUp Function #5
Trying to use the above to insert an amount which will depend on the value in another cell. i.e. in A1 is the price and in A2 I need the figure which is dependant on the amount in A1. If A1 is less than 125000 A2 will be 0; between 125001 and 250000 the figure in A2 will be 1% of A1; between 250001 and 500000 the figure in A2 will be 3% of A1 etc. Similar problem with another cell where I need to lookup an amount from a table i.e. if A1 is between 2 amounts the figure in A3 will be a sum which is set out in a table. Any help would be much appreciated. Set up a small table like this so...

vlookup / len function combined
I have many vlookups referencing cell A1/2/3.....with the text: "firstname". I now need to add to these cells: "last name". If I add this text, the vlookups search other data tables for "firstname lastname" and return errors. How can I amend the referenced cells (A1/2/3...) so that the vlookups only use "firstname" and disregard the added text ? Tks change the vlookup(A1,myTable,Column,range_lookup) to vlookup(left(A1,find(" ",A1)-1),myTable,...) assuming you have all cells as "firstname lastname" Simon "jamesg-f...

Absolute address for Indirect function
Hi, I want to make the reference in indirect function absolute because Im copying this function to lots of successive row. For ex. in F3 I have the formula --> =IF(ISERROR(VLOOKUP($D3,INDIRECT("'Raw Data'!$B$3:$K$"&T1),10,FALSE)),"",VLOOKUP($D3,INDIRECT("'Raw Data'!$B$3:$K$"&T1),10,FALSE)) Now I need to copy this formula to F4 , F5 and depending on the data range (which would change from one time to another) I will need to paste it down to F5000. My only problem is when I paste it down using autofill then the part --> INDIRECT(&qu...

Displaying international character set in CEdit and CListBox
How do I get strings with multiple languages (let's say a mix of english, russian, japanese characters) to display in a Unicode enabled application (MFC42U.dll). I read data from file that is utf8, convert them to WCHAR and want to display resulting strings. CEdit and CListbox controls have Arial MS Unicode font selected into them that contains all the characters. The WCHAR strings have correct information as I can check that in debugger, however when displayed in controls, english is fine but all else is displayed with "ANSI" equivalents (read: "gibberish") instead of ...

Using user-defined functions in cells
What is the correct way to define a function that can be plugged into any spreadsheet cell as a formula?? I defined a function as follows: Public Function DoMyStuff () importantData = Sheet1.Range("A1").Value importantData = importantData * 10 DoMyStuff = importantData ' Return a value End Function I then plugged my function into cell "B1" as follows: =DoMyStuf() Okay, now I noticed that when anybody edits the contents of cell "A1" that my "DoMyStuff" is not getting called ag...

how to draw trend lines through only certain data points
hello all-- i need to make a scatterplot with trendlines that only go through some of my data. then i need a second trend line for the second part of my data. any ideas on how can i do this? thanks. -abe Split the data into two series, and add a trendline to each. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "akh2103" <akh2103@gmail.com> wrote in message news:1181774454.769554.40390@e9g2000prf.googlegroups.com... > hello all-- > i need to make a scatterplot with trendl...

excel function to call solver (VBA Macro)
I want to know how to have a function call solver. Without any user prompts or "alt + key". I just want a cell to contain [ =Solver(A1,3,0,B2) ] and be able to copy and paste this so the next row is [ =Solver(A2,3,0,B2) ] I don't really care what the return value is for the function. I just want it to set A1 to 0 by changing B1. I have seen a bunch of people ask this question but have found no answers? Can you even do this with excel? Thanks, Rob Hi Rob, If I understand your question well, you want to change a cell from within a function. That is not possible. A functi...

Search function (text or numerical)
Hi all Just trying to figure out how to implement a search function, as follows... sheet1 contains all the data to be searched; example: one cell in this sheet contains "BMS-1865-1701-CZ05" How can I search for this data, based on partial search criteria ? for example my criteria would be : "1701-CZ" I really need to use excel on this one... Thnx! -- marciac ------------------------------------------------------------------------ marciac's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=36151 View this thread: http://www.excelforum.com/sho...

MS CRM SDK call
Hello All, We are having MS CRM 3.0 (Roll up 2), we get Upate lot many errors "Generic SQL error." while updating Incident entity in crm using CRM SDK. When checked the Trace files we see following errors, it says that query to p_GrantInheritedAccess is getting failed. [2009-05-12 10:07:17.882] Process:w3wp |Thread:4556 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | COLEDataAccess::ExecuteParameterizedQuery File: c:\bt\876\src\platform\include\omcommon\dataaccess.inl Line: 825 >Call to COleRecordSet::Open() failed. Query = p_GrantInheritedAccess ?, ?, ...

Multiple If functions
What is the best way to put multiple if function's is single cell. I am trying to say is if(c5>=1,1,0),if(c5<=18,1,0),if(c5>=19,2,0),if(c5<=48,2,0). So if a value of c5 is between 1 and 18 enter a one in the deisgnated cell, but if c5 is between 19 and 48 then enter 2 Mark Two ways: =IF(AND(C5>=1,C5<=18),1,IF(AND(C5>=19,C5<=48),2,0)) or =(C5>=1)*(C5<=18)*1+(C5>=19)*(C5<=48)*2 In the second example you don't bang into the limit of 7 nested IF-functions. -- Best Regards Leo Heuser Followup to newsgroup only please. "Mark" <a...

how do I create an icon for frequently used functions ?
for example: paste value etc. ...

Use a IPU driver function inside a stream driver
Hello, I'm working on Windows CE 5.0 and Freescale BSP iMX31. I have developed a new stream driver and now I want to add a new IOCTL code to execute an action. With this IOCTL code, inside the function XXX_IOControl, I want to call a function that resides in another dll (display driver IPU). What's the better way to do it ? How can I modify the sources file to use thi display driver ? Thanks, Paolo Hi, Did you consider implementing the wished specificities in DDIPU::DrvEscape and 'triggering' them using ExtEscape? I suppose that calling ExtEscape from a de...

want a drop-down CListBox
I want a CListBox control works in drop-down way rather than in vertical scroll bar. Is there a way to do that? In another way, I don't want a CComboBox control allows input but only allows selection of the items. How to do that? Thanks a lot. > I want a CListBox control works in drop-down way rather than in vertical > scroll bar. Is there a way to do that? What does this mean? What is a drop down listbox? --- Ajay Use a combo box and just make it a Drop List in the properties rather than Drop Down. That will do what you want. Tom "Y Xu" <y.xu@qub.ac.uk&g...

Vlookup And Lookup Functions #2
Myrna, Thanks very much -- that is exactly what I was looking for. I believe you left out a '(' immediately before the 'MATCH'. This 'strategy' will work for a column LOOKUP and for an arra VLOOKUP. Thanks again, Chuckles123 : -- Chuckles12 ----------------------------------------------------------------------- Chuckles123's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1494 View this thread: http://www.excelforum.com/showthread.php?threadid=27806 Not exactly. I see an EXTRA right parenthesis at the end of the MATCH function, before t...

Why function generated results are not plotting correctly? #2
Is there a follow up question, or haven't you noticed the response? - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Need Help on axis problem in a chart" <NeedHelponaxisprobleminachart@discussions.microsoft.com> wrote in message news:3260B89F-D959-4338-A9F1-F71BAACD12C3@microsoft.com... > ...

Math drawing question
Hi group, I have got a math/drawing question and as the question will show my math knowledge is of toddler level... I've got a line going from x1,y1 to x2,y2 then the user inputs an angle and a length for a second line starting from x2,y2 going to x3,y3 But how do I calculate the value for x3,y3? I think I need to do something with cosinus and sinus and my angle and length but I don't know what. Thanks in advance, Greetz, Peter Peter Proost wrote: > I've got a line going from x1,y1 to x2,y2 then the user inputs an > angle and a length for a secon...

Automatic recalculation of array functions
Hi, I have a range of an array entered (Ctrl+Shift+Enter) formula that is calculated using a function in VBA. The value of each cell depends on inputs from other worksheets. I find that if I change these inputs, the array entered cells will not automatically recalculate (I have the options set to automatic recalculation). In fact, even if I hit F9 or go to Tools > Options > Calculation > Calc Sheet nothing happens. The only way to recalculate the cells is to re-highlight the range and hit Ctrl+Shift+Enter again. I can rewrite the function slightly so that a regular enter wil...

A question about ShellExecute function
Hi all, How to use ShellExecute function to open a html file as following: - Open it in the same window if it is opening in browser (Internet Explorer). - Open it in new window if it has been not opened. Please help me. Thanks. ...

more IF function
I just received help for my IF function question with the followin solution =IF(A1<>0,(D1/A1),0)+IF(B1<>0,(D1/B1),0)+IF(C1<>0,(D1/C1),0) What does <>mean in the formula, is it greater than or equal to zero ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements The <> comparison operator means 'not equal to'. -- Cordially, Chip Pearson Microso...