Spread Windows Forms Developer’s Guide...Web Page 230 Customizing Clipboard Operation Options...

Post on 21-May-2020

16 views 0 download

Transcript of Spread Windows Forms Developer’s Guide...Web Page 230 Customizing Clipboard Operation Options...

  • Developer's Guide

    Thisguideprovidesintroductoryconceptualmaterialandhow-toexplanationsforroutinetasksfordevelopersusingSpreadWindowsForms.ItdescribeshowanapplicationdeveloperwouldusethepropertiesandmethodsinSpreadtocreatespreadsheetsonWindowsForms,bindtodatabases,andotherwisecreateagridondata-intensiveapplicationsforthe.NETplatform.

    GettingStartedUnderstandingtheProductUnderstandingtheSpreadsheetObjectsUnderstandingtheUnderlyingModelsCustomizingtheSheetAppearanceCustomizingRow,Column,andCellAppearanceCustomizingSheetInteractionCustomizingRoworColumnInteractionCustomizingInteractionwithCellTypesCustomizingInteractioninCellsManagingDataBindingManagingDataonaSheetManagingKeyboardInteractionManagingEventsfromUserActionsManagingFileOperationsManagingPrintingWorkingwiththeChartControlUsingTouchSupportwiththeComponent

    Formoreinformation,besuretolookattheadditionalhelpfulresources:

    Forsampleinformation,refertoGettingStarted.

    ForcompleteAPIreferenceinformation,refertotheAssemblyReference(on-linedocumentation).

    Foracompletelistofdocumentation,refertotheSpreadWindowsFormsDocumentation(on-linedocumentation).

    Spread Windows Forms Developer’s Guide 0

    Copyright © GrapeCity, Inc. All rights reserved.

  • 1 Table of Contents

    Developer'sGuide 0

    1. TableofContents 1-21

    GettingStarted 22

    HandlingInstallation 22

    InstallingtheProduct 22

    LicensingaTrialProjectafterInstallation 22

    End-UserLicenseAgreement 22-23

    CreatingaBuildLicense 23-24

    HandlingRedistribution 24-26

    ProductRequirements 26

    UsingWindowsRegionalSettingsorOptions 26-27

    UsingSatelliteAssembliesforLanguages 27

    WorkingwiththeComponent 27

    AddingaComponenttoaVisualStudio2015or2017Project 27-29

    AddingaComponenttoaVisualStudio2013Project 29-31

    UnderstandingPartsoftheComponent 31-32

    UsingSmartTagsDrop-Down 32-34

    UsingVerbsinthePropertyWindow 34-36

    WorkingwithCollectionEditors 36-37

    AddingSupportforHighDPISettings 37-39

    UnderstandingtheSpreadWizard 39-40

    StartingtheSpreadWizard 40

    UsingtheSpreadWizard 40-41

    GettingMorePractice 41

    FindingtheDocumentation 41-43

    GettingTechnicalSupport 43

    Tutorial:CreatingaCheckbookRegister 43-44

    AddingSpreadtotheCheckbookProject 44

    Spread Windows Forms Developer’s Guide 1

    Copyright © GrapeCity, Inc. All rights reserved.

  • SettingUpRowsandColumnoftheRegister 44-46

    SettingtheCellTypesoftheRegister 46-48

    AddingFormulastoCalculateBalances 48-49

    UnderstandingtheProduct 50

    ProductOverview 50-51

    FeatureOverview 51-52

    CameraShapes 52-53

    CellTypesforCellFunctionality 53

    ChartControlsonaSheet 53

    ChildControlsonaSheet 53

    ColumnFootersandGroupFooters 53

    ConditionalFormatting 53

    CutorCopyCellRangesandShapes 53-54

    DataBinding 54-55

    ExcelSupportwithImportandExportCapabilities 55

    ExternalVariable 55

    FilteringDataonaSheet 55

    FormulaTextBox(FormulaBar) 55

    FormulaProviderControl 55

    FunctionsandFormulas 55-56

    GradientsforButtonCells,Headers,andMore 56

    GroupingRowsintheDisplay 56

    GroupingRowsorColumnsinanOutline 56

    HeaderswithMultipleColumnsandRows 56

    HierarchicalDisplay 56-57

    HitTestforLocatingtheCursor 57

    IndicatorsandIconsintheInterface 57

    InkNotationSupport 57

    KeyboardActionMapping 57

    Spread Windows Forms Developer’s Guide 2

    Copyright © GrapeCity, Inc. All rights reserved.

  • MultipleSheets 57

    NameBoxControl 57-58

    NotesforCells 58

    PanesorViewports 58

    PrintingandPDF 58

    QuickStartWizard 58

    Right-to-LeftLayouts 58

    RowPreview 58-59

    SearchingandSearchDialog 59

    Shapes,Drawing,andAnnotations(FreehandDrawing) 59

    SkinsandStylesforCustomizedAppearance 59

    SortingRowsorColumns 59

    SpannableCells 59-60

    Sparklines 60

    SpreadDesigner 60

    StatusBar 60

    Tables 60

    TabStripandSheetNameTabs 60

    TextRenderingwithGDI 60-61

    TitleandSubTitle 61

    TouchSupport 61

    UndoandRedoActions 61

    Validation 61

    VisualStylesforXPThemes 61

    WorkingWithShapes(EnhancedShapeEngine) 61-68

    NamespaceOverview 68

    ConceptsOverview 69

    ShortcutObjects 69-71

    ObjectParentage 71

    Spread Windows Forms Developer’s Guide 3

    Copyright © GrapeCity, Inc. All rights reserved.

  • FormattedversusUnformattedData 71-72

    CellTypes 72-74

    UnderlyingModels 74

    UnderstandingtheSpreadsheetObjects 75

    WorkingwithSheets 75

    WorkingwiththeActiveSheet 75-76

    WorkingwithMultipleSheets 76-77

    AddingaSheet 77-78

    Workingwith1-BasedIndexing 78-79

    CopyingandInsertingaSheet 79-80

    MovingaSheet 80-81

    RemovingaSheet 81-82

    ShowingorHidingaSheet 82-83

    WorkingwithRowsandColumns 83

    CustomizingtheNumberofRowsorColumns 83-85

    AddingaRoworColumn 85-86

    RemovingaRoworColumn 86-87

    ShowingorHidingaRoworColumn 87-88

    WorkingwithHeaders 88

    UnderstandingHeaders 88-89

    CreatingaHeaderwithMultipleRowsorColumns 89-92

    ShowingorHidingHeaders 92-94

    WorkingwithCells 94

    WorkingwiththeActiveCell 94-95

    CreatingaRangeofCells 95-96

    UnderstandingtheUnderlyingModels 97

    UnderstandingtheTypesofSheetModels 97

    UnderstandingtheSheetModelClassesandInterfaces 97-99

    FindingMoreDetailsontheSheetModels 99-100

    Spread Windows Forms Developer’s Guide 4

    Copyright © GrapeCity, Inc. All rights reserved.

  • UnderstandingtheDataModel 100-101

    UnderstandingtheAxisModel 101-102

    UnderstandingtheSelectionModel 102-103

    UnderstandingtheSpanModel 103

    UnderstandingtheStyleModel 103-106

    CreatingaCustomSheetModel 106-107

    UnderstandingtheOptionalInterfaces 107-108

    CustomizingtheSheetAppearance 109

    CustomizingtheAppearanceoftheOverallComponent 109

    SettingtheComponenttotheOriginalAppearance 109-110

    ApplyingaSkintotheComponent 110-112

    CreatingaCustomSkinforaComponent 112-115

    CustomizingtheRenderers 115-119

    CustomizingtheDimensionsoftheComponent 119-120

    CustomizingtheOutlineoftheComponent 120-121

    CustomizingtheDisplayofthePointer 121-122

    CustomizingPaintingofPartsoftheComponent 122-123

    UsingXPThemeswiththeComponent 123-124

    HandlingRight-to-LeftLayouts 124-125

    ApplyingThemetoCustomizetheAppearance 125-126

    CustomizingtheIndividualSheetAppearance 127

    SettingtheBackgroundColorsforaSheet 127-129

    SettingaBackgroundImageforaSheet 129-130

    DisplayingGridLinesonaSheet 130-133

    AddingaTitleandSubtitletoaSheet 133-134

    DisplayingaFooterforColumnsorGroups 134-138

    ApplyingaSkintoaSheet 138-140

    CreatingaCustomSkinforaSheet 140-142

    CustomizingtheSheetCornerAppearance 142-143

    Spread Windows Forms Developer’s Guide 5

    Copyright © GrapeCity, Inc. All rights reserved.

  • GeneralStyleoftheSheetCorner 143-145

    TextDisplayintheSheetCorner 145-146

    TableDisplayintheSheetCorner 146-148

    CustomizableCellintheSheetCorner 148-149

    CellSpansintheSheetCorner 149-150

    HeaderCountSynchronizationintheSheetCorner 150-151

    Drawing(Rendering)Style 151-152

    CustomizingRow,Column,andCellAppearance 153

    CustomizingtheRoworColumnAppearance 153

    SettingtheRowHeightorColumnWidth 153-155

    ResizingtheRoworColumntoFittheData 155-156

    UsingAutoRowHeight 156-158

    FindingRowsandColumnThatHaveData 158

    CreatingAlternatingRowsandColumns 158-162

    CustomizingtheAppearanceofHeaders 162-163

    AutoExpandRowHeaders 163

    CustomizingtheDefaultHeaderLabels 163-165

    CustomizingHeaderLabelText 165-167

    CustomizingtheStyleofHeaderCells 167-169

    AddingaGradienttoHeaderCells 169-170

    CustomizingtheHeaderGridLines 170-174

    SettingtheHeightorWidthofHeaderCells 174-175

    CreatingaSpaninaHeader 175-177

    CustomizingtheAppearanceofaCell 177-178

    ColoringaCell 178-180

    SettingaBackgroundImagetoaCell 180-181

    AligningCellContents 181-183

    ResizingtheCelltoFittheData 184

    ResizingtheDatatoFittheCell 184-185

    Spread Windows Forms Developer’s Guide 6

    Copyright © GrapeCity, Inc. All rights reserved.

  • CustomizingCellBorders 185-186

    CreatingandCustomizingCellBorders 186-190

    CreatingBorderswithDiagonalLines 190-192

    CreatingaComplexBorderwithMultipleLines 192-194

    CreatingaSpanofCells 194-196

    AllowingCellstoMergeAutomatically 196-198

    AllowingCellDatatoOverflow 198-199

    CreatingandApplyingaStyleforCells 199-202

    WorkingwithPatternandGradientFillEffects 202-203

    UsingSparklines 203-204

    AddingaSparklinetoaCell 204-205

    CustomizingMarkersandPointers 205-207

    SpecifyingHorizontalandVerticalAxes 207-209

    WorkingwithSparklines 209-212

    CustomizingSheetInteraction 213

    CustomizingInteractionwiththeOverallComponent 213

    CustomizingtheScrollBarsoftheComponent 213-217

    CustomizingtheScrollBarTips 217-219

    CustomizingtheSheetNameTabsoftheComponent 219-224

    CustomizingtheUserInterfaceImages 224-226

    AllowingtheUsertoZoomtheDisplayoftheComponent 226

    CustomizingtheScaleMode 226-227

    AddingaContextMenutoaComponent 227-228

    AddingaStatusBar 228-229

    HostingtheComponentonaWebPage 230

    CustomizingClipboardOperationOptions 230-232

    CustomizingUndoandRedoActions 232-233

    LocatingthePointerUsingHitTest 233

    CustomizingInteractionBasedonEvents 233-234

    Spread Windows Forms Developer’s Guide 7

    Copyright © GrapeCity, Inc. All rights reserved.

  • HandlingEventsofSubeditors 234

    CustomizingtheUserErrorMessages 234

    CustomizingInteractionwithaSheet 234-235

    CustomizingViewports 235-239

    CustomizingSplitBoxes 239-241

    CustomizingthePositionintheDisplay 241-242

    PlacingChildControlsonaSheet 242-243

    CreatingTables 243-244

    AddingaTable 244-245

    UsingTableFilters 245-248

    ResizingaTable 248-249

    SortingaTable 249-250

    SettingTableStyles 250-253

    AddingaTableFormula 253-254

    UnderstandingStructuredReferences 254-255

    UsingOperatorsandSpecialItems 255-256

    UnderstandingStructuredReferenceSyntaxRules 256-257

    UsingStructuredReferences 257

    WorkingWithSlicers 257-263

    CustomizingUserSearchingofData 263-264

    AllowingtheUsertoPerformaStandardSearch 264

    AllowingtheUsertoPerformanAdvancedSearch 264-265

    SearchingforDatawithCode 265-266

    CustomizingUserSelectionandDeselectionofData 266

    SpecifyingWhattheUserCanSelect 266-270

    CustomizingtheSelectionAppearance 270-273

    WorkingwithSelections 273-274

    WorkingwithDeselections 274-276

    UsingApplicationTags 276

    Spread Windows Forms Developer’s Guide 8

    Copyright © GrapeCity, Inc. All rights reserved.

  • AddingaTagtoaSheet 276

    AddingaTagtoaRoworColumn 276

    AddingaTagtoaCell 276-277

    SettingandResettingUserInteraction 277-278

    AllowingUserFunctionality 278-279

    ResettingPartsoftheInterface 279-282

    ClearingorRemovingPartsoftheInterface 282

    CustomizingDrawing 282-283

    WorkingwithShapesinCode 283-285

    WorkingwithAnnotations 285

    AllowingtheUsertoDrawwithaTabletPC 285-287

    CreatingCameraShapes 287-288

    CustomizingRoworColumnInteraction 289

    AllowingUserInteractionwithRowsandColumns 289

    AllowingtheUsertoEnterDatainRowsorColumns 289-290

    AllowingtheUsertoMoveRowsorColumns 290-292

    AllowingtheUsertoResizeRowsorColumns 292-293

    SettingFixed(Frozen)RowsorColumns 293-295

    SettingupPreviewRows 295-297

    ManagingFilteringofRowsofUserData 297-299

    AllowingtheUsertoFilterRows 299-300

    CustomizingSimpleFiltering 300

    UnderstandingSimpleRowFiltering 300-301

    SettingtheAppearanceofFilteredRows 301-304

    CustomizingtheFilterList 304

    DefiningtheContentsoftheFilterItemList 304-308

    DefiningtheOrderoftheItemsintheFilterItemList 308-309

    SettingtheAppearanceoftheDisplayoftheFilterItemList 309-311

    CreatingaCompletelyCustomFilter 311

    Spread Windows Forms Developer’s Guide 9

    Copyright © GrapeCity, Inc. All rights reserved.

  • SettingtheAppearanceofFilterIndicators 311

    UseCustomFilterIndicatorImages 311-313

    ShowingorHidingFilterIndicators 313

    DeterminingWhichHeaderRowDisplaystheIndicators 313-314

    CustomizingEnhancedFiltering 314

    UnderstandingEnhancedRowFiltering 314-317

    CustomizingtheFilterBar 318-319

    AddingaCustomSortDialog 319-320

    ManagingGroupingofRowsofUserData 320

    AllowingtheUsertoGroupRows 320-321

    UsingGrouping 321-322

    SettingtheAppearanceofGroupedRows 322-323

    CustomizingtheGroupBar 323-324

    CreatingaCustomGroup 324

    InteroperabilityofGroupingwithOtherFeatures 324-325

    ManagingOutlines(RangeGroups)ofRowsandColumns 325

    UsinganOutline(RangeGroup)ofRowsorColumns 325-327

    CustomizingtheAppearanceofanOutline(RangeGroup) 327-329

    InteroperabilityofOutlineswithOtherFeatures 329

    ManagingSortingofRowsofUserData 329-330

    AllowingtheUsertoAutomaticallySortRows 330-332

    UsingAutomaticSorting 332-333

    SortingRows,Columns,orRanges 333-334

    SettingtheAppearanceofSortIndicators 334-336

    CustomizingInteractionwithCellTypes 337

    UnderstandingHowCellTypesWork 337

    UnderstandingCellTypeBasics 337-338

    DeterminingtheCellTypeoftheActiveCell 338

    UnderstandingHowCellTypesDisplayandFormatData 338-341

    Spread Windows Forms Developer’s Guide 10

    Copyright © GrapeCity, Inc. All rights reserved.

  • UnderstandingHowCellTypeAffectsModelData 341-342

    WorkingwithEditableCellTypes 342-343

    SettingaCurrencyCell 343-344

    SettingaDate-TimeCell 344-346

    SettingaGcCharMaskCell 346-348

    SettingaGcDateTimeCell 349-350

    SettingaGcMaskCell 350-353

    SettingaGcNumberCell 353-355

    SettingaGcTextBoxCell 355-357

    SettingaGcTimeSpanCell 357-359

    SettingaGeneralCell 359-361

    SettingaMaskCell 361-362

    SettingaNumberCell 362-367

    SettingaPercentCell 368-369

    SettingaRegularExpressionCell 369-370

    SettingaTextCell 370-371

    WorkingwithGraphicalCellTypes 371-372

    SettingaBarcodeCell 372-377

    SettingaButtonCell 377-382

    SettingaCheckBoxCell 382-384

    SettingaColorPickerCell 384-388

    SettingaComboBoxCell 388-391

    SettingaHyperlinkCell 391-395

    SettinganImageCell 395-397

    SettingaListBoxCell 397-399

    SettingaMultiple-ColumnComboBoxCell 399-402

    SettingaMultipleOptionCell 402-404

    SettingaProgressIndicatorCell 404-406

    SettingaRichTextCell 406-410

    Spread Windows Forms Developer’s Guide 11

    Copyright © GrapeCity, Inc. All rights reserved.

  • SettingaSliderCell 410-413

    UnderstandingAdditionalFeaturesofCellTypes 413-414

    DisplayingSpinButtons 414-415

    AllowingaComboBoxCelltoHandleaDouble-Click 415-417

    LimitingValuesforaNumericCell 417-418

    CustomizingthePop-UpDate-TimeControl 418-420

    CustomizingthePop-UpCalculatorControl 420-422

    CustomizingAutomaticCompletion(TypeAhead) 422

    WorkingwithaSubEditor 422-423

    CreatingaCustomCellType 423-427

    CustomizingInteractioninCells 428

    UsingEditModeandFocus 428

    UnderstandingEditModeinaCell 428-429

    LockingaCell 429-431

    AllowingtheDisplayofButtonsinaCell 432

    CustomizingtheFocusIndicatorforaCell 432-435

    UsingDragOperationstoFillCells 435

    FillingCellswithDragandDrop 435-436

    FillingCellswithDragandFill 436-440

    FillingCellswithDragandMove 440

    UsingVisibleIndicatorsintheCell 440

    DisplayingTextTipsinaCell 440-442

    AddingaNotetoaCell 442-445

    PreventingaCellfromHavingFocus 445

    GettingInformationofaClickedCell 445-446

    DisplayingErrorIconsinCellsorRows 446-447

    UsingConditionalFormattingofCells 447

    CreatingConditionalFormattingwithRules 447-448

    ColorScaleRules 448-449

    Spread Windows Forms Developer’s Guide 12

    Copyright © GrapeCity, Inc. All rights reserved.

  • DataBarRule 449-451

    HighlightingRules 451-453

    IconSetRule 453-454

    Top,Bottom,orAverageRules 454-455

    SettingupConditionalFormattingofaCell 455-457

    ManagingFormulasinCells 457

    PlacingaFormulainCells 457-459

    SpecifyingaCellReferenceinaFormula 459-461

    SpecifyingaSheetReferenceinaFormula 461-462

    UsingaCircularReferenceinaFormula 462-464

    NestingFunctionsinaFormula 464

    RecalculatingandUpdatingFormulasAutomatically 464-465

    FindingaValueusingGoalSeek 465-466

    AllowingtheUsertoEnterFormulas 466-467

    CreatingandUsingaCustomName 467-468

    CreatingandUsingaCustomFunction 468-470

    CreatingandUsingExternalVariable 470-472

    CreatingandUsingaVisualFunction 472-473

    UsingtheArrayFormula 473-474

    WorkingWithDynamicArrayFormulas 474-486

    UsingLanguagePackage 486

    AvailableLanguagePackagesforWinForms 486-487

    CreatingandUsingaCustomLanguagePackage 487-489

    AccessingDatafromHeaderorFooter 489-491

    AutoFormatFormulas 491-492

    ManagingExternalReference 492-496

    UsingtheAdditionalSpreadControls 496

    WorkingwiththeFormulaTextBox 496-500

    SettinguptheFormulaProvider 500-501

    Spread Windows Forms Developer’s Guide 13

    Copyright © GrapeCity, Inc. All rights reserved.

  • SettinguptheNameBox 501-503

    ManagingCellRangeFiltering 503-504

    ManagingCellRangeSorting 504-506

    ManagingDataBinding 507

    BindingtoData 507

    BindingSpreadtoanExternalDataSet 507-508

    BindingaCellRangeinSpreadtoanExternalDataSource 508-510

    BindingaCellRangeinSpreadasaDataSourcetoanExternalControl 510-512

    CustomizingColumnandFieldBinding 512-515

    BindingaComboBoxtoaDataReader 515-516

    AddingtoBoundData 516

    AddingaRowtoaBoundSheet 516-517

    AddinganUnboundRowtotheSheet 517-519

    AddinganUnboundColumntoaBoundSheet 519-520

    CustomizingDataBinding 520

    CustomizingColumnHeadersforBoundSheets 520-522

    CustomizingCellTypesforBoundSheets 522-524

    WorkingwithHierarchicalDataDisplay 524-530

    CreatingaHierarchicalDisplayManually 530-532

    CreatingCustomHierarchyIcons 532

    Tutorial:BindingtoaCorporateDatabase(VisualStudio2013orlater) 532

    Step1:AddingSpreadtoaDataBindingProject 532

    Step2:SettinguptheDatabaseConnection 532-533

    Step3:SettingthePropertiesintheControls 533-534

    Step4:ImprovingtheDisplaybyChangingtheCellType 534-535

    ManagingDataonaSheet 536

    PlacingandRetrievingData 536

    HandlingDataUsingSheetMethods 536-539

    HandlingDataUsingCellProperties 539-540

    Spread Windows Forms Developer’s Guide 14

    Copyright © GrapeCity, Inc. All rights reserved.

  • RepeatedlyFillingaRangeofCellswithCopiedCells 540-541

    ValidatingUserInput 541-545

    RearrangingDataonaSheet 545

    CopyingDataonaSheet 545

    MovingDataonaSheet 545-546

    SwappingDataonaSheet 546-547

    RemovingDatafromaSheet 547-548

    ImprovingPerformancebySuspendingtheLayout 548-551

    ManagingKeyboardInteraction 552

    UnderlyingKeystrokeProcessing 552-553

    FactorsofKeyboardMapUsage 553-555

    DefaultKeyboardNavigation 555-563

    DefaultKeyboardMaps 563-564

    DefaultMapforExcelCompatibility 564-565

    DefaultMapforNormalandWhenFocused 565

    DefaultMapforNormalandWhenAncestorOfFocused 565-567

    DefaultMapforReadOnlyandWhenFocused 567

    DefaultMapforReadOnlyandWhenAncestorOfFocused 567-568

    DefaultMapforRowModeandWhenFocused 568

    DefaultMapforRowModeandWhenAncestorOfFocused 568-569

    DefaultMapforSingleSelectandWhenFocused 569

    DefaultMapforSingleSelectandWhenAnscestorFocused 569-570

    DefaultMapforMultiSelectandWhenFocused 570

    DefaultMapforMultiSelectandWhenAncestorOfFocused 570

    DefaultMapforExtendedSelectandWhenFocused 570

    DefaultMapforExtendedSelectandWhenAncestorOfFocused 570-571

    DeactivatingtheDefaultKeyboardMap 571-572

    ChangingtheDefaultKeyboardMap 572-573

    UsingInputMapswithActionMaps 573-577

    Spread Windows Forms Developer’s Guide 15

    Copyright © GrapeCity, Inc. All rights reserved.

  • CustomizingtheInputMaps 577-579

    ChanginganInputMapforaChildView 579-582

    UsingtheExcelCompatibilityInputMaps 582

    SavingandLoadingMapFiles 582-583

    ManagingEventsfromUserActions 584

    ClickingActions 584-587

    SelectingActions 587-588

    EnteringDataActions 588

    Sheet-LevelActions 588-589

    InteractivityActions 589

    ShapeActions 589

    PrintActions 589-590

    ManagingFileOperations 591

    SavingDatatoaFile 591

    SavingtoaSpreadXMLFile 591-592

    SavingtoanExcelFile 592-594

    SavingtoaTextFile 594

    SavingtoanHTMLTable 594-595

    SavingSpreadsheetDatatoSimpleXML 595-596

    OpeningExistingFiles 596-597

    OpeningaSpreadXMLFile 597

    OpeninganExcelFile 597-599

    OpeningaSpreadCOMFile 599

    OpeningaCustomTextFile 599-600

    UsingSerialization 600-601

    ImplementingaSerializerClass 601-607

    ParsingFormulasinCustomXMLDeserialization 607

    SavingandLoadingaSkin 607

    SavingaSkin 607-608

    Spread Windows Forms Developer’s Guide 16

    Copyright © GrapeCity, Inc. All rights reserved.

  • LoadingaSkin 608

    StoringExcelSummaryandView 608-610

    ManagingPrinting 611

    SpecifyingWhattoPrint 611

    PrintinganEntireSheet 611-613

    PrintingtoPDF 613-614

    PrintingaChildViewofaHierarchicalDisplay 614-615

    PrintingParticularPages 615-617

    PrintingthePortionoftheSheetwithData 617

    PrintingaRangeofCellsonaSheet 617-619

    PrintinganAreaoftheSheet 620

    PrintingaSheetwithCellNotes 620-622

    PrintingaSheetwithShapes 622-623

    PrintinginDuplexMode 623

    CustomizingtheAppearanceofthePrinting 623

    UnderstandingthePrintingOptions 623-628

    CustomizingthePrintJobSettings 628-629

    CustomizingthePrintedPageLayout 629-631

    CustomizingthePrintedPageHeaderorFooter 631-635

    CustomizingthePrintPreviewDialog 635-637

    RepeatingRowsorColumnsonPrintedPages 637

    AddingaPageBreak 637-639

    AddingaWatermarktoaPrintedPage 639-640

    OptimizingthePrinting 640

    OptimizingthePrintingUsingRules 640-643

    OptimizingthePrintingUsingSize 643

    DisplayingDialogsforUsers 643

    DisplayingaPrintDialogfortheUser 644

    DisplayinganAbortMessagefortheUser 644

    Spread Windows Forms Developer’s Guide 17

    Copyright © GrapeCity, Inc. All rights reserved.

  • ProvidingaPreviewofthePrinting 644-646

    WorkingwiththeChartControl 647

    UnderstandingCharts 647

    ChartUserInterfaceElements 647-648

    ChartObjectModel 648-649

    ChartTypesandViews 649-651

    PlotTypes 651

    YPlotTypes 651-652

    AreaCharts 652-654

    BarCharts 654-657

    LineCharts 657-658

    MarketData(High-Low)Charts 658-660

    PointCharts 660-661

    StripeCharts 661-662

    XYPlotTypes 662

    XYBubbleCharts 662-663

    XYLineCharts 663

    XYPointCharts 663-664

    XYStripeCharts 664

    XYZPlotTypes 664-665

    XYZPointCharts 665-666

    XYZLineCharts 666-667

    XYZSurfaceCharts 667-668

    XYZStripeCharts 668

    PiePlotTypes 668

    DoughnutCharts 668-669

    PieCharts 669

    PolarPlotTypes 669-670

    PolarPointCharts 670-671

    Spread Windows Forms Developer’s Guide 18

    Copyright © GrapeCity, Inc. All rights reserved.

  • PolarLineCharts 671-672

    PolarAreaCharts 672-673

    PolarStripeCharts 673

    RadarPlotTypes 673-674

    RadarPointCharts 674-675

    RadarLineCharts 675-676

    RadarAreaCharts 676

    RadarStripeCharts 676-677

    DataPlotTypes 677-678

    PlotsandSeries 678-680

    Walls 680-681

    AxisandOtherLines 681-682

    FillEffects 682-685

    ChartLineStyle 685-687

    ElevationandRotation 687-688

    Lighting,Shapes,andBorders 688-690

    Size-Height,Width,andDepth 690-691

    Labels 691-692

    Legends 692-693

    CreatingCharts 693

    CreatingPlotTypes 693-694

    CreatingaYPlot 694-696

    CreatinganXYPlot 696-698

    CreatinganXYZPlot 698-701

    CreatingaPiePlot 701-703

    CreatingaPolarPlot 703-706

    CreatingaRadarPlot 706-709

    CombiningPlotTypes 709-711

    CreatingaSunburstChart 711-713

    Spread Windows Forms Developer’s Guide 19

    Copyright © GrapeCity, Inc. All rights reserved.

  • CreatingaTreemapChart 713-717

    ConnectingtoData 718

    UsingaBoundDataSource 718-720

    UsinganUnboundDataSource 720

    UsingRawandRepresentedData 720-721

    SavingorLoadingaChart 721-722

    UsingtheChartDesigner 722

    OpeningtheChartDesigner 723-724

    CreatingaChartControl 724-727

    ChartCollectionEditors 727

    LabelCollectionEditor 727-728

    LegendCollectionEditor 728

    PlotCollectionEditor 728-729

    LightCollectionEditor 729-730

    SeriesCollectionEditor 730

    ChartDesignerToolbar 730-731

    UsingtheChartControl 731

    AddingaChartControl 731-738

    ChangingChartOptions 738-740

    UsingtheChartDesigner 740-741

    BindingtheChartControl 741-743

    AllowingtheUsertoChangetheChart 743-745

    AddingaContextMenu 745

    UsingTouchSupportwiththeComponent 746

    UnderstandingTouchSupport 746

    UnderstandingTouchGestures 746

    UnderstandingTouchMessages 746

    UsingTouchSupport 746-747

    UsingaTouchKeyboard 747-748

    Spread Windows Forms Developer’s Guide 20

    Copyright © GrapeCity, Inc. All rights reserved.

  • UsingtheTouchMenuBar 748-750

    UsingTouchSupportwithAutoFit 750

    UsingTouchSupportwithCellNotes 750

    UsingTouchSupportwithCharts 750-751

    UsingTouchSupportwithClipboardOperations 751

    UsingTouchSupportwithDragandFill 751-753

    UsingTouchSupportwithDrop-DownElements 753-754

    UsingTouchSupportwithEditableCells 754-755

    UsingTouchSupportwithInputManCells 755-758

    UsingTouchSupportwithFiltering 758

    UsingTouchSupportwithGrouping 758-759

    UsingTouchSupportwithRangeGrouping 759-760

    UsingTouchSupportwhenMovingColumnsorRows 760-762

    UsingTouchSupportwhenResizingColumnsorRows 762-763

    UsingTouchSupportwithScrolling 763-764

    UsingTouchSupportwithSelections 764-766

    UsingTouchSupportwithShapes 766

    UsingTouchSupportwhenSorting 766-767

    UsingTouchSupportwithViewports 767

    UsingTouchSupportwiththeTabStrip 767

    UsingTouchSupportwithZooming 767-768

    2. Index 769-824

    Spread Windows Forms Developer’s Guide 21

    Copyright © GrapeCity, Inc. All rights reserved.

  • Getting Started

    ThistopicdescribeshowtogetstartedwiththeSpreadcomponent.Itincludes:

    HandlingInstallationWorkingwiththeComponentUnderstandingtheSpreadWizardGettingMorePracticeTutorial:CreatingaCheckbookRegister

    Formorein-depthexplanationoftheproduct,refertoUnderstandingtheProduct.

    Handling Installation

    Thefollowingtasksinvolveinstallingandredistributingtheproduct:

    InstallingtheProductLicensingaTrialProjectafterInstallationEnd-UserLicenseAgreementCreatingaBuildLicenseHandlingRedistributionProductRequirementsUsingWindowsRegionalSettingsorOptionsUsingSatelliteAssembliesforLanguages

    Installing the Product

    InstallationinstructionsandalistofinstalledfilesforSpreadWindowsFormsisprovidedintheReadMefilethataccompaniesthisproduct.ToviewtheReadMefile,dooneofthefollowing:

    1. FromtheStartmenuchoosePrograms->GrapeCity->Spread.NET13->SpreadWindowsForms->SpreadWindowsFormsReadMe.SelecttheReadMeundertheGrapeCitynameontheStartscreenwithMicrosoftWindows8,8.1,or10.

    2. Ifyouperformedadefaultinstallation,inWindowsExplorerbrowseto\GrapeCity\Spread.NET13\Docs\WindowsFormsundertheprogramfilesdirectoryandthendouble-clickthereadme.chmfile.

    YoucanalsoaccesstheReadMeonthewebsite.

    Licensing a Trial Project after Installation

    TolicenseWindowsFormsprojectsmadewiththetrialversiondothefollowing:

    1. EnsurethatSpreadislicensedonthemachinebyfollowingtheinstallationstepsintheReadMeonthewebsite.2. OpentheprojectinMicrosoftVisualStudio.3. OpentheVisualStudioBuildmenuandselectRebuildSolution.4. Theexecutableapplicationisnowlicensedandnonagscreensorevaluationbannersappearwhenyourunit.You

    candistributetheapplicationtounlicensedmachinesandnonagscreensorevaluationbannersappear.

    Ifyouhaveinstalledatrialversionoftheproduct,youcanlicensetheproductusingtheproductsplashscreenintheMicrosoftVisualStudioproject.

    Spread Windows Forms Developer’s Guide 22

    Copyright © GrapeCity, Inc. All rights reserved.

    https://www.grapecity.com/spreadnet/docs/v13/readme.htmlhttps://www.grapecity.com/spreadnet/docs/v13/readme.html

  • End-User License Agreement

    TheGrapeCitylicensinginformation,includingtheGrapeCityend-userlicenseagreements,frequentlyaskedlicensingquestions,andtheGrapeCitylicensingmodel,isavailableonlineathttps://www.grapecity.com/licensing/spreadandhttps://www.grapecity.com/legal/eula.

    Creating a Build License

    Youcancreateabuildlicensetouseonabuildmachine.

    Licensesarebuiltusingthelicensecompilertool(lc.exe)toproduceaspecialresourcefilewiththe.licensesfileextension.VisualStudioVB.NETandC#projectsautomaticallyhandlecompilingthelicenses.licxintheprojecttoproducethe.licensesresourcefile,whichislinkedintothetargetexecutable.Thecomponents’run-timelicensekeysinthatlicensesresourcefileareloadedandverifiedwhenthefirstinstanceofeachcomponentwiththeLicenseProviderattributeiscreatedintheapplication.Youcanremovethelicenses.licxfromyourVisualStudioprojectandaddthe.licensesresourceinitsplaceusingthefollowingsteps:

    1. Buildtheprojectusingthelicensedcomponentsonadevelopermachinewhichislicensedfordevelopmentwithallthecomponentsreferencedintheproject(thiscreatesthe.licensesresource).

    2. Findthelicenses.licxintheSolutionExplorerwindow.YoucanusetheShowAllFilestoolbarbuttontoseeitorexpandthePropertiesfolder.

    3. Right-clickthelicenses.licxintheSolutionExplorerwindow,andthenselectExcludeFromProject.

    4. UseWindowsExplorer(outsideVisualStudio)tofindthe.licensesfileintheobj\{configuration}folder(obj\Debugorobj\Release).Thefileshouldhavethename{target}.{ext}.licenses(forexample:project1.exe.licenses).

    5. Copythatfiletotheprojectfolderandrenameittoremovethetargetname(renameitfrom{target}.{ext}.licensesto{ext}.licenses).Forexample:project1.exe.licensestoexe.licenses.

    6. IntheVisualStudioSolutionExplorerwindow,findthe{ext}.licenses(youmightneedtorefreshthewindow),thenright-clickthefileandselectIncludeInProject.

    Spread Windows Forms Developer’s Guide 23

    Copyright © GrapeCity, Inc. All rights reserved.

    https://www.grapecity.com/licensing/spreadhttps://www.grapecity.com/legal/eula

  • 7. ChangetheBuildActionforthe{ext}.licensesfromContenttoEmbeddedResource.

    8. Theprojectcannowbebuiltwithoutrequiringadeveloperlicenseonthemachine,sincethelicensehasalreadybeenbuiltandlinkedintotheproject.

    Notethefollowingrestrictions:

    Thelicensesresourcecontainsthenameofthetargetmoduleencodedinitscontents,sothatlicensesresourceisspecifictothatparticularproject.Thestepsdescribedabovewillnotbypassanypartofthedesign-timelicenseenforcement.Thedeveloperlicenseisstillrequiredtoopenformscontaininginstancesofthelicensedcontrols.Ifthelicensedcomponentsintheprojectchange,thenspecialcareshouldbetaken.Thelicenses.licxshouldbeaddedbacktotheprojectfirst,sothatitdoesnotgetrecreated(empty)byVisualStudioandcausetypereferences(andembeddedlicensesintheresource)tobelost.Afterthenewlicensedcomponentsareaddedorchangedinthelicx,theabovestepsshouldberepeated.Theabovestepsonlyapplyfor.NETmanagedcodeapplicationswhichusethestandard.NETFrameworkcomponentlicensingmodel(ActiveXcontrollicensinginmanaged.NETapplicationsdoesnotusethismechanism).

    Handling Redistribution

    WhenyoudeployapplicationsthatyouhavedevelopedusingSpreadWindowsForms,yourusers'systemsmustmeet

    Spread Windows Forms Developer’s Guide 24

    Copyright © GrapeCity, Inc. All rights reserved.

  • thefollowingrequirementsandyoumustdistributethefileslistedinthefollowingsections:

    SystemRequirements

    Yourusers'systemsmustmeetthefollowingrequirements:

    Operating SystemMustbeoneofthefollowing:

    MicrosoftWindowsServer2012MicrosoftWindowsServer2012R2MicrosoftWindowsServer2008R2MicrosoftWindowsServer2008MicrosoftWindowsServer2016MicrosoftWindows7MicrosoftWindows8.1MicrosoftWindows10

    SoftwareYoumusthavetheMicrosoft.NETFramework4.5.2orlaterinstalled.

    FilestoDistribute

    Youmustdistributethefollowingfilestoyourusers'systems:

    ThefollowingassembliesthatcomewithSpreadWindowsForms:GrapeCity.CalcEngine.dllGrapeCity.Spreadsheet.dllGrapeCity.SpreadSheet.Win.dllFarPoint.CalcEngine.dllFarPoint.Excel.dllFarPoint.PluginCalendar.WinForms.dllFarPoint.Win.dllFarPoint.Win.Spread.dllFarPoint.Localization.dll

    InstallationforyourapplicationmustcopytheseDLLsfromtheSpreadWindowsFormsdirectorytothedirectorywheretheapplication'sexecutablefileresidesorinstallthemintheglobalassemblycache(GAC).FormoreinformationontheGAC,refertotheMicrosoftVisualStudio.NETand.NETFrameworkdocumentation.

    The.NETFrameworkredistributablepackage,iftheusersdonothavethe.NETFrameworkontheirsystems.Formoreinformationonthispackage,refertothe.NETFrameworkdocumentation.IfyouusetheinknotationfeatureinyourprojectthenyouwillalsoneedtodistributetheFarPoint.Win.Ink.dll.ThisDLLwouldneedtobeinstalledtothedirectorywheretheapplication'sexecutablefileresidesorbeinstalledintheglobalassemblycache(GAC).ThisalsorequirestheruntimecomponentsoftheMicrosoftTabletPCSDK.TheFarPoint.Win.Inkassemblyiscurrentlybuiltwithversion1.7oftheMicrosoftTabletPCSDK.IfyouusethetextrendererfeatureinyourprojectthenyouwillalsoneedtodistributetheFarPoint.Win.TextRenderer.dll.ThisDLLwouldneedtobeinstalledtothedirectorywheretheapplication'sexecutablefileresides.IfyouusetheexporttoPDFfeatureinyourprojectthenyouwillalsoneedtodistributetheFarPoint.PDF.dll.IfyouusetheexporttoHTMLfeatureinyourprojectthenyouwillalsoneedtodistributetheFarPoint.Win.Spread.Html.dllandtheSystem.Web.dll.IfyouuseaSpreaddesignerdialogatruntimethenyoualsoneedtodistributethe

    Spread Windows Forms Developer’s Guide 25

    Copyright © GrapeCity, Inc. All rights reserved.

  • FarPoint.Win.Spread.Design.dll.IfyouusethechartcontrolinyourprojectthenyouneedtodistributetheFarPoint.Win.Chart.dll.

    HostingtheControlonaWebPage

    IfyouarehostingtheSpreadWindowsFormscontrolasausercontrolonaWebpageinMicrosoftInternetExplorer(IE),makethesesecuritypermissionadjustments:

    1. InIE,selectTools->InternetOptions->SecurityandselectTrustedSites.ClicktheSitesbuttonandaddtheWebsitewhereyourusercontrolresides(forexample,http://localhost).

    2. InWindows,selectStart->Settings->ControlPanelandselectAdministrativeTools.SelectMicrosoft.NETFrameworkConfiguration.Inthe.NETFrameworkConfigurationwindow,selectRuntimeSecurityPolicyandclickAdjustZoneSecurity.IntheAdjustZoneSecurityWizard,answerthefirstscreen(whichcomputeritappliesto)andinthenextscreen,clickTrustedSitesandslidetheindicatortogivethatzoneFullTrust.FinishthewizardbyclickingNext.

    Product Requirements

    Developingapplicationswiththe.NET4.5.2versionofSpreadWindowsForms

    Fordevelopingapplicationswiththe.NET4.5.2versionofSpreadWindowsForms,youmusthavethefollowingsystemandsoftwarespecifications:

    Operating SystemOneofthefollowing:

    MicrosoftWindowsServer2012

    MicrosoftWindowsServer2012R2

    MicrosoftWindowsServer2008R2

    MicrosoftWindowsServer2008

    MicrosoftWindowsServer2016

    MicrosoftWindows7

    MicrosoftWindows8.1

    MicrosoftWindows10

    SoftwareThereleaseversionoftheMicrosoft.NET4.5.2Frameworkorlater.

    Thesearetheminimumrequirementstoruntheproduct.

    IfyouwanttotakeadvantageoftheinkcapabilitiesofSpreadWindowsForms,youwillneedtoinstalltheruntimecomponentsoftheMicrosoftTabletPCSDK.TheFarPoint.Win.Inkassemblyiscurrentlybuiltwithversion1.7oftheMicrosoftTabletPCSDK.

    Using Windows Regional Settings or Options

    TheSpreadcomponentreadstheWindowsregionalsettingsoroptions,whicharesetbytheuserthroughtheControlPanel,butduetovariationsinhowWindowshandlesthosesettings,yourusermightexperienceunexpectedresults.

    IngeneralinWindowsoperatingsystems,theSpreadcomponentdoesnotrecognizechangesmadetotheWindowsregionalsettingsuntilyourestartyourdevelopmentenvironmentoryourapplicationorperformanyoperationthat

    Spread Windows Forms Developer’s Guide 26

    Copyright © GrapeCity, Inc. All rights reserved.

  • unloadsandreloadsthecurrentassemblyanddependentassemblies.Thisisbecausehandlingtheregionalsettingsisveryprocessorintensive.Tooptimizeperformancethesesettingsarenotcheckedeachtimeasimpleoperationisperformed.

    InmostWindowsoperatingsystems,theregionaloptionsarereadfromthesystemregistry.Incertainsituations,Windowsdoesnotclearpreviousregionaloptionswhenreadingchangesfromthesystemregistry.Beawareofthiswhenworkingwithregionalsettings.

    Using Satellite Assemblies for Languages

    Youcanplaceresourcesfordifferentlanguagesusingsatelliteassemblies.Theassemblyisthenloadedinmemoryiftheuserviewstheapplicationinthatlanguage.Theresourcesmustbeplacedinspecificlocationssotheycanbelocatedandused.Iftheresourcecannotbefound,thedefaultresourceisused.

    Usethefollowingstepstoaddalanguageresource:

    1. Findtheresourcesinthelocalizationfolderundertheinstalledbinfolder(forexample,ko-KRorzh-CN).

    2. CopythefoldertothebinfolderoftheapplicationorinstalltotheGAC.

    3. SetthecurrentUIculturetothelanguage(forexample,Korean)usingthefollowingcode.System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("ko-KR")

    Ifyouwishtousetheresourceatdesigntime,installthesatelliteassembliestotheGACandselectthelanguageinVisualStudio.NET.

    Thestand-alonedesignerusestheresourcesintheGACiftheoperatingsystemandtheGACresourcesusethesamelanguage.Ifthelanguageisdifferent,thedefaultresourceisapplied(English).

    Working with the Component

    ThetasksinvolvedwithusingtheSpreadcomponentonaWindowsFormare:

    AddingaComponenttoaVisualStudio2015or2017ProjectAddingaComponenttoaVisualStudio2013ProjectUnderstandingPartsoftheComponentUsingSmartTagsDrop-DownUsingVerbsinthePropertiesWindowWorkingwithCollectionEditorsAddingSupportforHighDPISettings

    Adding a Component to a Visual Studio 2015 or 2017 Project

    UsethefollowingstepstoaddthecomponenttoaprojectinVisualStudio.NET.

    ThefirststepistocreateanewprojectinVisualStudio.NET,andtoaddaSpreadWindowsFormscomponenttotheproject.

    1. StartVisualStudio.NET.2. FromtheFilemenu,chooseNew,Project.3. IntheNewProjectdialog,intheInstalledarea,selectaprojecttypedependingonthelanguageenvironment

    inwhichyouaredeveloping.Forexample,chooseWindowsunderVisualBasic.a. ChoosethetypeofprojectsuchasWindowsFormsApplication.b. IntheNamebox,typethenameofthenewproject.ThedefaultisWindowsApplication1forthefirst

    WindowsFormsapplication.

    Spread Windows Forms Developer’s Guide 27

    Copyright © GrapeCity, Inc. All rights reserved.

  • c. IntheLocationbox,leavethelocationpathasthedesignatedpath,orclickBrowsetochangethepathtoanewdirectory.

    d. ClickOK.IfyourprojectdoesnotdisplaytheSolutionExplorer,fromtheViewmenu,chooseSolutionExplorer.

    4. IntheSolutionExplorer,right-clickontheformname,Form1.ChooseRenamefromthepop-upmenu,thentypethenewformnameyoupreferforthenewformname.

    Usethefollowingstepstoaddthecomponenttothetoolboxifthecomponentisnotlistedinthetoolbox.

    1. IftheToolboxisnotdisplayed,fromtheViewmenuchooseToolbox.2. OncetheToolboxisdisplayed,lookintheGrapeCitySpreadcategory(orinanyothercategoryifyouhave

    installedSpreadandplacedthetoolboxiconinadifferentcategory).3. IftheSpreadcomponentisnotintheToolbox:

    a. Right-clickintheToolbox,andfromthepop-upmenuchooseChooseItems.b. IntheChooseToolboxItemsdialog,clickthe.NETFrameworkComponentstab.c. Inthe.NETFrameworkComponentstab,theFpSpreadcomponent(intheFarPoint.Win.Spreadnamespace)shouldbedisplayedinthelistofcomponents.SelecttheSpreadcomponentcheckboxandclickOK.SelectfpChart(FarPoint.Win.Chartnamespace)forthechartcontrol.IftheSpreadcomponentisnotdisplayedinthelistofcomponents,clickBrowseandbrowsetotheinstallationpathfortheSpreadWindowsFormscomponent.Oncethere,selecttheFarPoint.Win.Spread.dllandclickOpen.TheSpreadcomponentisnowdisplayedinthelistofcomponents.SelectitandclickOK.SelectFarPoint.Win.Chart.dllforthechartcontrol.

    d. Youcantestthatthecomponenthasbeenaddedbyopeningaprojectandinsertingthecomponent.

    ThenextstepistoaddtheSpreadcomponenttoaproject.

    1. Withanopenproject,intheToolboxunderGrapeCitySpread(orwhatevercategorytowhichyouaddedit),selecttheFpSpreadcomponent.

    2. OnyourWindowsFormspage,drawaSpreadcomponentbydraggingarectanglethesizethatyouwouldliketheinitialcomponentorsimplydouble-clickonthepage.TheSpreadcomponentappears.TheSpreadDesigneralsoappearsbydefault.Closethedesigner.

    Yourprojectshouldlooksimilartothefollowingpicture.

    Spread Windows Forms Developer’s Guide 28

    Copyright © GrapeCity, Inc. All rights reserved.

  • YouhaveaddedtheSpreadcomponenttotheproject.

    Adding a Component to a Visual Studio 2013 Project

    Ifyouarenewtothe.NETplatform,youmightbeunfamiliarwithhowtostartanewprojectusingacomponent.TousetheSpreadWindowsFormsproduct,youneedtoaddthecomponenttoaprojectinVisualStudio.NET.

    ThefirststepistocreateanewprojectinVisualStudio.NET,andtoaddaSpreadWindowsFormscomponenttotheproject.

    1. StartVisualStudio.NET.2. FromtheFilemenu,chooseNew,ProjectorselectNewProject...underStart.3. IntheNewProjectdialog,intheInstalledarea,selectaprojecttypedependingonthelanguageenvironmentin

    whichyouaredeveloping.Forexample,chooseWindowsunderVisualBasic.

    Spread Windows Forms Developer’s Guide 29

    Copyright © GrapeCity, Inc. All rights reserved.

  • a. ChoosethetypeofprojectsuchasWindowsFormsApplication.b. IntheNamebox,typethenameofthenewproject.ThedefaultisWindowsApplication1forthefirst

    WindowsFormsapplication.c. IntheLocationbox,leavethelocationpathasthedesignatedpath,orclickBrowsetochangethepathtoanewdirectory.

    d. ClickOK.IfyourprojectdoesnotdisplaytheSolutionExplorer,fromtheViewmenu,chooseSolutionExplorer.

    4. IntheSolutionExplorer,right-clickontheformname,Form1.ChooseRenamefromthepop-upmenu,thentypethenewformnameyoupreferforthenewformname.

    ThenextstepistoaddtheSpreadcomponenttothetoolbox.Thisonlyhastobedoneonce.

    1. IftheToolboxisnotdisplayed,fromtheViewmenuchooseToolbox.2. OncetheToolboxisdisplayed,lookintheGrapeCitySpreadcategory(orinanyothercategoryifyouhaveinstalled

    Spreadandplacedthetoolboxiconinadifferentcategory).3. IftheSpreadcomponentisnotintheToolbox:

    a. Right-clickintheToolbox,andfromthepop-upmenuchooseChooseItems.b. IntheChooseToolboxItemsdialog,clickthe.NETFrameworkComponentstab.c. Inthe.NETFrameworkComponentstab,theFpSpreadcomponent(intheFarPoint.Win.Spreadnamespace)shouldbedisplayedinthelistofcomponents.SelecttheSpreadcomponentcheckboxandclickOK.SelectfpChart(FarPoint.Win.Chartnamespace)forthechartcontrol.IftheSpreadcomponentisnotdisplayedinthelistofcomponents,clickBrowseandbrowsetotheinstallationpathfortheSpreadWindowsFormscomponent.Oncethere,selecttheFarPoint.Win.Spread.dllandclickOpen.TheSpreadcomponentisnowdisplayedinthelistofcomponents.SelectitandclickOK.SelectFarPoint.Win.Chart.dllforthechartcontrol.

    Spread Windows Forms Developer’s Guide 30

    Copyright © GrapeCity, Inc. All rights reserved.

  • d. Youcantestthatthecomponenthasbeenaddedbyopeningaprojectandinsertingthecomponent.

    ThenextstepistoaddtheSpreadcomponenttoaproject.

    1. Withanopenproject,intheToolboxunderGrapeCitySpread(orwhatevercategorytowhichyouaddedit),selecttheFpSpreadcomponent.

    2. OnyourWindowsFormspage,drawaSpreadcomponentbydraggingarectanglethesizethatyouwouldliketheinitialcomponentorsimplydouble-clickonthepage.TheSpreadcomponentappears.TheSpreadDesigneralsoappearsbydefault.Closethedesigner.

    Yourprojectshouldnowlooksimilartothepictureshownhere.

    YouhaveaddedtheSpreadcomponenttotheproject.

    Understanding Parts of the Component

    TheSpreadcomponentismadeupofthespreadsheetthatdisplaysthedataalongwithscrollbarsand,ifmultiplesheets,sheettabsinatabstrip.ThefigurebelowshowsthemajorpartsoftheSpreadcomponent.Severalofthesecanbehidden,butthisshowsthedefaultdisplay.

    Spread Windows Forms Developer’s Guide 31

    Copyright © GrapeCity, Inc. All rights reserved.

  • Formoreinformationon... Referto...sheetcorner CustomizingtheSheetCornerAppearance

    sheettabs CustomizingtheSheetNameTabsoftheComponent

    scrollbars CustomizingtheScrollBarsoftheComponent

    rowandcolumnheaders CustomizingtheAppearanceofHeaders

    focusindicator(ofactivecell) CustomizingtheFocusIndicatorforaCell

    selections CustomizingUserSelectionandDeselectionofData

    activesheet WorkingwiththeActiveSheet

    Using Smart Tags Drop-Down

    Youcanperformanyofseveraltasks,launchvariouseditors,andsetvariouspropertiesfromthesmarttagsdrop-downavailablefromtheSpreadcomponentonaForminVisualStudio.NET.Thesmarttagisthearrowiconatthetop,rightedgeofthecontrol.TheSpreadtasksavailableinthesmarttagsaresummarizedbelow.

    Spread Windows Forms Developer’s Guide 32

    Copyright © GrapeCity, Inc. All rights reserved.

  • Task ExplanationorReferenceChooseDataSource RefertoManagingDataBinding.

    EditSheets RefertoCustomizingtheIndividualSheetAppearanceandCustomizingSheetInteraction.

    EditCells RefertoCustomizingtheAppearanceofaCellandCustomizingInteractioninCells.

    ComponentName ThisisthenameoftheSpreadcomponent.

    OperationMode RefertoSpecifyingWhattheUserCanSelect.

    UserOptionsEditModePermanent

    RefertoAllowingtheUsertoMoveRowsorColumns,AllowingtheUsertoZoomtheDisplayoftheComponent,FillingCellswithDragandDrop,

    Spread Windows Forms Developer’s Guide 33

    Copyright © GrapeCity, Inc. All rights reserved.

  • EditModeReplaceAllowColumnMoveAllowRowMoveAllowUserZoomAllowDragDropAllowDragFillAllowUserFormulas

    FillingCellswithDragandFill,AllowingtheUsertoEnterFormulas,andUnderstandingEditModeinaCell.

    AutoClipboard Thisallowstheshortcutkeystowork.

    ClipboardOptions Thisdetermineswhatcanbecopiedandpasted.

    VisualStyles Whethertoallowthevisualstyles.

    EditSheetSkins Thiscanbeusedtoeditsheetskins.

    EditNamedStyles Thiscanbeusedtoeditnamedstyles.

    SpreadDesigner Thiscanbeusedtobringupthedesigner.

    QuickStartWizard Thiscanbeusedtobringupthewizard.RefertoUnderstandingtheSpreadWizard.

    AutoLaunchSpreadDesigner Thiscanbeuncheckedtopreventtheautolaunchofthedesigner.

    DockinginParentContainer Thissetsthedockingtofill.

    ProductVersion Versionoftheproduct.

    Thesheettasksavailableinthesmarttagaresummarizedbelow.

    Tasks DescriptionEditCells

    ThisopenstheCellEditorandallowsyoutoeditvariouspropertiesoftheselectedcellorcellsofasheet.Formoreinformationonsettingcellproperties,refertoCustomizingtheAppearanceofaCell.

    ResetSheet

    Thisrestoresallthesettingsoftheselectedsheettotheirdefaultvalues.Formoreinformationonresettingproperties,refertoResettingPartsoftheInterface.

    EditSkins

    ThisopenstheSpreadSkinEditorandallowsyoutoeditvariouspropertiesoftheskinthatapplytothespreadsheet.Formoreinformationonmanagingskins,refertoCreatingaCustomSkinforaComponentandApplyingaSkintotheComponent.

    EditCharts

    ThisopenstheSpreadChartCollectionEditor.Formoreinformation,refertoSpreadChartCollectionEditor(on-linedocumentation).

    Using Verbs in the Properties Window

    YoucanlaunchvariouseditorsorresetvaluesfromtheverbsinthepropertywindowinVisualStudio.NETasaquickwayofhandlingsomesettings.Therearedifferentverbsavailabledependingontheitemselected.

    Right-clickonthePropertieswindowandselectCommandstoseetheverbs.

    Spread Windows Forms Developer’s Guide 34

    Copyright © GrapeCity, Inc. All rights reserved.

  • ThefollowingimagedisplaysSpreadverbs.

    ThefollowingtablesummarizestheSpreadcomponentverbs:

    Verb DescriptionSpreadDesigner

    ThisopenstheSpreadDesignerandallowsyoutoeditvariouspropertiesofmostofthespreadsheetanditspartsaswellastheoverallcomponent.FormoreinformationontheuseoftheSpreadDesigner,refertoSpreadDesignerGuide(on-linedocumentation).

    ResetControl

    ThisrestoresallthesettingsfortheSpreadcomponenttotheirdefaultvalues.Formoreinformationonresettingproperties,refertoResettingPartsoftheInterface.

    EditSkins

    ThisopenstheSpreadSkinEditorandallowsyoutoeditvariouspropertiesoftheskinthatapplytothespreadsheet.Formoreinformationonmanagingskins,refertoCreatingaCustomSkinfora

    Spread Windows Forms Developer’s Guide 35

    Copyright © GrapeCity, Inc. All rights reserved.

  • ComponentandApplyingaSkintotheComponent.

    Thefollowingimagedisplaysthesheetverbs.

    Thefollowingtablesummarizesthesheetverbs:

    Verbs DescriptionEditCells

    ThisopenstheCellEditorandallowsyoutoeditvariouspropertiesoftheselectedcellorcellsofasheet.Formoreinformationonsettingcellproperties,refertoCustomizingtheAppearanceofaCell.

    ResetSheet

    Thisrestoresallthesettingsoftheselectedsheettotheirdefaultvalues.Formoreinformationonresettingproperties,refertoResettingPartsoftheInterface.

    EditSkins

    ThisopenstheSpreadSkinEditorandallowsyoutoeditvariouspropertiesoftheskinthatapplytothespreadsheet.Formoreinformationonmanagingskins,refertoCreatingaCustomSkinforaComponentandApplyingaSkintotheComponent.

    EditCharts

    ThisopenstheSpreadChartCollectionEditor.Formoreinformation,refertoSpreadChartCollectionEditor(on-linedocumentation).

    Working with Collection Editors

    SeveralpropertiesthatappearinthePropertieswindowareassociatedwithcollections.Toviewandmodifythesesettings,clickontheBrowsebutton(...)andaseparateCollectionEditorwindowappears.ThisisthecasefortheNamedStyles('NamedStylesProperty'intheon-linedocumentation)propertyandtheSheets('SheetsProperty'intheon-linedocumentation)propertyintheSpreadcomponent.

    Spread Windows Forms Developer’s Guide 36

    Copyright © GrapeCity, Inc. All rights reserved.

  • Withthesecollectioneditors,youmustclickOKtoseetheresultsofachangetoasetting.(ThecollectioneditorsrelyonpartoftheMicrosoft.NETframeworkanddonothaveanApplybutton.)

    Adding Support for High DPI Settings

    SpreadsupportshighDPIsettingsprovidedthattheapplicationhashighDPIsupportenabled.

    RefertoMicrosoft'swebsiteformoreinformationaboutenablingDPIsupportforyourapplication.

    EnablingDPIsupportin.NET4.5.2

    YoucanrefertothefollowingstepsforageneralexampleofhowtoenableDPIsupportin.NET4.5.2.

    1. UsetheWindowsAPIwiththefollowingcode.

    Codestatic class Program{ /// /// The main entry point for the application. /// [STAThread] static void Main() { SetProcessDPIAware(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } [System.Runtime.InteropServices.DllImport("user32.dll")] public extern static IntPtr SetProcessDPIAware();}

    Note:TheSetProcessDPIAwareAPImustbecalledbeforeanywindowiscreated;otherwise,awindowcreatedbeforeusingthisAPIwillhavethewrongsizeandfont.

    2. AddSpreadcode:

    Code//add code in InitializeComponent() of cs filethis.fpSpread1.SpreadScaleMode = FarPoint.Win.Spread.ScaleMode.ZoomDpiSupport;this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;

    Spread Windows Forms Developer’s Guide 37

    Copyright © GrapeCity, Inc. All rights reserved.

  • 3. EnableWindowsFormsHighDPIsupportbyaddingcodetotheApp.config.

    Code

    EnablingHDPIfor.NETFramework4.7

    UsethefollowingstepstoenableDPIsupport.

    1. Installthe.NET4.7Framework.2. Createanewwindowsformsapplication.3. AddanApp.configwiththefollowinginformationtotherootdirectoryoftheform(samedirectoryas

    Program.cs).

    Code

    4. AddanApp.manifestwiththefollowinginformationtotherootdirectoryoftheform(samedirectoryasProgram.cs).

    Code

  • Specifying requestedExecutionLevel element will disable file and registry virtualization. Remove this element if your application requires this virtualization for backwards compatibility. -->

    5. VerifythatProgram.cshasthefollowingsettings.

    Codestatic class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } }

    6. CheckthatForm1.designer.cshasthefollowingsettings.

    Codethis.fpSpread1.SpreadScaleMode = FarPoint.Win.Spread.ScaleMode.ZoomDpiSupport;this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;

    Spread Windows Forms Developer’s Guide 39

    Copyright © GrapeCity, Inc. All rights reserved.

  • Understanding the Spread Wizard

    YoucanusetheSpreadWizardtoquicklyandeasilybinddata,setupthecolumnstructure,andcustomizetheappearanceofaspreadsheet.Seethefollowingtopicsformoreinformation:

    StartingtheSpreadWizardUsingtheSpreadWizard

    Starting the Spread Wizard

    YoucanlaunchtheSpreadWizardfromtheSmartTagsontheFpSpreadcomponentontheforminVisualStudioasshowninthisfigure.Thesmarttagisthearrowiconatthetop,rightedgeofthecontrol.

    Using the Spread Wizard

    YoucanusetheSpreadWizardtobindtoadatasource,setcolumnproperties,settheoperationmode,specifytitles,selectaskin,andperformmanyothertasks.

    Spread Windows Forms Developer’s Guide 40

    Copyright © GrapeCity, Inc. All rights reserved.

  • Selectthemenuoptionofthefeatureyouwishtocustomize,locatedontheleftsideofthedialog.SelectthevariousoptionsforthatfeatureandthenclickNexttogotothenextstep.Whenyouarefinished,clickFinish.

    Getting More Practice

    IfyouneedmoretipsaboutcustomizingSpreadandtakingadvantageofitsmanyfeatures,wehaveprovidedtheseadditionalsourcesofinformationtohelpyougetstarted.

    FindingtheDocumentationGettingTechnicalSupport

    Finding the Documentation

    ThereareseveraldifferentwaystoaccomplishthesameresultwhencreatingaWindowsFormspagewithaSpreadcomponent.Inthisdocumentation,theproceduresoftendescribemorethanoneway,includingusingthePropertieswindowinVisualStudio.NET,writingcodeincludingusingshortcutobjects,andusingtheSpreadDesigner.TheSpreadDesignersetspropertiesandcallsmethodsfortheSpreadcomponent,includingpropertiesnotavailableatdesigntimethroughVisualStudio.NET,withoutproducinganyeditablecode.

    Spread Windows Forms Developer’s Guide 41

    Copyright © GrapeCity, Inc. All rights reserved.

  • Eachofthesehasitsadvantagesanddisadvantages.Usingshortcutobjectsistheshortest,quickestwayofaddingcodeusingdotnotationandsettingapropertyofashortcutobject.Usingcodewithoutusingshortcutobjectsgenerallymeansdeclaringobjectsandsettingpropertiesforthem.

    DocumentationProvided

    TheSpreadWindowsFormsdocumentationprovidesintroductoryinformationabouttheproduct,conceptualinformation,how-totopics,andadetailedassemblyandformulafunctionreferenceinahelpfileandinPDFfiles.AdditionalinformationisprovidedintheReadmefile.

    AccessingtheHelp

    YoucanaccessthehelpthroughF1supportprovidedinVisualStudioNET.WhiletheSpreadcomponentoroneofitsmembershasfocus,pressF1todisplaytheSpreadWindowsFormshelp.

    Youcanalsoaccessthehelpfileinastand-alonewindowbychoosingPrograms‑>GrapeCity‑>...->ProductNameandthenselectingthehelp.

    DocumentationConventions

    TheformatofthehelpissimilartothehelpprovidedforVisualStudio.NET.Referencematerialformembersprovidesmultiplelanguagereferenceforthemember.Youcanchangewhichlanguage'ssyntaxisdisplayedbyclickingtheLanguagesbuttoninthetitleofthetopic.

    ListofHow-To’s

    HereisalistoftheHowTo’s:

    AddingaNotetoaCellAddingaRoworColumnAddingaSheetAllowingtheUsertoEnterFormulasAllowingtheUsertoAutomaticallySortRowsAllowingtheUsertoPerformaStandardSearchApplyingaSkintoaSheetCreatingaCustomSkinforaSheetCreatingandUsingaCustomFunctionCreatingandUsingaCustomNameCreatingAlternatingRowsandColumnsCustomizingtheOutlineoftheComponentCustomizingtheInputMapsCustomizingtheScrollBarsoftheComponentCustomizingSplitBoxesCustomizingtheDimensionsoftheComponentCustomizingtheNumberofRowsorColumnsCustomizingViewportsCustomizingtheSelectionAppearanceCustomizingtheSheetCornerAppearanceDisplayingGridLinesonaSheetCustomizingtheSheetNameTabsoftheComponentDisplayingTextTipsinaCellLockingaCell

    Spread Windows Forms Developer’s Guide 42

    Copyright © GrapeCity, Inc. All rights reserved.

  • NestingFunctionsinaFormulaOpeningExistingFilesOptimizingthePrintingUsingRulesUsingAutomaticSortingPlacingaFormulainCellsPlacingChildControlsonaSheetPrintinganEntireSheetPrintingParticularPagesPrintingaRangeofCellsonaSheetPrintinganEntireSheetProvidingaPreviewofthePrintingRemovingaRoworColumnRemovingaSheetSavingDatatoaFileSearchingforDatawithCodeSettingtheBackgroundColorsforaSheetSettingtheRowHeightorColumnWidthSortingRows,Columns,orRangesSpecifyingaCellReferenceinaFormulaSpecifyingWhattheUserCanSelectUsingaCircularReferenceinaFormulaUsingDragOperationstoFillCellsWorkingwithEditableCellTypesWorkingwithGraphicalCellTypesWorkingwithSelections

    Getting Technical Support

    Ifyouhaveatechnicalquestionaboutthisproduct,consultthefollowingsources:

    Helpandotherdocumentationfilesinstalledwiththeproduct.Forinstructionsforaccessingthehelpandotherdocumentation,seeFindingtheDocumentation.Productforumathttps://www.grapecity.com/forums#spread

    Ifyoucannotfindtheanswerusingthesesources,pleasecontactTechnicalSupportusingoneofthesemethods:

    Website: https://www.grapecity.com/forums

    E-mail: spread.support@grapecity.com

    Fax: (412)681-4384

    Phone (412)681-4738

    TechnicalSupportisavailablebetweenthehoursof9:00a.m.and5:00p.m.Easterntime,MondaythroughFriday.

    Tutorial: Creating a Checkbook Register

    ThefollowingtutorialwalksyouthroughcreatingaprojectinVisualStudio.NETusingtheSpreadWindowsFormscomponent.Bycreatingacheckbookregister,youwilllearnhowtomodifytheappearanceofaspreadsheet,workwithcelltypes,andaddsomeformulasforperformingcalculations.

    Inthistutorial,themajorstepsare:

    Spread Windows Forms Developer’s Guide 43

    Copyright © GrapeCity, Inc. All rights reserved.

    https://www.grapecity.com/forums#spreadhttps://www.grapecity.com/forumsmailto:spread.support@grapecity.com

  • AddingSpreadtotheCheckbookProjectSettingUptheRowsandColumnsoftheRegisterSettingtheCellTypesoftheRegisterAddingFormulastoCalculateBalances

    Adding Spread to the Checkbook Project

    UsethefollowingstepstoaddSpreadtotheproject.

    1. StartanewVisualStudio.NETproject.

    2. Nametheprojectcheckbook.Nametheformintheprojectregister.

    3. AddtheFpSpreadcomponenttoyourproject,andthenplacethecontrolontheform.

    IfyoudonotknowhowtoaddtheFpSpreadcomponenttotheproject,completethestepsinAddingaComponenttoaProject(on-linedocumentation).

    GotoSettingUptheRowsandColumnsoftheRegistertocontinuethetutorial.

    Setting Up the Rows and Columns of the Register

    TheSpreadcontrolonyourformalreadyhasasheet,readyforyoutoconfigure.Inthisstep,youaregoingtosetupthecolumnsandcellsinthesheettoresembleacheckbookregister.

    UsingCode

    1. Double-clickontheforminyourprojecttoopenthecodewindow.2. IntheFormLoadevent,typethefollowingcode:

    Thiscodesetsupthecontroltobe300pixelshighand763pixelswide,andthesheettohave8columnsand100rows.

    Example

    C#// Set up control and rows and columns in sheet.fpSpread1.Height = 330;fpSpread1.Width = 765;fpSpread1.Sheets[0].ColumnCount = 8;fpSpread1.Sheets[0].RowCount = 100;

    VB' Set up control and rows and columns in sheet.fpSpread1.Height = 330fpSpread1.Width = 765fpSpread1.Sheets(0).ColumnCount = 8fpSpread1.Sheets(0).RowCount = 100

    3. Nextsetupthecolumnstoaddcustomheadings.AddthefollowingcodebelowthecodeyouaddedinStep2:

    Example

    C#

    Spread Windows Forms Developer’s Guide 44

    Copyright © GrapeCity, Inc. All rights reserved.

  • // Add text to column heading.fpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text = "Check #";fpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text = "Date";fpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Description";fpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text = "Tax?";fpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Text = "Cleared?";fpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Text = "Debit";fpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Text = "Credit";fpSpread1.Sheets[0].ColumnHeader.Cells[0, 7].Text = "Balance";

    VB' Add text to column heading.fpSpread1.Sheets(0).ColumnHeader.Cells(0, 0).Text = "Check #"fpSpread1.Sheets(0).ColumnHeader.Cells(0, 1).Text = "Date"fpSpread1.Sheets(0).ColumnHeader.Cells(0, 2).Text = "Description"fpSpread1.Sheets(0).ColumnHeader.Cells(0, 3).Text = "Tax?"fpSpread1.Sheets(0).ColumnHeader.Cells(0, 4).Text = "Cleared?"fpSpread1.Sheets(0).ColumnHeader.Cells(0, 5).Text = "Debit"fpSpread1.Sheets(0).ColumnHeader.Cells(0, 6).Text = "Credit"fpSpread1.Sheets(0).ColumnHeader.Cells(0, 7).Text = "Balance"

    4. Nowsetupthecolumnwidthstoproperlydisplaytheheadingsandthedatayouwilladd.AddthefollowingcodebelowthecodeyouaddedinStep3:

    Example

    C#// Set column widths.fpSpread1.Sheets[0].Columns[0].Width = 50;fpSpread1.Sheets[0].Columns[1].Width = 50;fpSpread1.Sheets[0].Columns[2].Width = 175;fpSpread1.Sheets[0].Columns[3].Width = 40;fpSpread1.Sheets[0].Columns[4].Width = 65;fpSpread1.Sheets[0].Columns[5].Width = 100;fpSpread1.Sheets[0].Columns[6].Width = 100;fpSpread1.Sheets[0].Columns[7].Width = 125;

    VB' Set column widths.fpSpread1.Sheets(0).Columns(0).Width = 50fpSpread1.Sheets(0).Columns(1).Width = 50fpSpread1.Sheets(0).Columns(2).Width = 175fpSpread1.Sheets(0).Columns(3).Width = 40fpSpread1.Sheets(0).Columns(4).Width = 65fpSpread1.Sheets(0).Columns(5).Width = 100fpSpread1.Sheets(0).Columns(6).Width = 100fpSpread1.Sheets(0).Columns(7).Width = 125

    5. Saveyourproject,thenclicktheStartbuttoninthetoolbartorunyourproject.6. Yourformshouldlooksimilartothefollowingpicture.

    Spread Windows Forms Developer’s Guide 45

    Copyright © GrapeCity, Inc. All rights reserved.

  • GotoSettingtheCellTypesoftheRegistertocontinuethetutorial.

    Setting the Cell Types of the Register

    Tosetcelltypes,foreachcustomcelltype,youhavetocreateacelltypeobject,setthepropertiesforit,andthenassignthatobjecttotheCellType('CellTypeProperty'intheon-linedocumentation)propertyforacellorrangeofcells.

    1. SetthecelltypefortheCheck#columnbyaddingthefollowingcodebelowthecodeyouhavealreadyadded:

    Example

    C#// Create Check # column of number cells.FarPoint.Win.Spread.CellType.NumberCellType objNumCell = new FarPoint.Win.Spread.CellType.NumberCellType();objNumCell.DecimalPlaces = 0;objNumCell.MinimumValue = 1;objNumCell.MaximumValue = 9999;objNumCell.ShowSeparator = false;fpSpread1.Sheets[0].Columns[0].CellType = objNumCell;

    VB' Create Check # column of number cells.Dim objNumCell As New FarPoint.Win.Spread.CellType.NumberCellType()objNumCell.DecimalPlaces = 0objNumCell.MinimumValue = 1objNumCell.MaximumValue = 9999objNumCell.ShowSeparator = FalsefpSpread1.Sheets(0).Columns(0).CellType = objNumCell

    2. SetthecelltypefortheDatecolumnbyaddingthefollowingcodebelowthecodeyouhavealreadyadded:

    Example

    Spread Windows Forms Developer’s Guide 46

    Copyright © GrapeCity, Inc. All rights reserved.

  • C#// Create Date column of date-time cells.FarPoint.Win.Spread.CellType.DateTimeCellType objDateCell = new FarPoint.Win.Spread.CellType.DateTimeCellType();objDateCell.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate;fpSpread1.Sheets[0].Columns[1].CellType = objDateCell;

    VB' Create Date column of date-time cells.Dim objDateCell As New FarPoint.Win.Spread.CellType.DateTimeCellType()objDateCell.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDatefpSpread1.Sheets(0).Columns(1).CellType = objDateCell

    3. SetthecelltypefortheDescriptioncolumnbyaddingthefollowingcodebelowthecodeyouhavealreadyadded:

    Example

    C#// Create Description column of text cells.FarPoint.Win.Spread.CellType.TextCellType objTextCell = new FarPoint.Win.Spread.CellType.TextCellType();objTextCell.MaxLength = 100;fpSpread1.Sheets[0].Columns[2].CellType = objTextCell;

    VB' Create Description column of text cells.Dim objTextCell As New FarPoint.Win.Spread.CellType.TextCellType()objTextCell.MaxLength = 100fpSpread1.Sheets(0).Columns(2).CellType = objTextCell

    4. SetthecelltypefortheTax?andCleared?columnsbyaddingthefollowingcodebelowthecodeyouhavealreadyadded:

    Example

    C#/// Create Tax? and Cleared? columns of check box cells.FarPoint.Win.Spread.CellType.CheckBoxCellType objCheckCell = new FarPoint.Win.Spread.CellType.CheckBoxCellType();objCheckCell.ThreeState = false;fpSpread1.Sheets[0].Columns[3].CellType = objCheckCell;fpSpread1.Sheets[0].Columns[4].CellType = objCheckCell;

    VB' Create Tax? and Cleared? columns of check box cells.Dim objCheckCell As New FarPoint.Win.Spread.CellType.CheckBoxCellType()objCheckCell.ThreeState = FalsefpSpread1.Sheets(0).Columns(3).CellType = objCheckCellfpSpread1.Sheets(0).Columns(4).CellType = objCheckCell

    Spread Windows Forms Developer’s Guide 47

    Copyright © GrapeCity, Inc. All rights reserved.

  • 5. SetthecelltypefortheDebit,Credit,andBalancecolumnsbyaddingthefollowingcodebelowthecodeyouhavealreadyadded:

    Example

    C#// Create the Debit, Credit, and Balance columns of currency cells.FarPoint.Win.Spread.CellType.CurrencyCellType objCurrCell = new FarPoint.Win.Spread.CellType.CurrencyCellType();objCurrCell.LeadingZero = FarPoint.Win.Spread.CellType.LeadingZero.Yes;objCurrCell.NegativeRed = true;objCurrCell.FixedPoint = true;fpSpread1.Sheets[0].Columns[5].CellType = objCurrCell;fpSpread1.Sheets[0].Columns[6].CellType = objCurrCell;fpSpread1.Sheets[0].Columns[7].CellType = objCurrCell;

    VB' Create the Debit, Credit, and Balance columns of currency cells.Dim objCurrCell As New FarPoint.Win.Spread.CellType.CurrencyCellType()objCurrCell.LeadingZero = FarPoint.Win.Spread.CellType.LeadingZero.YesobjCurrCell.NegativeRed = TrueobjCurrCell.FixedPoint = TruefpSpread1.Sheets(0).Columns(5).CellType = objCurrCellfpSpread1.Sheets(0).Columns(6).CellType = objCurrCellfpSpread1.Sheets(0).Columns(7).CellType = objCurrCell

    6. Saveyourproject,thenclicktheStartbuttoninthetoolbartorunyourproject.7. Yourformshouldlooksimilartothefollowingpicture.

    GotoAddingFormulastoCalculateBalancestocontinuethetutorial.

    Adding Formulas to Calculate Balances

    Spread Windows Forms Developer’s Guide 48

    Copyright © GrapeCity, Inc. All rights reserved.

  • Yourcheckbookregisterisnowsetuptolooklikeacheckbookregister;however,itdoesnotbalancethecurrencyfiguresyouenterintheregister.Thisstepsetsuptheformulaforbalancingthefigures.

    1. ProvidethefollowingcodeintheFormLoadeventafterthecodeyouhavealreadyadded:

    Example

    C#// Set formula for calculating balance.fpSpread1.Sheets[0].ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1;int i;for (i = 0; i

  • Understanding the Product

    SpreadWindowsFormsprovidesacustomizable,extendable,andobject-orientedspreadsheetcomponentforuseintheMicrosoftNETframework.SpreadWindowsFormsalsoprovidesExcelsupportandcustomizationdowntothecelllevel,withacapableuser-interfacedesignandback-endcalculationefficiency.Thefollowingsectionsexplainsomeoftheunderlyingconceptsforthisuniqueandpowerfulproduct.

    ProductOverviewFeatureOverviewNamespacesOverviewConceptsOverview

    Product Overview

    SpreadWindowsFormsisacomprehensivespreadsheetcomponentforWindowsFormsapplicationsthatcombinesgridcapabilities,spreadsheetfunctionality,andincludestheabilitytobindtodatasources.AsingleSpreadcomponentsupportsmanysheets,rows,andcolumns.Cross-sheetreferencingallowscalculationstomakeuseofdataandformulasonavarietyofsheets.SpreadWindowsFormsusesdotnotationforobject-orientedcodingin.NET.

    TheSpreadcomponentmaybedroppedonaWindowsFormandcustomizedforarangeofapplications.Youcancustomizetheappearanceandtheuserinteractioninavarietyofways.Withabuilt-inDesigner,youcanquicklycreateaprototypeorcustomizeyourfinisheddesign.WithmostoftheSpread’sappearanceandfunctionalitybasedonunderlyingmodels,theadvanceddeveloperhascompletecontroloverthecomponent.FordetailsontheSpreadDesigner,refertoSpreadDesignerGuide(on-linedocumentation).

    Importandexportcapabilitiesprovideanothersourceofflexibilitywhendevelopingandexchangingdesigns.SpreadWindowsFormscanhandledatafromcomma-delimitedtextfilesaswellasmultiplespreadsheetsfromMicrosoftExcelfiles.ThecontentsofasheetmaybesavedasaBIFF8ortextfilecompatiblewithMicrosoftExcelorasaSpreadXMLfile.Formoreinformationonexportingto(andimportingfrom)afile,refertotheImportandExportReference(on-linedocumentation).

    ThefollowingfigureprovidesaconceptualoverviewofSpreadWindowsForms.

    Spread Windows Forms Developer’s Guide 50

    Copyright © GrapeCity, Inc. All rights reserved.

  • InSpread,youcanusethedefaultmodelsorextendthemthroughinheritance.Formoreinformationonmodels,refertoUnderlyingModels.

    Stylesforcellsandskinsforsheetsprovidewaystosavecustomizedappearancesthatcanbeappliedtoothergroupsofcellsoranentiresheet.Formoreinformationonstylesforcells,refertoCreatingandApplyingaStyleforCells.Formoreinformationonskinsforsheets,refertoCreatingaCustomSkinforaSheet.

    Formoreinformationaboutshapes,refertoCustomizingDrawing.

    Formoreinformationontheformulasandfunctionsthatcanbeenteredinacell,refertotheManagingFormulasinCells.

    Formoreinformationonthepartsoftheinterface,refertoUnderstandingPartsoftheComponent.

    Foralistofmanyofthefeatures,seeFeatureOverview.

    Feature Overview

    SpreadWindowsFormsintroducessomepowerfulfeatures,asdescribedinthefollowingtopics.Eachtopicreferstoothertopicsinthedocumentationthatprovidemoreinformation.

    CameraShapesCellTypesforCellFunctionality

    Spread Windows Forms Developer’s Guide 51

    Copyright © GrapeCity, Inc. All rights reserved.

  • ChartControlsonaSheetChildControlsonaSheetColumnFootersandGroupFootersConditionalFormattingCutorCopyCellRangesandShapesDataBindingExcelSupportwithImportandExportCapabilitiesExternalVariableFilteringDataonaSheetFormulaTextBox(FormulaBar)FormulaProviderControlFunctionsandFormulasGradientsforButtonCells,Headers,andMoreGroupingRowsintheDisplayGroupingRowsorColumnsinanOutlineHeaderswithMultipleColumnsandRowsHierarchicalDisplayHitTestforLocatingtheCursorIndicatorsandIconsintheInterfaceInkNotationSupportKeyboardActionMappingMultipleSheetsNameBoxControlNotesforCellsPanesorViewportsPrintingandPDFQuickStartWizardRight-To-LeftLayoutsRowPreviewSearchingandSearchDialogShapes,Drawings,andAnnotations(FreehandDrawing)SkinsandStylesforCustomizedAppearanceSortingRowsorColumnsSpannableCellsSparklinesSpreadDesignerStatusBarTablesTabStripandSheetNameTabsTextRenderingwithGDITitleandSubTitleTouchSupportUndoandRedoActionsValidationVisualStylesforXPThemesWorkingWithShapes(EnhancedShapeEngine)

    Spread Windows Forms Developer’s Guide 52

    Copyright © GrapeCity, Inc. All rights reserved.

  • Camera Shapes

    Youcanaddcamerashapestothesheet.Camerashapesarecreatedbytakingasnapshotofthecontentinarangeofcells.Changesinthecellrangewillupdatethecontentofthecamerashape.

    Formoreinformation,refertoCreatingCameraShapes.

    Cell Types for Cell Functionality

    Youcanusethefeature-richsetofcelltypesorextendthefunctionalitybydefiningyourown.Useanyofthemorethan20pre-definedcelltypesorcreateyourowntodeterminewhatkindofdatacanbeenteredintoacell,avoidingunnecessarychecksandvalidationsbythedeveloper,andprovidinganaturalwayforyourusertoenterdata.

    Youcansetbarcodecelltypesfordisplayingbarcodes,fractionsincellsusingthepropertiesaddedtothenumbercelltype,andallowyouruserstoselectacolorfromacolorpickercell.

    GcDateTime,GcNumber,GcTextBox,andothercelltypesarenowavailableinadditiontothestandardSpreaddate-time,number,andtextcells.

    Formoreinformationaboutcelltypes,refertoCustomizingInteractionwithCellTypes.

    Chart Controls on a Sheet

    Youcanaddchartcontrolstoasheet.Therearemanydifferenttypesandviewsofchartsthatyoucancreate.YoucanusetheChartDesigner,SpreadDesigner,orcodetoaddachartcontrol.

    Formoreinformation,refertoUsingtheChartControl.

    Child Controls on a Sheet

    Youcanhostchildcontrolsonasheettoprovidemoreinteractionwiththeuser.

    Formoreinformation,refertoPlacingChildControlsonaSheet.

    Column Footers and Group Footers

    Youcanaddcolumnandgroupfooterstothesheet.Youcanputinformationinthefootersuchasformulasortext.

    Formoreinformation,refertoDisplayingaFooterforColumnsorGroups.

    Conditional Formatting

    Youcansetupconditionalformatswithincellsthatdeterminetheformattingofthecellbasedontheoutcomeofaconditionaloperation.Youcanuserulesorcomparisonoperatorsintheconditionalformat.

    Formoreinformation,refertoUsingConditionalFormattingofCells.

    Cut or Copy Cell Ranges and Shapes

    SpreadforWinformsprovidesuserswiththeabilitytocutorcopyacellorarangeofcellsandshapesfromaspecificareaandpasteitintoanotherareawithinthesameworksheetoradifferentworksheet.

    Whileperformingthecutorcopyoperationsinthespreadsheet,afteruserspressthekeyboardshortcut"Ctrl+C",an

    Spread Windows Forms Developer’s Guide 53

    Copyright © GrapeCity, Inc. All rights reserved.

  • animationrectanglewillbedisplayedtoindicatethesourceofthecopiedcellrangejustlikeinExcel.

    Note:CopyingfromSpreadtoExcelisnotsupported.Inotherwords,copyingcellcontentandstylesfromExceltoSpreadcontrolissupportedbutuserscan'tcutorcopydatafromSpreadcontroltoExcel.

    EnableClipboardOperations

    Therichclipboardisnotenabledbydefaultandhencetherichclipboardoperations(likecut,copy,paste)cannotbedoneunlessusersmanuallyturnitonbyusingthefollowingcode:

    C#// Enable the rich clipboardfpSpread1.Features.RichClipboard = true;

    Note:Thefollowingpointsmustbekeptinmindwhileenablingtherichclipboardinthespreadsheet.

    TheRichClipboardworksinflatstylemodeonly.InordertoenableRichClipboard,usermustalsomakesurethatFpSpread.LegacyBehaviorsdoesn'tcontainLegacyBehaviors.Style.SinceExceldoesn'tsupportclipboardsettingsonsomefeaturesliketableorcolorscalesetc.,copyingsuchdatafromExcelisnotsupported.

    CutorCopyCellRangesandShapes

    Whilecopyingcellrangesinthespreadsheet,userscanstorecellvaluesastextorCVS.

    Whilecopyingshapesinthespreadsheet,userscancopyandpasteshapesbetweenSpreadandExcelalongwiththefollowingoperations:

    Userscanstoreimagesoftheshape.Userscanstoreshapedataas"Excel2007InternalShape"format(basedonXML).IfthesourceExcelapplicationisnotprovided,thentheanchorcellsoftheshapewillbeusedtobuildthenewshapeboundary.

    WorkingWithPasteOptions

    Afterexecutingthecutorcopyoperations,userscanchoosefrommultiplepasteoptionsandalsocombinedifferentpasteoptionsjustlikeinExcel.

    Note:ThefollowingpointsmustbekeptinmindwhileworkingwithrangeoperationsinSpreadforWinforms:

    CopyingfromSpreadtoExcelisnotsupported.Thecutandcopyfeaturesupportsasinglerangeonly.Userscancopy/pasterangesthatcontainFreeFloatingshapes.Userscan'trepeatthevaluesonpastinglikeinExcel.EachSpreadcontrolwillhaveitsownUndoManager.Userscanundoanaction,whichisexecutedinthecurrentSpreadonly.ThecopyfeatureofExcelthatallowscustomizationofthecopieddefinednameisnotsupportedyet.

    Data Binding

    WithSpreadWindowsForms,youhavemanydatabindingoptions.

    Spread Windows Forms Developer’s Guide 54

    Copyright © GrapeCity, Inc. All rights reserved.

  • Youcanbindthespreadsheettoadatasettodisplayandallowyouruserstoeditinformation.Spreadcanautomaticallyupdatethedatasetwiththechanges.

    Youcanalsoallowpartofyourspreadsheettobeunbound.Youcanalsobindtoarangeofcells.

    Formoreinformation,refertoManagingDataBinding.

    Excel Support with Import and Export Capabilities

    Youcanimportdatafromandexportdata(andformatting)toMicrosoftExcel,bothinindividualspreadsheetsandentireworkbooks.Youcanimportandexportentirespreadsheet(s)withdataandformattingtoandfromXML.SeveralversionsofExcelaresupportedandseveralfiletypes,includingXLS,XLSX,CSV,andTXT.

    Formoredetailsaboutwhathappensduringimportingorexporting,refertotheImportandExportReference(on-linedocumentation).

    Formoreinformationaboutsavingandloadingfiles,refertoSavingDatatoaFileandOpeningExistingFiles.

    External Variable

    Youcandefineexternalvariablesinaworkbookandusethemanywhereinthespreadsheetasandwhenrequired.

    Formoreinformation,refertoCreatingandUsingaExternalVariable.

    Filtering Data on a Sheet

    Youcancustomizetheuserexperienceforfilteringdataonasheet.Withrowfiltering,youcanallowtheusertofilterthedataincolumnsonasheetanddisplayonlytherowsofdatawhichmeetcriteriafromadrop-downlistorchangetheappearanceofrowsbasedonthatfiltering.

    Formoreinformation,refertoManagingFilteringofRowsofUserData.

    Formula Text Box (Formula Bar)

    Youcanaddaformulatextboxforeditingformulas.Theformulatextboxissimilartotheformulaeditoravailabletothedeveloperandhastheappearanceofatextbox.Theformulabarprovidesalistofcalculationfunctionsandprovidesavisualmethodofselectingcellrangesfortheformula.

    Formoreinformation,refertoUsingtheAdditionalSpreadControls.

    Formula Provider Control

    Youcanaddaformulaprovidercontroltotheformthatwillprovideformulasforothercontrolsontheform.

    Formoreinformation,refertoUsingtheAdditionalSpreadControls.

    Functions and Formulas

    Youcanusebuilt-infunctionsandoperatorstodevelopformulasandperformcalculations.Addcalculationsquicklytoyourapplicationsbyusinganyofthe450+pre-definedfunctionsoraddyourowncustomfunctions.Choosefromanyofthesetypesoffunctions:

    DatabaseDateandTime

    Spread Windows Forms Developer’s Guide 55

    Copyright © GrapeCity, Inc. All rights reserved.

  • EngineeringFinancialInformationLogicLookupandReferenceMathandTrigonometryStatisticsTextVolatile

    Spreadalsooffersafloatingformulabarthatyoucanprovidetoyourenduserstoallowthemtopickfunctions.

    Youcanalsocreatecustomformulasorcustomnamestouseinformulas.RefertoCreatingandUsingaCustomFunctionandCreatingandUsingaCustomNameformoreinformation.

    FormoreinformationonenteringformulasusingtheSpreadDesigner,refertotheSpreadDesignerGuide(on-linedocumentation).

    Formoreinformationonformulasingeneral,refertoManagingFormulasinCellsandtotheFormulaReference.

    Gradients for Button Cells, Headers, and More

    Youcansetgradientsforbuttoncellsandheaders.

    Formoreinformationsee,AddingaGradienttoHeaderCells.

    Formoreinformationsee,SettingaButtonCell.

    Grouping Rows in the Display

    Youcansetupthespreadsheettogiveuserstheabilitytogrouprowsofdatabasedonaparticularcolumnnamebydraggingthecolumnheadertothegroupingbar.Thisisusefulfordisplayinglargeamountsofdatainorganizedgroupsandorganizingrowsbasedonthecategoryofacolumn.ThisissometimesreferredtoasOutlook-stylegrouping.

    Formoreinformationaboutoutlinessee,ManagingGroupingofRowsofUserData.

    Grouping Rows or Columns in an Outline

    Youcansetupthespreadsheettogiveuserstheabilitytoformarangeofexpandableandcollapsiblerowsorcolumns.Thisisusefulforhandlingrowsorcolumnsofdatathatdonotneedtobevisibleallthetimebutarerelatedtoadjacentrowsorcolumns.ThisissometimesreferredtoasrangegroupingorExcel-likegroupingoroutlines.

    Formoreinformationaboutgroupingsee,ManagingOutlines(RangeGroups)ofRowsandColumns.

    Headers with Multiple Columns and Rows

    Youcanhavemultiplecolumnheadersandrowheaders.Youcanalsospanheadercells.Useheaderswithmultiplecolumnsorrowstoorganizeyourcolumnandrowinformation.

    Formoreinformationaboutheaders,refertoCreatingaHeaderwithMultipleRowsorColumns.

    Hierarchical Display

    Youcancreateasheetwithinarowtodisplayrelationaldatahierarchically,withparentrowsandchildviewsofrelated

    Spread Windows Forms Developer’s Guide 56

    Copyright © GrapeCity, Inc. All rights reserved.

    http://help.grapecity.com/spread/SpreadNet12/FR/webframe.html

  • data.

    Formoreinformationabouthierarchicaldisplayofdata,refertoWorkingwithHierarchicalDataDisplay.

    HitTest for Locating the Cursor

    YoucanusetheHitTestmethodforfindingthelocationofthecursor(pointer)onthespreadsheetcomponenttohelpwithdevelopmentofapplicationswhereaccessibilityissuesareconcerned.

    FormoreinformationabouttheHitTestmethodofthespreadsheetcomponent,refertoLocatingthePointerUsingHitTest.

    Indicators and Icons in the Interface

    Youcancreatecustomrowfilteringindicatorsandcustomsortingindicatorstodisplayinthecolumnheader.Youcanalsocreatecustomimagesforthehierarchydisplayiconsforexpandingandcollapsingthehierarchy.

    Youcanalsomakeamarquee(animated)focusindicatoraswellasotherenhancedfocusindicators.

    Formoreinformation,refertoCustomizingtheUserInterfaceImages.

    Ink Notation Support

    YoucanusetheinknotationforwritingordrawingonSpreadwithyourTabletPC.Withasimplemethod,youcanturnonsupportforthisinkingfeature.

    FormoredetailsaboutinknotationandsupportfortheTabletPC,refertoAllowingtheUsertoDrawwithaTabletPC.

    Keyboard Action Mapping

    SpreadWindowsFormsprovidesmultiplewaystocustomizenavigationwithinthecomponent,includingkeyboardnavigationandactionkeys.Withinputmapsandactionmaps,youcandetermineactionsintheSpreadcomponentthatoccurwhentheuserpresseskeys.Adefaultmappingofkeysandrelatedactionsisprovided;however,youcancustomizethesemapsthatdefinethemappingofkeystoactions.Forexample,youcanmaptheEnterkeysothatthecomponentmovesthefocustothecellbelowthecurrentcell.

    YoucanloadanExcelcompatibilityinputactionmaporothermapfile.Youcanalsosaveaninputactionmaptoafile.

    Formoreinformationaboutnavigationkeys,inputmaps,andactionmaps,refertothedescriptionsinManagingKeyboardInteraction.

    Multiple Sheets

    SpreadWindowsFormssupportsmultiplesheetsinasinglecomponenteachuniquelynamed.Usemultiplesheetstocategorizeyourinformation,similartousingworksheetsinMicrosoftExcel.

    Sheetscanhavemanyrowsandcolumnsaswell.Youcandefinestylesforsheetsandapplythosestylesacrossmultiplesheets.

    Formoreinformationaboutsheets,refertoCustomizingtheSheetAppearanceandCustomizingSheetInteraction.

    Name Box Control

    Spread Windows Forms Developer’s Guide 57

    Copyright © GrapeCity, Inc. All rights reserved.

  • Thenameboxcontrolcanbeusedtocreateordisplaycustomnamesatruntime.

    Formoreinformation,refertoSettinguptheNameBox.

    Notes for Cells

    SpreadWindowsFormsallowscellstohavenotesattachedtoprovideadditionalinformationtousers.Thecellnotehasthefollowingfunctionality:

    automaticallysizescellnotesbasedoncontentsprintscellnotesprovidescustomizablelocationsforthecellnotesletsyoucustomizethenoteindicatorcolorprovidesstickynotesthatstaywheretheyareplaced

    Formoreinformation,refertoAddingaNotetoaCell.

    Panes or Viewports

    Youcanallowmorethanonepaneorviewportinthespreadsheettoallowyoutoviewdatafromdifferentpartsofthespreadsheetinonedisplay.Displaydatainmultipleviewportsandallowyourusertocustomizetheirownviewportviewbyprovidingsplitboxesalongwithscrollbars.

    Formoreinformationaboutscrollableviewportsandsplitbars,refertoCustomizingViewports.

    Printing and PDF

    Youcancustomizetheprintingofyourspreadsheetswithmanydifferentprintingoptions.Forexample,youcanhavecolorsandimagesinheadersandfooters.Formoreinformation,seeCustomizingtheAppearanceofthePrinting.

    Youcanprintpartsofthesheetasneeded.YoucanalsoprintafiletoaPortableDocumentFormat(PDF)file.Formoreinformation,seeSpecifyingWhattoPrint.

    TherearemanyeventsrelatedtoprintingincludingthePrintPreviewShowing('PrintPreviewShowingEvent'intheon-linedocumentation)event.Formoreinformation,refertoProvidingaPreviewofthePrinting.YoucanalsosetyourownPrintPreviewDialogwiththeSetPrintPreview('SetPrintPreviewMethod'intheon-linedocumentation)method.

    Quick Start Wizard

    Youcanusethewizardtoquicklysetupdatabindingandotherareasofthecontrol.

    Formoreinformation,refertoUnderstandingtheSpreadWizard.

    Right-To-Left Layouts

    Youcanhandlesupportforright-to-leftlayoutsintheSpreadcomponent.

    Formoreinformation,refertoHandlingRight-to-LeftLayouts.

    Row Preview

    Youcanaddapreviewrowthatcontainsextrainformationaboutarow.Thepreviewrowisdisplayedbelowtherowit

    Spread Windows Forms Developer’s Guide 58

    Copyright © GrapeCity, Inc. All rights reserved.

  • providesinformationfor.Youcanspecifycolorsandotherformattingforthepreviewrowaswell.

    Formoreinformation,refertoSettingupPreviewRows.

    Searching and Search Dialog

    Youcanperformsearchesincodeorprovideasearchdialogwithvariousoptionstoyouruser.

    Formoreinformation,refertoCustomizingUserSearchingofData.

    Shapes, Drawings, and Annotations (Freehand Drawing)

    Youcandrawshapesandcustomizedrawingobjectsontopofasheettohighlightpartsofthesheetorpointtheuserthroughtheuseofaform.

    Youcanallowtheusertodrawinfreehandonthesheetwithannotations.Thedrawingisdoneonthesamelayerasshapes.Thisabilityiscalledannotationmode.

    Formoreinformationaboutshapes,refertotheDesigningShapes(on-linedocumentation)andCustomizingDrawing.

    Skins and Styles for Customized Appearance

    EasilyandquicklyconfiguretheappearanceofSpreadusingpredefinedskinsorcreateandsaveyourowncustomskinsthatdefinemanyoftheappearancesettingsforasheet.Customskinscanbesharedwitheveryoneinyourdevelopmentteam,allowingaconsistentlookofthecomponentacrossapplications.Youcanalsocreatespecificstylesthatcontainmanyoftheappearancesettingsforindividualcells.Namedstyleshelpyouquicklycustomizetheappearanceofacellorrangeofcells.

    Forinformationonmanagingskins(thatapplytostylesandrenderersofthecomponent),refertoApplyingaSkintotheComponentandCreatingaCustomSkinforaComponent.

    Forinformationaboutskinsforsheets(usingtheolderwayofsettingstylesforindividualsheets),refertoApplyingaSkintoaSheetandCreatingaCustomSkinforaSheet.

    Forinformationonsavingtheskintoafile,refertoSavingandLoadingaSkin.

    Formoreinformationonstylesforindividualcells,refertoCreatingandApplyingaStyleforCells.

    FormoreinformationonVisualStyles(andXPThemes),refertoUsingXPThemeswiththeComponent.

    Sorting Rows or Columns

    Youcanprogrammaticallysortrowsorcolumnsorarangeofcells.Youcanspecifytheorderofsortingandthecomparisonmethodforsorting.Youcanallowyouruserstosortrowsautomaticallysimplybyclickingonthecolumnheader.Usemethodsatthesheetleveltoperformthesekindsofsorting:

    automaticallysortingbycolumnmanuallysortingcolumnsorrowssortingdatainarangeofcells

    Formoreinformationaboutsorting,refertoManagingSortingofRowsofUserData.

    Spannable Cells

    Youcanspancells.Createcellspanstojoincellstogether,allowingonecelltospanacrossmultiplecellstoinclude,for

    Spread Windows Forms Developer’s Guide 59

    Copyright © GrapeCity, Inc. All rights reserved.

  • example,yourcompanylogo.Youcanspandatacellsorheaders.YoucanalsohaveSpreadautomaticallymergecellsthatarethesamevalue.

    Formoreinformationaboutspanningcells,refertoCreatingaSpanofCells.Formoreinformation,refertoAllowingCellstoMergeAutomatically.

    Sparklines

    Youcanaddsparklinestoacell.Asparklineisasmallgraphthatfitsinsideacellandusesdatafromarangeofcells.

    Formoreinformation,refertoUsingSparklines.

    Spread Designer

    YoucanusetheSpreadDesignertodesignyourcomponentandtocreateaprototypequickly.UsetheSpreadDesignertoreducedevelopmenttimebyallowingyoutocustomizethelookandfeeloftheSpreadcomponentatdesigntimeusinganintuitive,easy-to-useinterface.

    Youcan