|
Are you doing this so you can change that appearance of a listview in your own app or another one?? If your doing this in your own ass, you're going about it the hard way. search the articles for "ownerdraw listview" and you'll come up with a few good examples.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am doing this for external listview . I mean in another application that i do not have its source code!
|
|
|
|
|
OK. Well, the docs on the LVM_REDRAWITEMS[^] message are pretty straight forward. You already have the mechanism to send the message. All you need to do is supply the listviews first and last item numbers that need to be redrawn.
Now, you have a second, more serious problem, that you can't get around. If this was your own ListView and your were ownerdrawing it, your code would have to be written to specifically handle this message. I have yet to see an ownerdrawn ListView that does this. If the app your trying to control like this ownerdraws its ListView control, you're S.O.L, and none of this will ever matter.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
could u tell me what should i put for the parameters in my case :
SendMessage(
(HWND) hWndControl,
(UINT) LVM_SETTEXTCOLOR,
(WPARAM) wParam,
(LPARAM) lParam
<br />
);
I have no idea what should put and replace what ?
|
|
|
|
|
Don't tell me you copy-paste-and-prayed the code you posted??
LVM_REDRAWITEMS is (LVM_FIRST + 21)
The wParam value should be the index number of the first ListView item that needs to be redrawn. The lParam value should be the index of the last item.
So, you're code would be something like:
Private Const LVM_REDRAWITEMS = (LVM_FIRST + 21)
.
.
.
SendMessage hwnd, LVM_REDRAWITEMS, firstItemIndex, lastItemIndex
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
It does not work !!!
SendMessage hwnd, LVM_REDRAWITEMS, 0, 12
|
|
|
|
|
Then it's entirely possible that the ListView you're trying to control is ownerdrawn by the other application. In which case, there's nothing you can do to get the effect you want. This is because the ownerdraw code will always paint the items exactly how its written to, ignoring the attributes that your injecting into the items list.
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 16:16 Friday 7th July, 2006
|
|
|
|
|
That is not true that the listview is overdrwan by diffrent application. Since i got visual c++ version of same code and it is corectly changing the color!! I think there is problem in calling refresh and redraw !
-- modified at 16:17 Friday 7th July, 2006
|
|
|
|
|
method007 wrote: is working perfectly and is selecing the zero position item for me and highlighting it corectly.
Some people suggest i need to send a refresh using LVM_REDRAWITEMS to listview after setting a color for it. But i do not know how to use LVM_REDRAWITEMS. I be happy if an expert help me fix there problems.Thanks
Then I'm failing to see what your problem is or what your intended effect is...
You're original post said the code is working, but in the next sentence, says that people are suggesting sending other messages. What's broken??
Are you saying that you have C++ code that is working, but when you try to convert it to VB.NET it isn't??
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 16:21 Friday 7th July, 2006
|
|
|
|
|
i mean i have visual c++ version of code and it is working but i try to convert it to visual basic 6 and it is not working. they suggest the redraw methond and non works!! It was mentiioned that some other application is sending redraw so that is why it is not working the give code and i said no because the visual c++ is working corectly
Now all i want to make this work . It is visual basic 6 code!
|
|
|
|
|
We'll have to see the C++ code you're using and the VB6 code came up with from it. There's obviously something missing...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Here is the visual c++ version :
void CColor1Dlg::OnButton1() <br />
{<br />
HWND hPalWnd = ::FindWindow("my window class", NULL);<br />
HWND spilterwindow = FindWindowEx(hPalWnd, 0, "WTL_SplitterWindow", 0);<br />
spilterwindow = FindWindowEx(spilterwindow, 0, "WTL_SplitterWindow", 0);<br />
HWND ATL = FindWindowEx(spilterwindow, 0, "WTL_SplitterWindow", 0);<br />
HWND ATLWIN = FindWindowEx(ATL, 0, "atl:0053c8d0", 0);<br />
HWND Dialog = FindWindowEx(ATLWIN, 0, "SysListView32", 0);<br />
HWND Rich = FindWindowEx(Dialog, 0, "SysHeader32", 0);<br />
<br />
<br />
<br />
CButton *pButton1 = (CButton*)GetDlgItem(IDC_BUTTON1);<br />
COLORREF GetBkColor(IDC_BUTTON1);<br />
<br />
COLORREF color = 33023;<br />
TRACE("Color of the selected font = %8x\n", color);<br />
<br />
::SendMessage(Dialog, LVM_SETTEXTCOLOR, 0, color);<br />
<br />
}
|
|
|
|
|
And the VB6 code???
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi
i have two hashtables
example :
Hashtable 1 Hashtable 2
key Value key Value
Details Order Details Product
Can i get One Order from 1st hashtable and then One product from the second hashtable ?
Thanks
blue
|
|
|
|
|
If any one not understood my question
My Question is Incase if i have two hashTables and does not contain same key values , so there is no link between the two tables right.
Now i want to loop thru both the hashtables at a time
like one value from 1st hashtable and one value from the 2nd hashtable
then move next ....so on
Can i use for i as integer=0 to ht.count or something like that ??
blue
|
|
|
|
|
You have to call each htable's GetEnumerator() to get the enumerator and then walk through the collection. This article contains some code snippets: link.
Best,
Jun
|
|
|
|
|
The items in a hash table are not stored in a way that you can retrieve them in the order that you stored them. If there is no way of associating the items in the two lists from the data in the items themselves, you can't list them correctly.
Unless, of course, you don't care at all in what order the items comes from the lists.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all:
I need to get mouse position information which is easy enough to do with the form's mouseMove event. I've noticed, though when the mouse passes through a control, the flow of x,y coordinates stops.
How do I get a continous flow of information? I suppose I could add a mouseMove event to each control, but that seems like a kludgy way of doing things.
Thanks,
Norm
|
|
|
|
|
You could add a handler in your form for the controls when you add them. Something like this:
Public Sub AddControl(ByVal Control as UserControl)
AddHandler Control.MouseMove, AddressOf HandleMouseMove
Me.Controls.Add(Control)
End Sub
Private Sub HandleMouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
'handle your mouse move stuff
End Sub
Hope this helps. As well, don't forget that if you use AddHandler to add an event handler, always have a RemoveHandler when you close your form, otherwise your application will have a memory leak.
Public Sub RemoveAllControlHandlers()
For Each Control as Control In Me.Controls
RemoveHandler Control.MouseMove, AddresOf HandleMouseMove
Next
End Sub
|
|
|
|
|
Hello Friends.I making application in vb.net with Mysql.
i m prepare Crystal Report but i can't make connection with Mysql.
A little program can also help me.
-- modified at 9:23 Friday 7th July, 2006
|
|
|
|
|
Pushkar IT wrote: i can't make connection with Mysql.
What part of making a connection to MySQL are you having trouble with? If you need resource on connection strings go here[^].
Hope this is some help for you
|
|
|
|
|
Thanx Paul for Reply.
I have a problem when i want to make connection for Crystal Report.
I can't understand how can i get Datafield for MySql table.
Can you please tell me how can generate Crystal Report in Vb.Net for MySql Database?
If possible give Sample Example.
Thanx
Regards.
Pushkar
BEIT
|
|
|
|
|
Hi All,
I am new to Windows application.i have created a combobox column in the grid.if i bind it, all the combo boxes in the column gets the same value.But i need to bind combo values according the value in the first column of the grid.Can anybody tell me the solution.
Thanks in Advance,
Ramesh
|
|
|
|
|
hi everybody, i am using a visual basic 6 platform, i have 2 forms, form1 & form2, from the form1 i am callin the form2 using : form2.show, but i have a pb i need to take the informations entered by user on the txtbox in from2 & use it in the form1 but the pb is that the form1 keep runing & he is waitin till the user press ok on the form2 to take the info.
in other words i need to do somthin like the inputbox function in visual basic but i have more the one textbox.
can anyone help me plz to solve this pb... i realy need help on it.
10x for replyin
waelhawari
|
|
|
|
|
Why not create a module that contains global variables? In form2, you can place the information into a global variable. Then, when you close the form and/or get back to form1, it will be there.
|
|
|
|