Click here to Skip to main content
11,569,923 members (56,741 online)
Click here to Skip to main content
Add your own
alternative version

Tapping into the OpenOffice Spellchecker

, 25 Jan 2008 CPOL 47K 255 22
A simple and inexpensive way to get your hands on a working spellchecker
oospellcheck.zip
OOSpellCheck.suo
OOSpellCheck
bin
Release
OOSpellCheck.csproj.user
Properties
Settings.settings
using System;
using System.Drawing;
using System.Windows.Forms;

namespace OOSpellCheck
{
	public class SpellCheckDlg : Form
	{
		private Label lbl1 = new Label();
		private TextBox textWord = new TextBox();
		private Label lbl2 = new Label();
		private ListBox list = new ListBox();
		private Button btnChange = new Button();
		private Button btnIgnore = new Button();
		private Button btnCancel = new Button();

		public ListBox ListBox
		{
			get { return list; }
		}

		public string Word
		{
			set { textWord.Text = value; }
			get { return (string)list.SelectedItem; }
		}

		public bool EnableButton
		{
			set { btnChange.Enabled = value; }
		}

		public SpellCheckDlg()
		{
			Size = new Size(300, 300);
			Text = "Spelling Checker";
			FormBorderStyle = FormBorderStyle.FixedDialog;
			MaximizeBox = false;
			MinimizeBox = false;
			ShowInTaskbar = false;

			lbl1.Text = "&Not in dictionary:";
			lbl1.AutoSize = true;
			lbl1.Location = new Point(10, 12);
			Controls.Add(lbl1);

			textWord.ReadOnly = true;
			textWord.TextAlign = HorizontalAlignment.Center;
			textWord.TabStop = false;
			textWord.Location = new Point(120, 10);
			textWord.Size = new Size(160, 12);
			Controls.Add(textWord);

			lbl2.Text = "&Alternatives:";
			lbl2.AutoSize = true;
			lbl2.Location = new Point(10, 52);
			Controls.Add(lbl2);

			list.Location = new Point(120, 50);
			list.Size = new Size(160, 100);
			list.ScrollAlwaysVisible = true;
			list.DoubleClick += new EventHandler(list_DblClick);
			Controls.Add(list);

			btnChange.Size = new Size(200, 30);
			btnChange.Location = new Point(50, 150);
			btnChange.Text = "A&ccept new word";
			btnChange.Enabled = false;
			Controls.Add(btnChange);
			AcceptButton = btnChange;
			btnChange.DialogResult = DialogResult.Yes;

			btnIgnore.Size = new Size(200, 30);
			btnIgnore.Location = new Point(50, 190);
			btnIgnore.Text = "S&kip this word";
			Controls.Add(btnIgnore);
			btnIgnore.DialogResult = DialogResult.No;
			CancelButton = btnIgnore;

			btnCancel.Size = new Size(200, 30);
			btnCancel.Location = new Point(50, 230);
			btnCancel.Text = "&Quit spell ckecker";
			Controls.Add(btnCancel);
			btnCancel.DialogResult = DialogResult.Cancel;
		}

		private void list_DblClick(object sender, EventArgs e)
		{
			DialogResult = DialogResult.Yes;
		}
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Gordon Tolley
Instructor/Trainer
Hong Kong Hong Kong
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150624.2 | Last Updated 25 Jan 2008
Article Copyright 2008 by Gordon Tolley
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid