[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1836
  • Last Modified:

Ruler Control

Dear Expert
I need a ruler control(horizontal and vertical)  for RichTextBox which can be included in ToolBox of VB.NET2005. It should not be in a combined state with rtb. It should have its exposed properties and methods available for use.
With Best Regards
rmajay

0
rmajay
Asked:
rmajay
  • 17
  • 10
  • +1
1 Solution
 
alb66Commented:
May be this can help you:

"Ruler Control by Bill Seddon" at
http://www.codeproject.com/KB/miscctrl/ruler.aspx
0
 
rmajayAuthor Commented:
Dear alb66 , Dear CodeCruiser
ruler.aspx looks promising as it is not in a combined state. I'll try it and get back to you. Other 2 solutions are in a combined state with richtextbox
regards
rmajay
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
rmajayAuthor Commented:
Dear alb66
You are wonderful
Your code by "Bill Sedan" is working. If i have anymore clarifications i will come back. I will accept and award points soonafter
Regards
rmajay
0
 
rmajayAuthor Commented:
Dear alb66

How can i insert tabstops on this ruler
How can i make tabstops' markings visible. This ruler does not support drawline

With Best Regards

rmajay
 
0
 
rmajayAuthor Commented:
Dear alb66
I am waiting
Regards
rm
0
 
alb66Commented:
In order to add tabstops and making them visible simply click on the ruler.
Rulers method AddTab is used to do it.
0
 
rmajayAuthor Commented:
Dear Alb66
Clicking on ruler shifts the text to the point of tab.
What we need is tabstop so that the cursor shifts to that point.
Regards
rmajay
0
 
alb66Commented:
>>>>> Clicking on ruler shifts the text to the point of tab

It's an application behavior.
The ruler (TextRuler class) itself simply maintains and shows a list of tabstop indicators.
They can be added with a click or using method AddTab. Their position can be changed using muse drag 'n drop or using methods SetTabPositionsInPixels() or SetTabPositionsInMillimeters().
When something happens TextRuler fire some events: TabAdded, TabChanged and TabRemoved.
TabStop positions can be retrieved using TabPositionsInPixels property.

Your application can manage position and events and do what it need.

The behavior you described is implemented in the AdvancedTextEditor control, that is not the ruler itself, but another user control using TextRuler.
 
0
 
alb66Commented:
>>>>> Clicking on ruler shifts the text to the point of tab

It do that only if some TAB characters are int the display text.
It only sets TAB position.

>>>>> What we need is tabstop so that the cursor shifts to that point.
You you press TAB key you'll get what you want
0
 
rmajayAuthor Commented:
Dear alb66
I'll check and get back
Do you mean that present ruler object does not have a function to set tabstop on ruler figure, to shift cursor to THAT point when TAB key is pressed.
If yes please indicate how.
Regards
rmajay
0
 
alb66Commented:
>>>> set tabstop on ruler figure
yes, simply click on it

>>>> to shift cursor to THAT point when TAB key is pressed
this features is not implemented in the ruler control, but in the RichEditControl. Ruler control symply set the TAB position.
In demo application, first set some TABs using the method above (click on the ruler...), and then click in the edit control and press the TAB key; cursor will move to TAB positions you have set.
0
 
rmajayAuthor Commented:
Dear alb66
>>>>>>this features is not implemented in the ruler control, but in the RichEditControl.
Please suggest some method to implement tabstop in the richedit control in vb.net.
regards
rmajay
0
 
rmajayAuthor Commented:
Dear alb66
I'm waiting
Regards
0
 
alb66Commented:
0
 
rmajayAuthor Commented:
Dear alb66
I'll check and get back
Regards
rm
0
 
rmajayAuthor Commented:
Dear alb55
Yes it worked for setting the tabs.
BUT now
How can i make tabstops' markings visible. This ruler does not support drawline
I await your response on this
Regards
rm
0
 
rmajayAuthor Commented:
Dear alb66
I'm        waiting
Regards
rmajay
0
 
alb66Commented:
>>>> How can i make tabstops' markings visible.
Tab stop are already visible. Look at the picture.
Draw code is TextRule.DrawTabs() (file TextRuler.cs line 193)



ruler.png
0
 
rmajayAuthor Commented:
Dear alb66

file TextRuler.cs  is not available in zip files Ruler_src and Ruler_demo , downloaded from Bill Seddon page at The code project.
please ascertain file name and / or location

Regards
rm
0
 
rmajayAuthor Commented:
Dear alb66
I'm waiting
Regards
rm
0
 
alb66Commented:
Hello rmajay,
I'm really sorry, but when I downloaded the code to give you more help I worked on the wrong code from
http://www.codeproject.com/KB/edit/TextRulerControl.aspx.
I have no more time to analyze also the project from Bill Sedan.
Anyway, TextRulerControl is not in a combined state with richtextbox; or better, AdvancedTextEditor is combined while TextRuler is simply the ruler you need.
If you want to use code from BillSedan you can copy the drowing code for tab position from TextRuler.
Hope this may help you
0
 
rmajayAuthor Commented:
Dear alb66

I am using code from Bill Seddon.
Where shall I get drawing code for tab position.
Could you please tell me more clearly.

Regards
rm
0
 
alb66Commented:
Draw code is in TextRule.DrawTabs() (file TextRuler.cs line 193) from http://www.codeproject.com/KB/edit/TextRulerControl.aspx.
0
 
rmajayAuthor Commented:
Dear alb66
I have tried to use your comment.
Your comment  http://www.codeproject.com/KB/edit/TextRulerControl.aspx
gives code where ruler is in combined state with RTB.
I am unable to drawtabs on Ruler control by Bill Seddon
I am sorry for undue delay in replying and will be more regular now on
Regards
rm
0
 
alb66Commented:
As I already wrote in one of my previours comment, AdvancedTextEditor is a combined control, while TextRuler is the ruler control you need. You can use it directly. It is not in combined state.
0
 
rmajayAuthor Commented:
Dear alb66
I am back from tour and will work on comments and report my observations soon
Regards
0
 
rmajayAuthor Commented:
Dear alb66

I was away on annual leave from 20thMay to 7thJune.
I will take some more time to test your comments
Sorry for the inconvenience
Regards
rmajay
0
 
mlmccCommented:
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 17
  • 10
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now