|
Hi all. i am using this code to change color of listview item.
But unfortunetly it goes and changes color of all item instead
of only changing the color selected listview item. Could an expert
look at this and show me how i can only change color of selected
listview item instead of coloring all items in listview.Thanks
void CColor1Dlg::OnButton1() <br />
<br />
{<br />
<br />
HWND hPalWnd = ::FindWindow("my window class", NULL);<br />
<br />
HWND spilterwindow = FindWindowEx(hPalWnd, 0, "WTL_SplitterWindow", 0);<br />
<br />
spilterwindow = FindWindowEx(spilterwindow, 0, "WTL_SplitterWindow", 0);<br />
<br />
HWND ATL = FindWindowEx(spilterwindow, 0, "WTL_SplitterWindow", 0);<br />
<br />
HWND ATLWIN = FindWindowEx(ATL, 0, "atl:0053c8d0", 0);<br />
<br />
HWND Dialog = FindWindowEx(ATLWIN, 0, "SysListView32", 0);<br />
<br />
HWND Rich = FindWindowEx(Dialog, 0, "SysHeader32", 0);<br />
<br />
<br />
<br />
CButton *pButton1 = (CButton*)GetDlgItem(IDC_BUTTON1);<br />
<br />
COLORREF GetBkColor(IDC_BUTTON1);<br />
<br />
<br />
COLORREF color = 33023;<br />
<br />
TRACE("Color of the selected font = %8x\n", color);<br />
<br />
<br />
<br />
::SendMessage(Dialog, LVM_SETTEXTCOLOR, 0, color);<br />
<br />
<br />
<br />
}
-- modified at 12:16 Friday 7th July, 2006
|
|
|
|
|
That code looks like an absolute nightmare...
I think that in order to do what you want you would need to have to do custom draw for your list view.
|
|
|
|
|
could u help me how to make a code that custom draw for my list view.
I am not very expert in visual c++ so i be happy if u show how this can be done. Furthermore, why u say the code i a nightmare!! it does not crash any thing!!! it just does more then what i wanted it to do!
|
|
|
|
|
When it comes to doing anything out of the ordinary with a list control then Mike Dunn's article[^] is a must read.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
|
How to check if ComboBox dropdown list is shown or not shown?
thanks.
|
|
|
|
|
GetDroppedState()
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
For a limited user on Windows XP, will regsvr32.exe be able to register a namespace extension? I tried and got error 0x80040201, but I'm not sure if this is an issue to do with the account being a limited user or not.
Any help would be greatly appreciated.
Thanks in advance!
Dave Kerr
codechamber@hotmail.com
http://www.codechamber.com
|
|
|
|
|
Dave Kerr wrote: I tried and got error 0x80040201, but I'm not sure if this is an issue to do with the account being a limited user or not.
It resolves to, "An event was unable to invoke any of the subscribers."
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello,
I have some problems with the PlotXY functions in the NTGraph activeX, Here is the article about this ActiveX:
http://www.codeproject.com/miscctrl/ntgraph_activex.asp[^]
I'll upload for you the picture of the problem here:
http://img433.imageshack.us/img433/4972/untitled2ee.jpg[^]
the function I wrote there the code is: BOOL CGraphsXYAxisDlg::OnInitDialog()(This is the function in the general Dialog)
I sure the problem is there because when I earase the line it works fine.
I tried a few combinations of the point(x,y) but it doesn't work and the errer occurs.
Do you know how can I fix it?
Thank you all for your great help!
SnaidiS(Semion)
|
|
|
|
|
Incidentally the correct place to post these questions would actually be at the relevant article[^] itself.
The error message says Element not found . Do you actually have 3 elements for your graph? (ie. did you add 2 extra elements as the 1st was created automatically)
|
|
|
|
|
OK thank you! I think I found the problem..
SnaidiS(Semion)
|
|
|
|
|
How can I draw a line with this ActiveX.
I tried to use the functions:
OLE_COLOR ElementLineColor
OLE_COLOR ElementPointColor
LineType ElementLinetype
but it doesn't draw..
Do you have any ideas how can I draw a line between all the points?
SnaidiS(Semion)
|
|
|
|
|
Provide some source code of what you are doing. I don't see what is so difficult.
|
|
|
|
|
|
I know what you want to do. I want to know what steps you have taken to attempt to achieve this and your existing code because it looks to me like the SetElementXXX functions have everything you need.
|
|
|
|
|
I haven't tried to add the line because I totaly dont know how. I just know how to add points to the board, if you want the code of adding the points: take:
<br />
void CGraphsXYAxisDlg::OnBnClickedButton2()<br />
{<br />
m_Graph.AddElement();<br />
m_Graph.SetElementWidth(10);<br />
m_Graph.PlotXY(X,m_Y,X);<br />
X++;
UpdateData(FALSE);<br />
<br />
}<br />
Thank you!
SnaidiS(Semion)
|
|
|
|
|
Semion_N wrote: I just know how to add points to the board
You didn't even get that right...
An element is not a data point, it's a data set. If you only have one data set, which you do, you are supposed to just m_Graph.PlotXY(x,y,0);
|
|
|
|
|
You mean that when I'm adding element so its not a point it can be a line too?
but how can I use the line and not the point-you wrote this m_Graph.PlotXY(x,y,0);
I used it but as a point draw.
How can I make lines?
SnaidiS(Semion)
|
|
|
|
|
From the article...
m_Graph.SetElementLineColor(RGB(255,0,0));
m_Graph.SetElementLinetype(0);
m_Graph.SetElementWidth(1);
|
|
|
|
|
Yes-I tri9ed this option but when I'm typing it here for instance:
<br />
void CGraphsXYAxisDlg::OnBnClickedButton2()<br />
{<br />
UpdateData(TRUE);<br />
m_Graph.AddElement();<br />
m_Graph.SetElementWidth(10);<br />
m_Graph.PlotXY(X,m_Y,X);<br />
X++;<br />
m_Graph.SetElementLineColor(RGB(0,0,0));<br />
m_Graph.SetElementLinetype(0);<br />
m_Graph.SetElementWidth(1);<br />
}<br />
The program do nothing it dont draw even only the points...
TY!
SnaidiS(Semion)
|
|
|
|
|
You don't seem to understand my previous message. An element is NOT a data point. An element contains a set of data points along with the parameters of how to draw the data set. Lets say I would like to plot the stock market performance of a few companies, the performance data of Yahoo would be one element and the performance data of Google would be another element. So I have 2 elements. I can set the color for Yahoo to be yellow and the color for Google to be blue.
<br />
void CGraphsXYAxisDlg::OnBnClickedButton2()<br />
{<br />
UpdateData(TRUE);<br />
m_Graph.AddElement();<br />
m_Graph.SetElementWidth(10);<br />
m_Graph.PlotXY(X,m_Y,X);<br />
m_Graph.PlotXY(X,m_Y,0);<br />
X++;<br />
}<br />
If it still doesn't work, set a breakpoint at the PlotElement() function in NTGraphCtl.cpp and see why it's not drawing the line.
|
|
|
|
|
Yes it works!!
First of all-thank you!
but I don't understand- an element contains number of points,so why don't you add elements here?
and then draw them?
I don't really understand why PlotXY draws a set of point if you give to this function only one point?
SnaidiS(Semion)
|
|
|
|
|
By default the graph starts with one element. It is reasonable to assume that you must at least have one data set if you want to plot a graph.
PlotXY doesn't draw anything. The element contains an array of points, PlotXY simply adds a point to the array. When there's a WM_PAINT message, the control iterates thru each element and draws all the points based on the per element settings.
|
|
|
|
|
OK I understoon TY but PlotXY adds into the array only one point on each button press in my case so why does it draws a line and not point?
SnaidiS(Semion)
|
|
|
|