I want to sort these positions in an order when there are more than one in a Zodiac Sign, and want to show the Planets and Cusp in different Color fonts. (Started learning VB.Net to write an Astrology Program) The planetary positions and Cusps positions are obtained by Functions which come in the "Swiss Ephemeris" and I have to just Call them. This problem I am having is in that program I am creating - Not for commercial purpose But for learning programming and it has been an ambition of mine - writing my own Astrology Program myself. HOW TO GET ACTIVEX TEXTBOX TO SHOW COLOR DIFFERENCES FREEYou may remember that I mentioned in one of my earlier posts that I was writing an Astrology Program using the" Swiss Ephemeris" ( free for Non-commercial purpose and need to get paid Licence for commercial purpose). I need some time to present my questions / problems in a better way so that all can understand it. " Getting the Data involves 2-3 Functions and some need a DLL file (which comes with the "Swiss Ephemeris") to work. You wrote " I would recommend that you provide some information about how the data is initially available. Are there numeric variables for these items? Are these in degrees and minutes, or some sort of combined form (degrees with decimals, for instance? Also, a question about sorting is very different than displaying text in colors, so I would recommend a new thread with an accurate title - that will attract more attention from people who know about sorting. Sorry I'm replying you after nearly 20 hours. Liliane Teng, Thanks for merging the 2 Questions, I was feeling a bit guilty about the mistake I made and couldn't delete one of them since that was answered by few. Cor Ligthert, Thanks for the clarifying my post. I'm sorry for very late reply as I had a Internet connection problem & electricity problem today. Dim Lines(2) As String Lines(0) = "EGF : 15" Lines(1) = "JUT : 02" Lines(2) = "ABC : 12" Array.Sort(Lines) RichTextBox1.Text = "" For I As Integer = 0 To 2 Dim P As Integer = RichTextBox1.SelectionStart Dim Q As Integer = Lines(I).Length RichTextBox1.AppendText(Lines(I) & vbCrLf) RichTextBox1.Select(P, Q) If I = 0 Then RichTextBox1.SelectionColor = Color.Red If I = 1 Then RichTextBox1.SelectionColor = Color.Blue If I = 2 Then RichTextBox1.SelectionColor = Color.Green RichTextBox1.SelectionStart = RichTextBox1.TextLength Nextĭear Acamar, Cor Ligthert & Liliane Teng, Thanks for the reply and all the help. Note that I have intitialised the array in an odd order so you can see the sort actually doing something, and I have hard-coded which lines should be which color. That also simplifies printing them as different colors, as you can print the lines to the rich text box in a loop. The easiest way to sort your lines is to put them into an array and sort the array. HOW TO GET ACTIVEX TEXTBOX TO SHOW COLOR DIFFERENCES CODEBut to do this you need code that selects the text you want to color before selectng the color, and then you have to make sure that the text insertion point is restored properly. Font, Brushes.Green, 0, 30) PictureBox1.Image = BMP Or you can print the text into a rich text box, nominating the font color for each line. Dim BMP As Bitmap = New Bitmap(PictureBox1.Width, PictureBox1.Height, .Format32bppRgb) Dim g As Graphics = Graphics.FromImage(BMP) g.Clear(Color.White) g.DrawString( "ABC : 12", Me. You can draw the text into a picture box using any color you want. You can't put different colored text in a text box. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If aRichTextBox.SelectedText = vbLf Then currentColor = Color.Red If aRichTextBox.SelectedText = "'" Then currentColor = Color.Blue If aRichTextBox.SelectedText = " " Then currentColor = Color.Green Private Sub ReColorText(ByVal aRichTextBox As )ĪRichTextBox.SelectionColor = currentColor Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clickĭim textLines() As String = RichTextBox1.Lines Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loadīutton1.Text = "Sort" & NewLine & "ascending."īutton2.Text = "Sort" & NewLine & "descending." See my RecolorText SUB for an example of recoloring the text. Do not hit ENTER on the last line otherwise you get an empty line when you click on the " Sort ascending " button. I entered the following into the RichTextBox.> 12 23'34" 12 23'30" 12 23'32" Which represent 12 degrees, 23 minutes and 34 seconds then 12 degrees, 23 minutes and 30 seconds then 12 degrees, 23 minutes and 32 seconds. Hi V.K.S.B.K_, With two buttons and one RichTextBox on a FORM try this code please.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |