Pete --
Pete --
Pete --
Using a DataGrid is very thought provoking. Still beyond my beginner
status capabilities. The curiosity seed is however now planted and
when the right combination of skill accumulation and need occurs I
shall try to baby step my way into the Grid.
My data file picker/viewer is now working.
I went back to the RichTextBox usage. My attempts at "painting" text
just caused me headaches and errors. Mixing EventArgs from my ListView
object with PaintEventArgs to control the graphics is beyond my
understanding ... although I gave it many hours of effort.
What ended up being VERY helpful is >>
1) Using StreamReader. ( ** Thank You ** for the suggestion !! )
2) Setting >> rtb.WordWrap = false; (rtb = RichTextBox object)
3) Implementing FontDialog for selecting the text attributes.
4) Using a line reading counter to limit loading too large of files.
5) Read only is set. Background is gray and I am ok with that.
The top left of my FilePicker is a Directory TreeView and the top
right is a File ListView. This top half acts like a weak version of
FileExplorer. The bottom splitter panel is a RichTextBox that is now
behaving very well!!
When I click on a huge binary data file >> the RichTextBox shows a
fast response 40 lines of gibberish. No big deal and NOT having the
entire file load is NICE! That rtb.LoadFile() can be a pain.
Usually viewing 40 lines is plenty for me to validate that the correct
parameter file is indeed selected ... so it's a winner. I have some
future enhancement ideas too. A two thumb sliding bar controller to
select where to start and end file input is one such idea. I'd like
better list control too. Currently my File ListView does not sort by
variable columns. I'd like to be able to sort by time in addition to
the current ascending FileName ordering.
Amazing how difficult these simple tasks are for beginners. And how
IMPOSSIBLY difficult these tasks use to be. Wow!! I can only shake my
head at the effort needed to duplicate my WinForm 2.0 functionality
using older methods. Ouch!!
Single screen file selection and quick viewing without concern for
accidentally editing it is sweet. A very functional tool I shall use
aplenty.
For emphasis >> All the comments I received were helpful and kept me
digging when I felt like waving the white flag. Now I am all smiles.
Dare I look at my long list of other projects? Yikes !!!
A great day to all.
-- Tom
[...]
I'm still searching for such a Text Viewer. A search on "Thumb Size
.Net 2.0" led me to some graphics intensive TrackBarRenderer,
trackRectangle, thumbRectangle, etc. usage that goes way beyond the
WinForms book and C# Instructional Texts that I have. Certainly
steepening my learning curve!
My guess is someone has already duplicated that Petzold example in C#
2.0 and that I would learn more and faster from studying a guru's
coding than creating my own.
If anyone can point me towards such a useful, compact, and also
complex tool ... I would be without doubt grateful.
I'm not familiar with Petzold's examples, so I can't comment on that.
As far as what you're asking about, I'm not aware of a specific
text-box implementation that does what you're talking about. It
wouldn't be that hard to do, at least for the basic implementation
(duplicating the full functionality of the TextBoxBase classes would be
harder, but it sounds like you only need a minimal subset).
Interestingly, taking a suggestion from a different thread -- in which
someone suggested using a ListBox to implement a console-output-like
control -- you could use the DataGridView in a similar way, taking
advantage of its "VirtualMode" mechanism. Using that, the control
handles all of the display and you provide the code that virtualizes
the data rather than having it all in memory at once.
It could be overkill -- the DataGridView control has lots of stuff in
it that would be of no value for this purpose -- and you might have
trouble getting it to look just right, since the DataGridView does have
a specific look and I don't know if you could get rid of the elements
that would be distracting in this use.
But hey, when you're hacking stuff, you can't be picky.
Pete