|
That didn't work either. I'm still only getting Keydown messages, but no WM_COMMAND/EN_VSCROLL messages. I wasn't sure that would work either since the text box is sending the message to the parent window.
|
|
|
|
|
I've had success with catching the WM_VSCROLL message. There is also an article or two on this here on CodeProject, and one on MSDN[^] that I was reading not too long ago.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
WM_VSCROLL works great, I used the technique from this article Controlling scrolling with the API. I was able to get the two boxes to scroll from a scroll bar just fine. The problem is getting the notification messages from the textBox back to the main window.
It seems like .net doesn't expose the dialog notification messages to any of the form code.
|
|
|
|
|
andy brummer wrote:
The problem is getting the notification messages from the textBox back to the main window.
You should try watching for OCM_VSCROLL , this is the corresponding reflected message.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks for the help. I had to override WndProc on the Form.
|
|
|
|
|
Thanks, I figured it out. I had to override WndProc on the form. DefWndProc was catching the message at the wrong place. Thanks for pointing me in the right direction.
|
|
|
|
|
I have a list Box that will display a music playlist. What i want to do is when i double click an item on the list i want that song to play (not select it then press play). Think of media player 9, with the playlist on the side, double click a song and it plays. Also i want to color of the text that i double clicked to change. Does anyone know a way to do this or can point me out to an article?
Im using WMP9 sdk to play the song so the list box will be reference to the WMP Playlist object, I dont know if i can just add the wmp 9 playlist to my program without using a list box (if there is a way that would help).
modified 16-May-21 21:01pm.
|
|
|
|
|
So handle the DoubleClick event on the ListBox , inheritted by Control .
FYI, in Windows Media Player, that's a ListView , not a ListBox . There's a big difference and a ListView implicitly supports the kind of object selection and activation changes you want.
For example, simply set ListView.Activation to ItemActivation.TwoClick and you've got what you requested. You can either handle the DoubleClick event as before, or the ItemActivate event that is fired when the user activates an item based on the Activation property setting.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks ill try ListView instead. Does it support color change of a selected (double click) item?
modified 16-May-21 21:01pm.
|
|
|
|
|
It encapsulates the same List-View common control that's ubiquitous in Windows Explorer. So yes, of course it supports changing the color of the selected item, along with much, much more. Read the class documentation for the ListView control and give it a try.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok i got the double clicking an item thing down. I just need help on getting the selected items text to change color.
modified 16-May-21 21:01pm.
|
|
|
|
|
In your double-click event, cast sender as a ListViewItem , check for null and the change the appropriate properties.
- Nick Parker My Blog | My Articles
|
|
|
|
|
hello,
I would like to thank everybody for helping me in my new C# experience.. I get quite blocked everytime I've to face with a new problem, so my is now to refresh a ListView...... suppose I've got a lview with 2 colums filename and size, I've them get filled at application startime, I've added an openFileDialog to choose another dir, but when I choose dir I get new files after the first loaded and not only the files of new dir..... I tryied using listview.clear(); , but I can't see any element...... any suggestion?
thanks
Paolo
|
|
|
|
|
ListView.Items.Clear()
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
I have a custom control that displays thousands of items. Each item is NOT a System.Windows.Control; each item is instead a simple light weight class with properties (such as .Text, .ImageIndex, etc.) used by the custom control to draw each item (i.e. the custom control draws all the items).
Here's my problem: I would like each item to display RichText. While we could write a custom RTF parser, that is a huge undertaking we'd not like to start. We cannot use the RichTextBox provided with the FCL since it is a standard System.Windows.Control which is not at all lightweight (thousands of items == thousands of RichTextBoxes, translates to bad performance plus lots of limitations related to standard WinForm Controls).
So I guess I'm looking for a way to display Rich Text items, thousands of items, all on a single GDI+ surface, without utilizing thousands of RichTextBox controls. Any suggestions?
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
|
Thanks for that Heath, I'll give it a peek.
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
Ok it looks promising. I've got a couple of questions though, hopefully you've got my answers for me Heath.
Since I want to be outputting the rich text to a GDI surface rather than a printer, my thought is that I should use SendMessage and pass a WM_PAINT message. Is that what I should be doing? If so, I fail to see how I can pass the rich text to be drawn on that control. Or should I not be using WM_PAINT at all?
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
Forget about all the painting-related stuff in the article (the code at the bottom of the article). The important thing is giving the FORMATRANGE.hdc field a valid HDC and passing that struct to the RichTextBox *. It will paint the RTF in that range to the HDC . This device context handle could come from the container control that contains all your little drawing helpers, or they could create their own (though that'd be a little less efficient, but it depends on your circumstances.
* You could use a single RichTextBox to help you paint all your RTF. So long as it's not visible nor added to a container control's Controls property collection, it should be pretty efficient and certainly takes care of the task of parsing and painting the RTF to a device context.
Keep in mind, however, that the RichTextBox merely encapsulates the Rich Edit common control. If you wanted, you could encapsulate that with your own little bare-bones control, just enough to wrap and create the proper window class, or - even better - use Windowless Rich Edit Controls[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can i send files from Ftp Server to clients?...
also...i want afree source for a ftp server in C# Language
|
|
|
|
|
Did you look at the articles under the C# tab here at CP? There are several that discuss this (i.e.; search for FTP).
- Nick Parker My Blog | My Articles
|
|
|
|
|
The stock C# Windows toolbar is great. It does all I need to do. However, it there a way to make it vertical rather than horizontal?
thansk
|
|
|
|
|
Set the <cdoe>Dock property to DockStyle.Left or DockStyle.Right .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|