Support Forums

Full Version: [Source] [C#] Upside Down Text
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well, I just saw something with a flip text, and I decided to release something I had already worked on in C#. All you need is to create two textboxes, and for the first textbox, make sure you enable the textbox_textchanged event by clicking the lightning bolt symbol in the textbox properties and finding textchanged.

Source:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Upside_Down_Text
{
    public partial class Form1 : Form
    {
        char[] backwardLetters = {
                                   'ɐ', 'q', 'ɔ', 'p', 'ə', 'ɟ', 'ƃ', 'ɥ', 'ı', 'ɾ', 'ʞ', 'l',
                                   'ɯ', 'u', 'o', 'd', 'b', 'ɹ', 's', 'ʇ', 'n', 'ʌ', 'ʍ', 'x', 'ʎ', 'z',
                                   '∀', 'q', 'Ɔ', 'p', 'Ǝ', 'Ⅎ', 'פ', 'H', 'I', 'ſ', '丬', '˥', 'W', 'N',
                                   'O', 'Ԁ', 'Ό', 'ᴚ', 'S', '⊥', '∩', 'Λ', 'M', 'X', 'ʎ', 'Z',
                                   'Ɩ','ᄅ','Ɛ','ㄣ','ϛ','9','Ɫ','8','6','0',
                                   '¡','¿','„','\'',',','(',')','‾','v','"','_',

                                   ']','[','}','{','/','\\','>','<','˙','.'
                                 };
        char[] normalLetters = {
                                 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
                                 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
                                 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
                                 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
                                 '1','2','3','4','5','6','7','8','9','0',
                                 '!','?','"',',','\'',')','(','_','^','„','‾',

                                 '[',']','{','}','\\','/','<','>','.','˙'
                               };
        public Form1()
        {
            InitializeComponent();
        }

        private string reverse(string s)
        {
            string r = "";
            for (int i = s.Length - 1; i > 0; --i)
            {
                r += s[i];
            }
            return r;
        }

        private int getCharNumberInArray(char c, char[] array)
        {
            for (int i = 0; i < array.Length; ++i)
            {
                if (array[i] == c)
                    return i;
            }
            return -1;
        }

        public string subString(
               [DescriptionAttribute("The string to use.")]string s,
               [DescriptionAttribute("The position to start getting the substring.")]int pos,
               [DescriptionAttribute("The length the substring will extend from the position.")]int length
            )
            
        {
            bool start = false;
            for (int i = 0; i < s.Length; ++i)
            {
                
            }
            return s;
        }

        private void normal_TextChanged(object sender, EventArgs e)
        {
            string word = "";
            if (normal.Text != "")
                word += normal.Text.Substring(0, 1);
            char[] normalText = normal.Text.ToCharArray();
            for (int h = 0; h < normalText.Length; ++h)
            {
                int i = getCharNumberInArray(normalText[h], normalLetters);
                if (i >= 0)
                    word += backwardLetters[i];
                else
                    word += normalText[h];
            }
            backward.Text = reverse(word);
        }
    }
}

Download project:
http://www.rvgaming.net/csharp/upsidedowntext.php

Feedback Appreciated.

- Rev
I might have to try this out sometime.
Thanks for source code....