Friday, July 04, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Windows Forms » Product Tour » User Interaction » Cells

Previous Customizing Interaction with Cells Next

You can control the user interaction with individual cells (or a range of cells).

  Back to Top
 Understanding Edit Mode
Typically, when the end user double-clicks or starts typing in the cell, the editor control is made available and the user can type in the cell. This ability to edit in a cell is called edit mode. Several properties and methods can customize the use of edit mode.

When a cell enters edit mode, by default the cursor is positioned at the end of the existing text in the cell. You can change it to select the existing text in the cell by setting the EditModeReplace property. If you prefer, you can specify that a cell is always in edit mode when it becomes the active cell using the EditModePermanent property. You can also set the position of the pointer in the edit control when it receives the focus by using the SuperEditBase.EditModeCursorPosition property.


  Back to Top
 Using Drag and Drop
You can allow the end user to drag-and-drop data from one range of cells to another. You can specify whether the user can select a cell or range of cells and drag and drop them to a new location in the same spreadsheet or another spreadsheet on the control.

// Allow the drag-drop feature.
fpSpread1.AllowDragDrop = true;

' Allow the drag-drop feature.
fpSpread1.AllowDragDrop = true

Play Video play video

  Back to Top
 Using Drag and Fill
You can allow the user to drag-and-fill data from one cell or a range of cells to another cell or range of cells. With a cell or range of cells selected, you can fill other cells either in a row (or rows if more than one column is selected) or a column (or columns if more than one row is selected).

// Allow the drag-fill feature.
fpSpread1.AllowDragFill = true;

' Allow the drag-fill feature.
fpSpread1.AllowDragFill = true

Play Video play video

  Back to Top
 Displaying Text Tips
For cells that are too small to display all the text in the cell, you can allow the end user to see the contents in a text tip. You can set the policy and location for text tips for a cell or range of cells. Text tips can be displayed for data cells or header cells. When the pointer is over such a cell, the text tip displays.

fpSpread1.TextTipPolicy = FarPoint.Win.Spread.TextTipPolicy.Floating


  Back to Top
 Adding a Note to a Cell
You can add a note to a cell or range of cells. The note may contain text such as a comment, a question, or documentation describing the origin of the cell's value. When the pointer is over a cell indicator of a cell that has a note, the note text displays in a box next to the cell. Alternatively, you can set the cell notes to always be displayed, not just when the pointer moves over the indicator.

// Add a note
fpSpread1.Sheets[0].Cells[1, 1].Note = "This is a note";

// Add a note
FpSpread1.Sheets(0).Cells(1, 1).Note = "This is a note"



Play Video play video
You can also allow notes to remain displayed, as if they were sticky notes. In this case they appear in a rectangle next to the cell with an expandable line that attaches the note to the cell, allowing the note to be moved by the user. The sticky note in this screenshot is a shape that can be moved. You can allow the user to edit cell notes if the notes are always shown. To allow the user to edit it, set the AllowNoteEdit property for the sheet, which sets all sticky notes on that sheet to be editable by the user.

// Add a sticky note
fpSpread1.Sheets[0].AllowNoteEdit = true;
fpSpread1.Sheets[0].Cells[1, 1].Note = "test";
fpSpread1.Sheets[0].Cells[1, 1].NoteStyle = FarPoint.Win.Spread.NoteStyle.StickyNote;

' Add a sticky note
FpSpread1.Sheets(0).AllowNoteEdit = True
FpSpread1.Sheets(0).Cells(1, 1).Note = "test"
FpSpread1.Sheets(0).Cells(1, 1).NoteStyle = FarPoint.Win.Spread.NoteStyle.StickyNote


  Back to Top
 Adding a Tag to a Cell
You can add a tag to a cell or range of cells. If you prefer, you can associate data with any cell in the spreadsheet, or the cells in a column, a row, or the entire spreadsheet. The string data can be used to interact with a cell or to provide information to the application you create. The cell data, or cell tag, is similar to item data you can provide for the spreadsheet, columns, or rows.

// Set the cell tag
fpSpread1.Sheets[0].Cells[1, 1].Tag = "my cell info";

' Set the cell tag.
fpSpread1.Sheets(0).Cells(1, 1).Tag = "my cell info"


  Back to Top
 Locking a Cell
You can lock a cell or range of cells and make it unavailable for editing by the end user. You can make the appearance of locked cells different so that it is noticeable by the user. You can also specify a different color (for background or for text) in locked cells using the LockBackColor and LockForeColor properties of the SheetView or Appearance objects.

// Lock a range of cells
fpSpread1.ActiveSheet.Protect = true;
fpSpread1.ActiveSheet.LockBackColor = Color.LightCyan;
fpSpread1.ActiveSheet.LockForeColor = Color.Green;
fpSpread1.ActiveSheet.Cells[1,1,1,2].Locked = true;

' Lock a range of cells
fpSpread1.ActiveSheet.Protect = true
fpSpread1.ActiveSheet.LockBackColor = Color.LightCyan
fpSpread1.ActiveSheet.LockForeColor = Color.Green
fpSpread1.ActiveSheet.Cells(1,1,1,2).Locked = true


  Back to Top
 Setting up Conditional Formatting of Cells
You can set up conditional formats within cells that determine the formatting of the cell based on the outcome of a conditional operation, for example, the value is less than 0. You can use a named style to specify various formatting options such as borders and colors. The conditional format uses string values and can be a comparison such as less than, greater than, between, or equals.

  Back to Top
 Allowing the Display of Buttons in a Cell
You can allow or restrict the display of buttons in cells that are the specific graphical cell types that allow buttons. Use the ButtonDrawMode property to set the limits on where buttons can be displayed.

// Show buttons in the current row
FpSpread1.ButtonDrawMode = FarPoint.Win.Spread.ButtonDrawModes.CurrentRow;

' Show buttons in the current row
FpSpread1.ButtonDrawMode = FarPoint.Win.Spread.ButtonDrawModes.CurrentRow

Play Video play video

  Back to Top
 Customizing the Focus Indicator for a Cell
You can customize the focus indicator for the active cell by using the FocusRenderer property of the spread control. The DefaultFocusIndicatorRenderer is the base class for the others. The ImageFocusIndicatorRenderer allows you to use an image as the focus indicator. The SolidFocusIndicatorRenderer allows you to customize a solid border around the selected cell as a focus indicator.

Previous Customizing Interaction with Cells 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.