Block Selection
Block Selection
Block Selection
Block Selection
Block Selection
Block Selection Block Selection Block Selection Block Selection Block Selection Block Selection Block Selection Block Selection
Block Selection Block Selection
Block Selection
Go Back  Xtreme Visual Basic Talk > > > Block Selection


Reply
 
Thread Tools Display Modes
  #1  
Old 06-20-2006, 02:04 AM
George7a's Avatar
George7a George7a is offline
History: Jesus Is Risen
 
Join Date: Mar 2005
Location: Nazareth
Posts: 1,697
Question Block Selection


Hi,

I want to be able to select a block and change the font of this block using VB.NET. I have asked a similar question before 1 year when I used to use VB6 but now I am working with VB.NET (VS 2005). So while I am searching, one of the options were to sub-class a RichTextBox and let it be possible to select a block instead of a line (see attached jpg) but I wasn't advised to do so using VB6.

Other options were:

1) Picture box (it is easy (thanks to passel) to select but hard to change the font)
2) Grid Object (didn't look nice with VB6 - Not WYSIWYG)
3) Sub-Classing a RichTextBox (is it doable?)

What do you advice me to use & why?

Thanks in advance,

- George
Attached Images
File Type: jpg block.jpg (43.5 KB, 12 views)
__________________
Thabet.Net
Reply With Quote
  #2  
Old 06-21-2006, 09:56 AM
MikeJ's Avatar
MikeJBlock Selection MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

Why don't you use a DataGrid? In .NET, it is a part of the Windows.Forms namespace, so it's a native control. Also, data handling in .NET is heads over heels better than VB6. Check out the DataGrid and don't bother with the rich text box.
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #3  
Old 06-22-2006, 01:31 AM
George7a's Avatar
George7a George7a is offline
History: Jesus Is Risen
 
Join Date: Mar 2005
Location: Nazareth
Posts: 1,697
Default

Thank you MikeJ for your reply.

I tried to use a DataGrid. The idea here will be that every letter will be in a cell. It does not look good because there will be a pixel or two between more between every letter & letter which makes the letter look a little far from each other. I tried to put GridLineStyle = NONE and the color white, but still it does not look good. Can I subclass this and make it reay NONE as for zero?

Any other ideas?

- George
__________________
Thabet.Net
Reply With Quote
  #4  
Old 06-27-2006, 05:35 AM
George7a's Avatar
George7a George7a is offline
History: Jesus Is Risen
 
Join Date: Mar 2005
Location: Nazareth
Posts: 1,697
Default

I have thought also of

1) sub-classing the DataGrid, hopefully to remove the gridline totally
2) sub-classing the RTB and change the way that the select works (is it doable?)
3) Trying to draw a rectangle on the RichTextBox and then to calculate which letters are inside the rectangle. But if the font wasn't fixed width?! How can I do it?

P.S. I still do not know how to draw on a RichTextBox. I think this part is doable but I don't know how nice it will look. In VB6 it didn't look good.

Please share your thoughts.

- George
__________________
Thabet.Net
Reply With Quote
  #5  
Old 06-27-2006, 10:01 AM
MikeJ's Avatar
MikeJBlock Selection MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

I'm telling you. Don't use the RichTextBox. Bad bad bad. It's the totally wrong solution to this problem. Set the DataGrid's GridLineStyle to None.
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #6  
Old 06-28-2006, 12:05 AM
George7a's Avatar
George7a George7a is offline
History: Jesus Is Risen
 
Join Date: Mar 2005
Location: Nazareth
Posts: 1,697
Unhappy

I have already siad that I have tried that! It looks bad! Check the attachment:

Even when I put the GridLine = NONE there will be still a part that none of the cells can write on. I have tried to put another font and change the cell size but still... I even made an application that can let you choose the best font & cell size but NO ONE was good enough (check the attachment). Any Idea why (same problem I had with VB6)? I must put every letter in a cell so I can change every thing.
Attached Images
File Type: jpg BadGrid.jpg (31.1 KB, 5 views)
__________________
Thabet.Net
Reply With Quote
  #7  
Old 06-28-2006, 12:10 AM
MikeJ's Avatar
MikeJBlock Selection MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

Have you tried CrystalReports or some other reporting tool? To get functionality like you want, you will either have to code it yourself, subclass and force it to do what you want, or go to 3rd party tools.

(Also, just wondering, why does every letter have to be in it's own cell? This is not the way most reporting tools work, so it seems like you're trying to make a square wheel! )
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #8  
Old 06-28-2006, 12:16 AM
George7a's Avatar
George7a George7a is offline
History: Jesus Is Risen
 
Join Date: Mar 2005
Location: Nazareth
Posts: 1,697
Default

I didn't try Crystal Reports yet. I will soon. Thanks for sharing

So you advice me to subclass the Grid (if crystal reports didn't work)? And I should forget about subclassing the RTB or drawing on it.

Than ks again for your help,

- George
__________________
Thabet.Net
Reply With Quote
  #9  
Old 06-28-2006, 12:18 AM
MikeJ's Avatar
MikeJBlock Selection MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

The RichTextBox is not meant to behave in the way that you are looking. It is inadvisable to do this because you really would be making square wheels - it's meant to be used to display linear data, not tabular data. Definately scrap the RichTextBox idea, check into CrystalReports (I believe it comes with several versions of .NET) and if that doesn't work, try to subclass the grid.
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Block Selection
Block Selection
Block Selection Block Selection
Block Selection
Block Selection
Block Selection Block Selection Block Selection Block Selection Block Selection Block Selection Block Selection
Block Selection
Block Selection
 
Block Selection
Block Selection
 
-->