Page 1 of 1

Crossword

Posted: Tue Jul 13, 2010 1:57 am
by jtlusco
I am trying to build a printable crossword app in vb.net
i want it to pretty much have a grid and to type the word and hit a button to place them along with the numbers and the clues will be placed at the bottome when you set the print so it will print the grid set right and the clues at the botom of the page i have been playing with this for about a month and so far all i have is a form with 625 text boxes and it loads slow. can anyone help me with sugestions exsamples and the like

I am useing visual studioes 2008 Visual Basic

sorry i forgot to add that lol

Re: Crossword

Posted: Tue Jul 13, 2010 4:10 pm
by Agust1337
Just so you know, Visual Studio is many languages not one, so you'll have to say Visual Basic or VB or we could get confused and think your meaning C# or C++ or something.

Re: Crossword

Posted: Tue Jul 13, 2010 4:12 pm
by jtlusco
You are corect thats my fault im useing Visual Basic

Re: Crossword

Posted: Tue Jul 13, 2010 10:45 pm
by mandai
That's a bad idea using so many controls in a single form.
Try using an image in a picturebox instead:
Code: Select all
    Dim gfx As Graphics

    Dim blocksize As Integer = 32

    Dim numX As Integer = 6
    Dim numY As Integer = 6

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim bmp As Bitmap = New Bitmap(numX * blocksize + 1, numY * blocksize + 1) '+1 pixel for outer border
        gfx = Graphics.FromImage(bmp)

        For x As Integer = 0 To bmp.Width - 1 Step blocksize
            For y As Integer = 0 To bmp.Height - 1 Step blocksize
                gfx.DrawRectangle(Pens.Black, New Rectangle(x, y, blocksize, blocksize))
                'this will make our grid.
            Next
        Next
        PictureBox1.Image = bmp
    End Sub

    Sub drawLetters(ByVal xCol As Single, ByVal yCol As Single, ByVal text As String, ByVal horizontal As Boolean)

        xCol *= blocksize
        yCol *= blocksize
        Dim centering As Single = blocksize / 4
        For i As Integer = 0 To text.Length - 1
            gfx.DrawString(text(i).ToString(), Me.Font, Brushes.Black, xCol + centering, yCol + centering)
            If horizontal Then
                xCol += blocksize
            Else 'vertical
                yCol += blocksize
            End If

        Next
        PictureBox1.Refresh()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        drawLetters(1, 2, "TEST", True)

        drawLetters(2, 1, "TEST", False)

    End Sub

Re: Crossword

Posted: Tue Jul 13, 2010 11:46 pm
by jtlusco
this is definitly a great palce for me to start i will work with this and try to exspand apon it to get exsactly what im looking for

i will upload a sample of the layout i am thginking about and see what you all think

Re: Crossword

Posted: Wed Jul 14, 2010 12:02 am
by jtlusco
ok here is a basic sample of what i am look to have the small text boxes are for the words to be gussed the larger ones are for the clues the other controls are self exsplanitory let me know what you think and if i can do what i am tryiong to do
with your cose in place

Re: Crossword

Posted: Wed Jul 14, 2010 10:26 am
by mandai
I'd rather use a ListView in Details mode for the words list/clues part.

Re: Crossword

Posted: Thu Jul 15, 2010 1:55 pm
by jtlusco
the list view wont work for what im trying because i dont want a set list of words and clues i want the person useing it to be able to type in what they want to use and cone up with it on there own