Friday, July 04, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Windows Forms » Product Tour » Cell Types » Editable

Previous Working with Graphical Cell Types Next

  Back to Top
 Setting a Button Cell
A button cell, by default displays a rectangular button with a default color; you can specify the text and the color for that button. You may set the button to be a twostate button and then the button toggles between those two states when clicked.

// Create a button cell with some options
FarPoint.Win.Spread.CellType.ButtonCellType bttncell = new FarPoint.Win.Spread.CellType.ButtonCellType();
bttncell.ButtonColor = Color.Cyan;
bttncell.DarkColor = Color.DarkCyan;
bttncell.LightColor = Color.AliceBlue;
bttncell.TwoState = false;
bttncell.Text = "Click and Hold";
bttncell.TextDown = "...now let go.";
bttncell.ShadowSize = 3;
fpSpread1.Sheets[0].Cells[0,2].CellType = bttncell;

' Create a button cell with some options
Dim bttncell As New FarPoint.Win.Spread.CellType.ButtonCellType()
bttncell.ButtonColor = Color.Cyan
bttncell.DarkColor = Color.DarkCyan
bttncell.LightColor = Color.AliceBlue
bttncell.TwoState = False
bttncell.Text = "Click and Hold"
bttncell.TextDown = "...now let go."
bttncell.ShadowSize = 3
FpSpread1.Sheets(0).Cells(0,2).CellType = bttncell


  Back to Top
 Setting a Check Box Cell
A check box cell displays, by default, a small check box that can have one of three states, checked, unchecked, or grayed. You can customize the check box by specifying the image for each of the states. You can also define different text for each state using the TextTrue, TextFalse, and TextIndeterminate properties.

// Create a check box cell with some options
FarPoint.Win.Spread.CellType.CheckBoxCellType ckbxcell = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
ckbxcell.ThreeState = true;
ckbxcell.TextTrue ="Checked";
ckbxcell.TextFalse ="Unchecked";
ckbxcell.TextIndeterminate ="Not Sure";
fpSpread1.ActiveSheet.Cells[0, 0].CellType = ckbxcell;

' Create a check box cell with some options
Dim ckbxcell As New FarPoint.Win.Spread.CellType.CheckBoxCellType()
ckbxcell.ThreeState = true
ckbxcell.TextTrue ="Checked"
ckbxcell.TextFalse ="Unchecked"
ckbxcell.TextIndeterminate ="Not Sure"
FpSpread1.ActiveSheet.Cells(0, 0).CellType = ckbxcell


  Back to Top
 Setting a Combo Box Cell
A combo box cell displays an editable drop-down list -- allowing user to type in values as well as choosing from a displayed list. You can have separate values for both the display and the value for the items and allow autosearching.

// Create a combo box cell with some options
FarPoint.Win.Spread.CellType.ComboBoxCellType cmbocell = new FarPoint.Win.Spread.CellType.ComboBoxCellType();
cmbocell.Items = (new String[] {"January", "February", "March",
"April", "May", "June"});
cmbocell.AutoSearch = FarPoint.Win.AutoSearch.SingleCharacter;
cmbocell.Editable = true;
cmbocell.MaxDrop = 4;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = cmbocell;

' Create a combo box cell with some options
Dim cbstr As string( )
cbstr = new String() {"Jan", "Feb", "Mar", "Apr", "May", "Jun"}
Dim cmbocell As New FarPoint.Win.Spread.CellType.ComboBoxCellType()
cmbocell.Items = cbstr
cmbocell.AutoSearch = FarPoint.Win.AutoSearch.SingleCharacter
cmbocell.Editable = True
cmbocell.MaxDrop = 4
FpSpread1.ActiveSheet.Cells(0, 0).CellType = cmbocell


  Back to Top
 Setting a Multiple-Column Combo Box Cell
You can create a combo box cell with multiple columns in the drop-down list. You can provide a drop-down list as well as an editable area allowing the user to type in values as well as choosing from a displayed list. You specify the list of items, the number that is displayed at any time, and whether the cell is editable by the user

' Create and bind a multiple-column combo box cell
Dim mcb As New FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType()
mcb.DataSourceList = myDataSet
mcb.DataColumn = 1
mcb.ButtonAlign = FarPoint.Win.ButtonAlign.Right
mcb.ListWidth = 500
mcb.ListOffset = 5
mcb.MaxDrop = 5
FpSpread1.ActiveSheet.Cells(0, 0).CellType = mcb


  Back to Top
 Setting a Hyperlink Cell
A hyperlink cell contains text that can function as a hyperlink. The destination of the hyperlink can be any universal resource locator (URL). You can specify how much of the text functions as a hyperlink and the rest displays as ordinary text. You can specify the appearance of the hyperlinked text.

// Create a hyperlink cell with some options
FarPoint.Win.Spread.CellType.HyperLinkCellType hlnkcell = new FarPoint.Win.Spread.CellType.HyperLinkCellType();
hlnkcell.Text = "Click to See Our Web Site";
hlnkcell.Link ="http://www.fpoint.com";
hlnkcell.LinkArea = new LinkArea(9,25);
hlnkcell.LinkColor = Color.DarkSlateBlue;
fpSpread1.ActiveSheet.Cells[1, 1].CellType = hlnkcell;

' Create a hyperlink cell with some options
Dim hlnkcell As New FarPoint.Win.Spread.CellType.HyperLinkCellType()
hlnkcell.Text = "Click to See Our Web Site"
hlnkcell.Link ="http://www.fpoint.com"
hlnkcell.LinkArea = new LinkArea(9,25)
hlnkcell.LinkColor = Color.DarkSlateBlue
FpSpread2.ActiveSheet.Cells(1, 1).CellType = hlnkcell


  Back to Top
 Setting a Image Cell
An image cell shows an image as data. If the data type for a bound column is a bit array then the default cell type for the bound column would be image. An image object can be assigned to the Value property of a cell.

// Create a image cell
FarPoint.Win.Spread.CellType.ImageCellType icelltype = new FarPoint.Win.Spread.CellType.ImageCellType();
fpSpread1.Sheets[0].Rows[0].CellType =icelltype;
System.Drawing.Image image = System.Drawing.Image.FromFile("C:\\picture.jpg");
fpSpread1.Sheets[0].Cells[0,0].Value = image;

' Create a image cell
Dim icelltype As New FarPoint.Win.Spread.CellType.ImageCellType()
FpSpread1.Sheets(0).Rows(0).CellType = icelltype
Dim image As System.Drawing.Image = System.Drawing.Image.FromFile("C:\picture.jpg")
FpSpread1.Sheets(0).Cells(0, 0).Value = image


  Back to Top
 Setting a List Box Cell
You can use a list box cell to display a list -- allowing the user to select from the displayed list. You can specify the list of items, whether to include icons to appear along with text, the number that is displayed at any time, and other aspects of the display.

' Create a list box cell 
Dim listcell As New FarPoint.Win.Spread.CellType.ListBoxCellType()
listcell.ImageList = ImageList1
listcell.ItemData = New String() {"One", "Two", "Three"}
listcell.Items = New String() {"One", "Two", "Three"}
listcell.ItemHeight = 40
FpSpread1.ActiveSheet.Cells(0, 0).CellType = listcell


  Back to Top
 Setting a Multiple Option Cell
A multiple option cell offers several option buttons, either horizontally or vertically, for the user to select. Only one button can be selected at a time. The default is for none of the buttons to be selected.

// Create a image cell
FarPoint.Win.Spread.CellType.ImageCellType icelltype = new FarPoint.Win.Spread.CellType.ImageCellType();
fpSpread1.Sheets[0].Rows[0].CellType =icelltype;
System.Drawing.Image image = System.Drawing.Image.FromFile("C:\\picture.jpg");
fpSpread1.Sheets[0].Cells[0,0].Value = image;

' Create a image cell
Dim icelltype As New FarPoint.Win.Spread.CellType.ImageCellType()
FpSpread1.Sheets(0).Rows(0).CellType = icelltype
Dim image As System.Drawing.Image = System.Drawing.Image.FromFile("C:\picture.jpg")
FpSpread1.Sheets(0).Cells(0, 0).Value = image


  Back to Top
 Setting a Progress Indicator Cell
A progress indicator cell displays a progress indicator control across the entire cell. You can specify the color of the fill, the text to display, the color of the text and other properties.

// Create a progress indicator cell
FarPoint.Win.Spread.CellType.ProgressCellType progcell = new FarPoint.Win.Spread.CellType.ProgressCellType();
progcell.FillColor = Color.Red;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = progcell;

' Create a progress indicator cell
Dim progcell As New FarPoint.Win.Spread.CellType.ProgressCellType()
progcell.FillColor = Color.Red
FpSpread1.ActiveSheet.Cells(0, 0).CellType = progcell


  Back to Top
 Setting a Rich Text Cell
You can create a rich text cell that has text with multiple colors and fonts in the cell. The rich text cell has a run-time menu for formatting the text in a cell and for loading an RTF file (rich text formatted file). The menu also has basic edit operations such as cut, copy, paste, delete, and select all. Highlight the text first if you wish to set the color, font, or style of the text in the cell.

// Create a rich text cell
FarPoint.Win.Spread.CellType.RichTextCellType rtf = new FarPoint.Win.Spread.CellType.RichTextCellType();
rtf.WordWrap = true;
rtf.Multiline = true;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = rtf;

' Create a rich text cell
Dim rtf As New FarPoint.Win.Spread.CellType.RichTextCellType()
rtf.WordWrap = True
rtf.Multiline = True
FpSpread1.ActiveSheet.Cells(0, 0).CellType = rtf


  Back to Top
 Setting a Slider Cell
A slider cell displays a slider control in the cell. There are many properties you can set, including: minimum value, maximum value, ticks, tick width, track, track width, knob and knob width.

// Create a slider cell with a few options
FarPoint.Win.Spread.CellType.SliderCellType sldrcell = new FarPoint.Win.Spread.CellType.SliderCellType();
sldrcell.KnobColor = Color.Green;
sldrcell.TrackColor = Color.Yellow;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = sldrcell;


' Create a slider cell with a few options
Dim sldrcell As New FarPoint.Win.Spread.CellType.SliderCellType()
sldrcell.KnobColor = Color.Green
sldrcell.TrackColor = Color.Yellow
FpSpread1.ActiveSheet.Cells(0, 0).CellType = sldrcell


Previous Working with Graphical Cell Types Next


    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
SD Times 'TOP 100' Industry Innovator - Read the press release (pdf)

Tour Home
Overview
Appearance
User Interaction
Cell Types
Formulas
Managing Data
Data Binding
Import/Export
Printing
Keyboard Interaction
Shapes
Models
Spread Designer
 
Map

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.