Click here to Skip to main content
15,896,915 members
Home / Discussions / C#
   

C#

 
GeneralRe: Working On Communication Protocols Pin
Eddy Vluggen12-Dec-11 6:04
professionalEddy Vluggen12-Dec-11 6:04 
Questionconflict of interest, COI...in systemwatcher and stream reader... Pin
beh760610-Dec-11 23:34
beh760610-Dec-11 23:34 
AnswerRe: conflict of interest, COI...in systemwatcher and stream reader... Pin
Eddy Vluggen11-Dec-11 12:26
professionalEddy Vluggen11-Dec-11 12:26 
AnswerRe: conflict of interest, COI...in systemwatcher and stream reader... Pin
Luc Pattyn11-Dec-11 13:10
sitebuilderLuc Pattyn11-Dec-11 13:10 
GeneralRe: conflict of interest, COI...in systemwatcher and stream reader... Pin
beh760611-Dec-11 15:48
beh760611-Dec-11 15:48 
Questionregular expressions groups Pin
benams10-Dec-11 22:20
benams10-Dec-11 22:20 
AnswerRe: regular expressions groups Pin
OriginalGriff11-Dec-11 0:50
mveOriginalGriff11-Dec-11 0:50 
AnswerRe: regular expressions groups Pin
PIEBALDconsult11-Dec-11 8:18
mvePIEBALDconsult11-Dec-11 8:18 
QuestionHow to set up Winforms app to avoid piracy? Pin
swampwiz10-Dec-11 5:34
swampwiz10-Dec-11 5:34 
GeneralRe: How to set up Winforms app to avoid piracy? PinPopular
harold aptroot10-Dec-11 6:00
harold aptroot10-Dec-11 6:00 
GeneralRe: How to set up Winforms app to avoid piracy? Pin
OriginalGriff10-Dec-11 21:46
mveOriginalGriff10-Dec-11 21:46 
AnswerRe: How to set up Winforms app to avoid piracy? Pin
Not Active10-Dec-11 6:07
mentorNot Active10-Dec-11 6:07 
AnswerRe: How to set up Winforms app to avoid piracy? Pin
PIEBALDconsult10-Dec-11 8:21
mvePIEBALDconsult10-Dec-11 8:21 
AnswerRe: How to set up Winforms app to avoid piracy? Pin
Eddy Vluggen10-Dec-11 13:16
professionalEddy Vluggen10-Dec-11 13:16 
GeneralRe: How to set up Winforms app to avoid piracy? Pin
Addy Tas11-Dec-11 1:49
Addy Tas11-Dec-11 1:49 
GeneralRe: How to set up Winforms app to avoid piracy? Pin
Eddy Vluggen11-Dec-11 12:27
professionalEddy Vluggen11-Dec-11 12:27 
QuestionCall to REST WCF service creating a file instead of string Pin
nitin_ion10-Dec-11 1:09
nitin_ion10-Dec-11 1:09 
AnswerRe: Call to REST WCF service creating a file instead of string Pin
Richard MacCutchan10-Dec-11 2:54
mveRichard MacCutchan10-Dec-11 2:54 
Question8 queens in c# Pin
Member 84662349-Dec-11 21:34
Member 84662349-Dec-11 21:34 
I am really new to c# and need help with my 8 queens project. (First semester)

So far I have the the main form, the program class, Board class, and the Queens class.

I have the chessboard built but the problem is I do not know where to put the code to make the queen move on the chessboard. I have seen many apps like this but not in the C# coding.

This is what I have so far:



**Board.cs:**
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Resources;

namespace _8_Queens
{
class Board:UserControl
{
    public Board()
    {

    }
    protected override void OnPaintBackground(PaintEventArgs chess)
    {
        Graphics color = chess.Graphics;
        int size = this.Height / 8;
        bool isBlack = true;
        for (int i = 0; i < 8; i++)
        {
            for (int j = 0; j < 8; j++)
            {
                Brush paint;
                if (isBlack)
                    paint = Brushes.Black;
                else
                    paint = Brushes.Gray;
                color.FillRectangle(paint, new Rectangle(j * size, i * size, size, size));
                isBlack = !isBlack;
            }
            isBlack = !isBlack;
        }
    }
  }
}



I have nothing in the queens class because I do not know where to start and would like help in:
1. making the queens display on the chessboard (need to know what class to put it in and how to display it when the button on the form is clicked)

2. Also, I was wondering if I even need a queens class and, instead, do everything on the chessboard class.

Thank you! It would be helpful since I'm not great with the8queens algorithm and get confused when trying to type the code in.
AnswerRe: 8 queens in c# PinPopular
Luc Pattyn10-Dec-11 0:15
sitebuilderLuc Pattyn10-Dec-11 0:15 
GeneralRe: 8 queens in c# Pin
Member 846623410-Dec-11 14:04
Member 846623410-Dec-11 14:04 
AnswerRe: 8 queens in c# Pin
Luc Pattyn10-Dec-11 14:29
sitebuilderLuc Pattyn10-Dec-11 14:29 
GeneralRe: 8 queens in c# Pin
Member 846623410-Dec-11 15:31
Member 846623410-Dec-11 15:31 
AnswerRe: 8 queens in c# Pin
Luc Pattyn10-Dec-11 22:10
sitebuilderLuc Pattyn10-Dec-11 22:10 
AnswerRe: 8 queens in c# Pin
PIEBALDconsult10-Dec-11 2:46
mvePIEBALDconsult10-Dec-11 2:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.