Spread Windows Forms Developer’s GuideVisual Studio 2015 or 2017 Project 27-29 Adding a Component...
Transcript of Spread Windows Forms Developer’s GuideVisual Studio 2015 or 2017 Project 27-29 Adding a Component...
-
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
DataBinding 53
ExcelSupportwithImportandExportCapabilities 54
ExternalVariable 54
FilteringDataonaSheet 54
FormulaTextBox(FormulaBar) 54
FormulaProviderControl 54
FunctionsandFormulas 54-55
GradientsforButtonCells,Headers,andMore 55
GroupingRowsintheDisplay 55
GroupingRowsorColumnsinanOutline 55
HeaderswithMultipleColumnsandRows 55
HierarchicalDisplay 55
HitTestforLocatingtheCursor 55-56
IndicatorsandIconsintheInterface 56
InkNotationSupport 56
KeyboardActionMapping 56
MultipleSheets 56
Spread Windows Forms Developer’s Guide 2
Copyright © GrapeCity, Inc. All rights reserved.
-
NameBoxControl 56
NotesforCells 56-57
PanesorViewports 57
PrintingandPDF 57
QuickStartWizard 57
Right-to-LeftLayouts 57
RowPreview 57
SearchingandSearchDialog 57-58
Shapes,Drawing,andAnnotations(FreehandDrawing) 58
SkinsandStylesforCustomizedAppearance 58
SortingRowsorColumns 58
SpannableCells 58
Sparklines 58-59
SpreadDesigner 59
StatusBar 59
Tables 59
TabStripandSheetNameTabs 59
TextRenderingwithGDI 59-60
TitleandSubTitle 60
TouchSupport 60
UndoandRedoActions 60
Validation 60
VisualStylesforXPThemes 60
NamespaceOverview 60-61
ConceptsOverview 61
ShortcutObjects 61-64
ObjectParentage 64
FormattedversusUnformattedData 64-65
CellTypes 65-67
Spread Windows Forms Developer’s Guide 3
Copyright © GrapeCity, Inc. All rights reserved.
-
UnderlyingModels 67
UnderstandingtheSpreadsheetObjects 68
WorkingwithSheets 68
WorkingwiththeActiveSheet 68-69
WorkingwithMultipleSheets 69-70
AddingaSheet 70-71
Workingwith1-BasedIndexing 71-72
CopyingandInsertingaSheet 72-73
MovingaSheet 73-74
RemovingaSheet 74-75
ShowingorHidingaSheet 75-76
WorkingwithRowsandColumns 76
CustomizingtheNumberofRowsorColumns 76-78
AddingaRoworColumn 78-79
RemovingaRoworColumn 79-80
ShowingorHidingaRoworColumn 80-81
WorkingwithHeaders 81
UnderstandingHeaders 81-82
CreatingaHeaderwithMultipleRowsorColumns 82-85
ShowingorHidingHeaders 85-87
WorkingwithCells 87
WorkingwiththeActiveCell 87-88
CreatingaRangeofCells 88-89
UnderstandingtheUnderlyingModels 90
UnderstandingtheTypesofSheetModels 90
UnderstandingtheSheetModelClassesandInterfaces 90-92
FindingMoreDetailsontheSheetModels 92-93
UnderstandingtheDataModel 93-94
UnderstandingtheAxisModel 94-95
Spread Windows Forms Developer’s Guide 4
Copyright © GrapeCity, Inc. All rights reserved.
-
UnderstandingtheSelectionModel 95-96
UnderstandingtheSpanModel 96
UnderstandingtheStyleModel 96-99
CreatingaCustomSheetModel 99-100
UnderstandingtheOptionalInterfaces 100-101
CustomizingtheSheetAppearance 102
CustomizingtheAppearanceoftheOverallComponent 102
SettingtheComponenttotheOriginalAppearance 102-103
ApplyingaSkintotheComponent 103-105
CreatingaCustomSkinforaComponent 105-108
CustomizingtheRenderers 108-112
CustomizingtheDimensionsoftheComponent 112-113
CustomizingtheOutlineoftheComponent 113-114
CustomizingtheDisplayofthePointer 114-115
CustomizingPaintingofPartsoftheComponent 115-116
UsingXPThemeswiththeComponent 116-117
HandlingRight-to-LeftLayouts 117-118
ApplyingThemetoCustomizetheAppearance 118-119
CustomizingtheIndividualSheetAppearance 120
SettingtheBackgroundColorsforaSheet 120-122
SettingaBackgroundImageforaSheet 122-123
DisplayingGridLinesonaSheet 123-126
AddingaTitleandSubtitletoaSheet 126-127
DisplayingaFooterforColumnsorGroups 127-131
ApplyingaSkintoaSheet 131-133
CreatingaCustomSkinforaSheet 133-135
CustomizingtheSheetCornerAppearance 135-136
GeneralStyleoftheSheetCorner 136-138
TextDisplayintheSheetCorner 138-139
Spread Windows Forms Developer’s Guide 5
Copyright © GrapeCity, Inc. All rights reserved.
-
TableDisplayintheSheetCorner 139-141
CustomizableCellintheSheetCorner 141-142
CellSpansintheSheetCorner 142-143
HeaderCountSynchronizationintheSheetCorner 143-144
Drawing(Rendering)Style 144-145
CustomizingRow,Column,andCellAppearance 146
CustomizingtheRoworColumnAppearance 146
SettingtheRowHeightorColumnWidth 146-148
ResizingtheRoworColumntoFittheData 148-149
UsingAutoRowHeight 149-151
FindingRowsandColumnThatHaveData 151
CreatingAlternatingRowsandColumns 151-155
CustomizingtheAppearanceofHeaders 155-156
CustomizingtheDefaultHeaderLabels 156-158
CustomizingHeaderLabelText 158-160
CustomizingtheStyleofHeaderCells 160-162
AddingaGradienttoHeaderCells 162-163
CustomizingtheHeaderGridLines 163-166
SettingtheHeightorWidthofHeaderCells 166-167
CreatingaSpaninaHeader 167-169
CustomizingtheAppearanceofaCell 169-170
ColoringaCell 170-172
SettingaBackgroundImagetoaCell 172-174
AligningCellContents 174-176
ResizingtheCelltoFittheData 176-177
ResizingtheDatatoFittheCell 177-178
CustomizingCellBorders 178
CreatingandCustomizingCellBorders 178-182
CreatingBorderswithDiagonalLines 182-184
Spread Windows Forms Developer’s Guide 6
Copyright © GrapeCity, Inc. All rights reserved.
-
CreatingaComplexBorderwithMultipleLines 184-186
CreatingaSpanofCells 186-188
AllowingCellstoMergeAutomatically 188-190
AllowingCellDatatoOverflow 190-192
CreatingandApplyingaStyleforCells 192-195
WorkingwithPatternandGradientFillEffects 195-196
UsingSparklines 196
AddingaSparklinetoaCell 196-198
CustomizingMarkersandPointers 198-200
SpecifyingHorizontalandVerticalAxes 200-201
WorkingwithSparklines 201-204
CustomizingSheetInteraction 205
CustomizingInteractionwiththeOverallComponent 205
CustomizingtheScrollBarsoftheComponent 205-209
CustomizingtheScrollBarTips 209-211
CustomizingtheSheetNameTabsoftheComponent 211-216
CustomizingtheUserInterfaceImages 216-218
AllowingtheUsertoZoomtheDisplayoftheComponent 218
CustomizingtheScaleMode 218-219
AddingaContextMenutoaComponent 219-220
AddingaStatusBar 220-221
HostingtheComponentonaWebPage 222
CustomizingClipboardOperationOptions 222-224
CustomizingUndoandRedoActions 224-225
LocatingthePointerUsingHitTest 225
CustomizingInteractionBasedonEvents 225-226
HandlingEventsofSubeditors 226
CustomizingtheUserErrorMessages 226
CustomizingInteractionwithaSheet 226-227
Spread Windows Forms Developer’s Guide 7
Copyright © GrapeCity, Inc. All rights reserved.
-
CustomizingViewports 227-231
CustomizingSplitBoxes 231-233
CustomizingthePositionintheDisplay 233-234
PlacingChildControlsonaSheet 234-235
CreatingTables 235-236
AddingaTable 236-237
UsingTableFilters 237-240
ResizingaTable 240-241
SortingaTable 241-242
SettingTableStyles 242-245
AddingaTableFormula 245-246
UnderstandingStructuredReferences 246-247
UsingOperatorsandSpecialItems 247-248
UnderstandingStructuredReferenceSyntaxRules 248-249
UsingStructuredReferences 249
CustomizingUserSearchingofData 249-250
AllowingtheUsertoPerformaStandardSearch 250-251
AllowingtheUsertoPerformanAdvancedSearch 251
SearchingforDatawithCode 251-252
CustomizingUserSelectionandDeselectionofData 252-253
SpecifyingWhattheUserCanSelect 253-256
CustomizingtheSelectionAppearance 256-259
WorkingwithSelections 259-260
WorkingwithDeselections 260-262
UsingApplicationTags 262
AddingaTagtoaSheet 262
AddingaTagtoaRoworColumn 262
AddingaTagtoaCell 263-264
SettingandResettingUserInteraction 264
Spread Windows Forms Developer’s Guide 8
Copyright © GrapeCity, Inc. All rights reserved.
-
AllowingUserFunctionality 264-265
ResettingPartsoftheInterface 265-268
ClearingorRemovingPartsoftheInterface 268
CustomizingDrawing 268-269
WorkingwithShapesinCode 269-271
WorkingwithAnnotations 271
AllowingtheUsertoDrawwithaTabletPC 271-273
CreatingCameraShapes 273-274
CustomizingRoworColumnInteraction 275
AllowingUserInteractionwithRowsandColumns 275
AllowingtheUsertoEnterDatainRowsorColumns 275-276
AllowingtheUsertoMoveRowsorColumns 276-278
AllowingtheUsertoResizeRowsorColumns 278-279
SettingFixed(Frozen)RowsorColumns 279-281
SettingupPreviewRows 281-283
ManagingFilteringofRowsofUserData 283-285
AllowingtheUsertoFilterRows 285-286
CustomizingSimpleFiltering 286
UnderstandingSimpleRowFiltering 286-287
SettingtheAppearanceofFilteredRows 287-290
CustomizingtheFilterList 290
DefiningtheContentsoftheFilterItemList 290-294
DefiningtheOrderoftheItemsintheFilterItemList 294-295
SettingtheAppearanceoftheDisplayoftheFilterItemList 295-297
CreatingaCompletelyCustomFilter 297
SettingtheAppearanceofFilterIndicators 297
UseCustomFilterIndicatorImages 297-299
ShowingorHidingFilterIndicators 299
DeterminingWhichHeaderRowDisplaystheIndicators 299-300
Spread Windows Forms Developer’s Guide 9
Copyright © GrapeCity, Inc. All rights reserved.
-
CustomizingEnhancedFiltering 300
UnderstandingEnhancedRowFiltering 300-303
CustomizingtheFilterBar 304-305
AddingaCustomSortDialog 305-306
ManagingGroupingofRowsofUserData 306
AllowingtheUsertoGroupRows 306-307
UsingGrouping 307-308
SettingtheAppearanceofGroupedRows 308-309
CustomizingtheGroupBar 309-310
CreatingaCustomGroup 310
InteroperabilityofGroupingwithOtherFeatures 310-311
ManagingOutlines(RangeGroups)ofRowsandColumns 311
UsinganOutline(RangeGroup)ofRowsorColumns 311-313
CustomizingtheAppearanceofanOutline(RangeGroup) 313-315
InteroperabilityofOutlineswithOtherFeatures 315
ManagingSortingofRowsofUserData 315-316
AllowingtheUsertoAutomaticallySortRows 316-318
UsingAutomaticSorting 318-319
SortingRows,Columns,orRanges 319-320
SettingtheAppearanceofSortIndicators 320-322
CustomizingInteractionwithCellTypes 323
UnderstandingHowCellTypesWork 323
UnderstandingCellTypeBasics 323-324
DeterminingtheCellTypeoftheActiveCell 324
UnderstandingHowCellTypesDisplayandFormatData 324-327
UnderstandingHowCellTypeAffectsModelData 327-328
WorkingwithEditableCellTypes 328-329
SettingaCurrencyCell 329-330
SettingaDate-TimeCell 330-332
Spread Windows Forms Developer’s Guide 10
Copyright © GrapeCity, Inc. All rights reserved.
-
SettingaGcCharMaskCell 332-334
SettingaGcDateTimeCell 335-336
SettingaGcMaskCell 336-339
SettingaGcNumberCell 339-341
SettingaGcTextBoxCell 341-343
SettingaGcTimeSpanCell 343-345
SettingaGeneralCell 345-347
SettingaMaskCell 347-348
SettingaNumberCell 348-353
SettingaPercentCell 354-355
SettingaRegularExpressionCell 355-356
SettingaTextCell 356-357
WorkingwithGraphicalCellTypes 357-358
SettingaBarcodeCell 358-363
SettingaButtonCell 363-368
SettingaCheckBoxCell 368-370
SettingaColorPickerCell 370-374
SettingaComboBoxCell 374-377
SettingaHyperlinkCell 377-381
SettinganImageCell 381-383
SettingaListBoxCell 383-385
SettingaMultiple-ColumnComboBoxCell 385-388
SettingaMultipleOptionCell 388-390
SettingaProgressIndicatorCell 390-392
SettingaRichTextCell 392-396
SettingaSliderCell 396-399
UnderstandingAdditionalFeaturesofCellTypes 399-400
DisplayingSpinButtons 400-401
AllowingaComboBoxCelltoHandleaDouble-Click 401-403
Spread Windows Forms Developer’s Guide 11
Copyright © GrapeCity, Inc. All rights reserved.
-
LimitingValuesforaNumericCell 403-404
CustomizingthePop-UpDate-TimeControl 404-406
CustomizingthePop-UpCalculatorControl 406-408
CustomizingAutomaticCompletion(TypeAhead) 408
WorkingwithaSubEditor 408-409
CreatingaCustomCellType 409-413
CustomizingInteractioninCells 414
UsingEditModeandFocus 414
UnderstandingEditModeinaCell 414-415
LockingaCell 415-417
AllowingtheDisplayofButtonsinaCell 418
CustomizingtheFocusIndicatorforaCell 418-421
UsingDragOperationstoFillCells 421
FillingCellswithDragandDrop 421-422
FillingCellswithDragandFill 422-426
FillingCellswithDragandMove 426
UsingVisibleIndicatorsintheCell 426
DisplayingTextTipsinaCell 426-428
AddingaNotetoaCell 428-431
PreventingaCellfromHavingFocus 431
GettingInformationofaClickedCell 431-432
DisplayingErrorIconsinCellsorRows 432-433
UsingConditionalFormattingofCells 433
CreatingConditionalFormattingwithRules 433-434
ColorScaleRules 434-435
DataBarRule 435-437
HighlightingRules 437-439
IconSetRule 439-440
Top,Bottom,orAverageRules 440-441
Spread Windows Forms Developer’s Guide 12
Copyright © GrapeCity, Inc. All rights reserved.
-
SettingupConditionalFormattingofaCell 441-443
ManagingFormulasinCells 443
PlacingaFormulainCells 443-445
SpecifyingaCellReferenceinaFormula 445-447
SpecifyingaSheetReferenceinaFormula 447-448
UsingaCircularReferenceinaFormula 448-450
NestingFunctionsinaFormula 450
RecalculatingandUpdatingFormulasAutomatically 450-451
FindingaValueusingGoalSeek 451-452
AllowingtheUsertoEnterFormulas 452-453
CreatingandUsingaCustomName 453-454
CreatingandUsingaCustomFunction 454-456
CreatingandUsingExternalVariable 456-458
UsingtheArrayFormula 458-459
WorkingWithDynamicArrayFormulas 459-470
UsingLanguagePackage 470
AvailableLanguagePackagesforWinForms 470-471
CreatingandUsingaCustomLanguagePackage 471-473
AccessingDatafromHeaderorFooter 473-475
ManagingExternalReference 475-479
UsingtheAdditionalSpreadControls 479
WorkingwiththeFormulaTextBox 479-482
SettinguptheFormulaProvider 482-484
SettinguptheNameBox 484-485
ManagingCellRangeFiltering 485-486
ManagingCellRangeSorting 486-488
ManagingDataBinding 489
BindingtoData 489
BindingSpreadtoanExternalDataSet 489-490
Spread Windows Forms Developer’s Guide 13
Copyright © GrapeCity, Inc. All rights reserved.
-
BindingaCellRangeinSpreadtoanExternalDataSource 490-492
BindingaCellRangeinSpreadasaDataSourcetoanExternalControl 492-494
CustomizingColumnandFieldBinding 494-497
BindingaComboBoxtoaDataReader 497-498
AddingtoBoundData 498
AddingaRowtoaBoundSheet 498-499
AddinganUnboundRowtotheSheet 499-501
AddinganUnboundColumntoaBoundSheet 501-502
CustomizingDataBinding 502
CustomizingColumnHeadersforBoundSheets 502-504
CustomizingCellTypesforBoundSheets 504-506
WorkingwithHierarchicalDataDisplay 506-512
CreatingaHierarchicalDisplayManually 512-514
CreatingCustomHierarchyIcons 514
Tutorial:BindingtoaCorporateDatabase(VisualStudio2013orlater) 514
Step1:AddingSpreadtoaDataBindingProject 514
Step2:SettinguptheDatabaseConnection 514-515
Step3:SettingthePropertiesintheControls 515-516
Step4:ImprovingtheDisplaybyChangingtheCellType 516-517
ManagingDataonaSheet 518
PlacingandRetrievingData 518
HandlingDataUsingSheetMethods 518-521
HandlingDataUsingCellProperties 521-522
RepeatedlyFillingaRangeofCellswithCopiedCells 522-523
ValidatingUserInput 523-527
RearrangingDataonaSheet 527
CopyingDataonaSheet 527
MovingDataonaSheet 527-528
SwappingDataonaSheet 528-529
Spread Windows Forms Developer’s Guide 14
Copyright © GrapeCity, Inc. All rights reserved.
-
RemovingDatafromaSheet 529-530
ImprovingPerformancebySuspendingtheLayout 530-533
ManagingKeyboardInteraction 534
UnderlyingKeystrokeProcessing 534-535
FactorsofKeyboardMapUsage 535-537
DefaultKeyboardNavigation 537-544
DefaultKeyboardMaps 544-545
DefaultMapforExcelCompatibility 545-546
DefaultMapforNormalandWhenFocused 546
DefaultMapforNormalandWhenAncestorOfFocused 546-548
DefaultMapforReadOnlyandWhenFocused 548
DefaultMapforReadOnlyandWhenAncestorOfFocused 548-549
DefaultMapforRowModeandWhenFocused 549
DefaultMapforRowModeandWhenAncestorOfFocused 549-550
DefaultMapforSingleSelectandWhenFocused 550
DefaultMapforSingleSelectandWhenAnscestorFocused 550-551
DefaultMapforMultiSelectandWhenFocused 551
DefaultMapforMultiSelectandWhenAncestorOfFocused 551
DefaultMapforExtendedSelectandWhenFocused 551
DefaultMapforExtendedSelectandWhenAncestorOfFocused 551-552
DeactivatingtheDefaultKeyboardMap 552-553
ChangingtheDefaultKeyboardMap 553-554
UsingInputMapswithActionMaps 554-558
CustomizingtheInputMaps 558-560
ChanginganInputMapforaChildView 560-563
UsingtheExcelCompatibilityInputMaps 563
SavingandLoadingMapFiles 563-564
ManagingEventsfromUserActions 565
ClickingActions 565-568
Spread Windows Forms Developer’s Guide 15
Copyright © GrapeCity, Inc. All rights reserved.
-
SelectingActions 568-569
EnteringDataActions 569
Sheet-LevelActions 569-570
InteractivityActions 570
ShapeActions 570
PrintActions 570-571
ManagingFileOperations 572
SavingDatatoaFile 572
SavingtoaSpreadXMLFile 572-573
SavingtoanExcelFile 573-575
SavingtoaTextFile 575
SavingtoanHTMLTable 575-576
SavingSpreadsheetDatatoSimpleXML 576-577
OpeningExistingFiles 577-578
OpeningaSpreadXMLFile 578
OpeninganExcelFile 578-580
OpeningaSpreadCOMFile 580
OpeningaCustomTextFile 580-581
UsingSerialization 581-582
ImplementingaSerializerClass 582-588
ParsingFormulasinCustomXMLDeserialization 588
SavingandLoadingaSkin 588
SavingaSkin 588-589
LoadingaSkin 589
StoringExcelSummaryandView 589-591
ManagingPrinting 592
SpecifyingWhattoPrint 592
PrintinganEntireSheet 592-594
PrintingtoPDF 594-595
Spread Windows Forms Developer’s Guide 16
Copyright © GrapeCity, Inc. All rights reserved.
-
PrintingaChildViewofaHierarchicalDisplay 595-596
PrintingParticularPages 596-598
PrintingthePortionoftheSheetwithData 598
PrintingaRangeofCellsonaSheet 598-600
PrintinganAreaoftheSheet 601
PrintingaSheetwithCellNotes 601-603
PrintingaSheetwithShapes 603-604
PrintinginDuplexMode 604
CustomizingtheAppearanceofthePrinting 604
UnderstandingthePrintingOptions 604-609
CustomizingthePrintJobSettings 609-610
CustomizingthePrintedPageLayout 610-612
CustomizingthePrintedPageHeaderorFooter 612-616
CustomizingthePrintPreviewDialog 616-618
RepeatingRowsorColumnsonPrintedPages 618
AddingaPageBreak 618-620
AddingaWatermarktoaPrintedPage 620-621
OptimizingthePrinting 621
OptimizingthePrintingUsingRules 621-624
OptimizingthePrintingUsingSize 624
DisplayingDialogsforUsers 624
DisplayingaPrintDialogfortheUser 625
DisplayinganAbortMessagefortheUser 625
ProvidingaPreviewofthePrinting 625-627
WorkingwiththeChartControl 628
UnderstandingCharts 628
ChartUserInterfaceElements 628-629
ChartObjectModel 629-630
ChartTypesandViews 630-632
Spread Windows Forms Developer’s Guide 17
Copyright © GrapeCity, Inc. All rights reserved.
-
PlotTypes 632
YPlotTypes 632-633
AreaCharts 633-635
BarCharts 635-638
LineCharts 638-639
MarketData(High-Low)Charts 639-641
PointCharts 641-642
StripeCharts 642-643
XYPlotTypes 643
XYBubbleCharts 643-644
XYLineCharts 644
XYPointCharts 644-645
XYStripeCharts 645
XYZPlotTypes 645-646
XYZPointCharts 646-647
XYZLineCharts 647-648
XYZSurfaceCharts 648-649
XYZStripeCharts 649
PiePlotTypes 649
DoughnutCharts 649-650
PieCharts 650
PolarPlotTypes 650-651
PolarPointCharts 651-652
PolarLineCharts 652-653
PolarAreaCharts 653-654
PolarStripeCharts 654
RadarPlotTypes 654-655
RadarPointCharts 655-656
RadarLineCharts 656-657
Spread Windows Forms Developer’s Guide 18
Copyright © GrapeCity, Inc. All rights reserved.
-
RadarAreaCharts 657
RadarStripeCharts 657-658
DataPlotTypes 658-659
PlotsandSeries 659-661
Walls 661-662
AxisandOtherLines 662-663
FillEffects 663-666
ChartLineStyle 666-668
ElevationandRotation 668-669
Lighting,Shapes,andBorders 669-671
Size-Height,Width,andDepth 671-672
Labels 672-673
Legends 673-674
CreatingCharts 674
CreatingPlotTypes 674-675
CreatingaYPlot 675-677
CreatinganXYPlot 677-679
CreatinganXYZPlot 679-682
CreatingaPiePlot 682-684
CreatingaPolarPlot 684-687
CreatingaRadarPlot 687-690
CombiningPlotTypes 690-692
CreatingaSunburstChart 692-694
CreatingaTreemapChart 694-698
ConnectingtoData 699
UsingaBoundDataSource 699-701
UsinganUnboundDataSource 701
UsingRawandRepresentedData 701-702
SavingorLoadingaChart 702-703
Spread Windows Forms Developer’s Guide 19
Copyright © GrapeCity, Inc. All rights reserved.
-
UsingtheChartDesigner 703
OpeningtheChartDesigner 704-705
CreatingaChartControl 705-708
ChartCollectionEditors 708
LabelCollectionEditor 708-709
LegendCollectionEditor 709
PlotCollectionEditor 709-710
LightCollectionEditor 710-711
SeriesCollectionEditor 711
ChartDesignerToolbar 711-712
UsingtheChartControl 712
AddingaChartControl 712-719
ChangingChartOptions 719-721
UsingtheChartDesigner 721-722
BindingtheChartControl 722-724
AllowingtheUsertoChangetheChart 724-726
AddingaContextMenu 726
UsingTouchSupportwiththeComponent 727
UnderstandingTouchSupport 727
UnderstandingTouchGestures 727
UnderstandingTouchMessages 727
UsingTouchSupport 727-728
UsingaTouchKeyboard 728-729
UsingtheTouchMenuBar 729-731
UsingTouchSupportwithAutoFit 731
UsingTouchSupportwithCellNotes 731
UsingTouchSupportwithCharts 731-732
UsingTouchSupportwithClipboardOperations 732
UsingTouchSupportwithDragandFill 732-734
Spread Windows Forms Developer’s Guide 20
Copyright © GrapeCity, Inc. All rights reserved.
-
UsingTouchSupportwithDrop-DownElements 734-735
UsingTouchSupportwithEditableCells 735-736
UsingTouchSupportwithInputManCells 736-739
UsingTouchSupportwithFiltering 739
UsingTouchSupportwithGrouping 739-740
UsingTouchSupportwithRangeGrouping 740-741
UsingTouchSupportwhenMovingColumnsorRows 741-743
UsingTouchSupportwhenResizingColumnsorRows 743-744
UsingTouchSupportwithScrolling 744-745
UsingTouchSupportwithSelections 745-747
UsingTouchSupportwithShapes 747
UsingTouchSupportwhenSorting 747-748
UsingTouchSupportwithViewports 748
UsingTouchSupportwiththeTabStrip 748
UsingTouchSupportwithZooming 748-749
2. Index 750-805
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.NET12->SpreadWindowsForms->SpreadWindowsFormsReadMe.SelecttheReadMeundertheGrapeCitynameontheStartscreenwithMicrosoftWindows8,8.1,or10.
2. Ifyouperformedadefaultinstallation,inWindowsExplorerbrowseto\GrapeCity\Spread.NET12\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.
http://sphelp.grapecity.com/WebHelp/SpreadNET12ReadMe/webframe.htmlhttp://help.grapecity.com/spread/SpreadNET12ReadMe/webframe.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: [email protected]
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:[email protected]
-
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.
-
ChartControlsonaSheetChildControlsonaSheetColumnFootersandGroupFootersConditionalFormattingDataBindingExcelSupportwithImportandExportCapabilitiesExternalVariableFilteringDataonaSheetFormulaTextBox(FormulaBar)FormulaProviderControlFunctionsandFormulasGradientsforButtonCells,Headers,andMoreGroupingRowsintheDisplayGroupingRowsorColumnsinanOutlineHeaderswithMultipleColumnsandRowsHierarchicalDisplayHitTestforLocatingtheCursorIndicatorsandIconsintheInterfaceInkNotationSupportKeyboardActionMappingMultipleSheetsNameBoxControlNotesforCellsPanesorViewportsPrintingandPDFQuickStartWizardRight-To-LeftLayoutsRowPreviewSearchingandSearchDialogShapes,Drawings,andAnnotations(FreehandDrawing)SkinsandStylesforCustomizedAppearanceSortingRowsorColumnsSpannableCellsSparklinesSpreadDesignerStatusBarTablesTabStripandSheetNameTabsTextRenderingwithGDITitleandSubTitleTouchSupportUndoandRedoActionsValidationVisualStylesforXPThemes
Camera Shapes
Spread Windows Forms Developer’s Guide 52
Copyright © GrapeCity, Inc. All rights reserved.
-
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.
Data Binding
WithSpreadWindowsForms,youhavemanydatabindingoptions.
Youcanbindthespreadsheettoadatasettodisplayandallowyouruserstoeditinformation.Spreadcanautomaticallyupdatethedatasetwiththechanges.
Youcanalsoallowpartofyourspreadsheettobeunbound.Youcanalsobindtoarangeofcells.
Formoreinformation,refertoManagingDataBinding.
Spread Windows Forms Developer’s Guide 53
Copyright © GrapeCity, Inc. All rights reserved.
-
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:
DatabaseDateandTimeEngineeringFinancialInformationLogicLookupandReference
Spread Windows Forms Developer’s Guide 54
Copyright © GrapeCity, Inc. All rights reserved.
-
MathandTrigonometryStatisticsTextVolatile
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,withparentrowsandchildviewsofrelateddata.
Formoreinformationabouthierarchicaldisplayofdata,refertoWorkingwithHierarchicalDataDisplay.
HitTest for Locating the Cursor
Spread Windows Forms Developer’s Guide 55
Copyright © GrapeCity, Inc. All rights reserved.
http://help.grapecity.com/spread/SpreadNet12/FR/webframe.html
-
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
Thenameboxcontrolcanbeusedtocreateordisplaycustomnamesatruntime.
Formoreinformation,refertoSettinguptheNameBox.
Notes for Cells
Spread Windows Forms Developer’s Guide 56
Copyright © GrapeCity, Inc. All rights reserved.
-
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.Thepreviewrowisdisplayedbelowtherowitprovidesinformationfor.Youcanspecifycolorsandotherformattingforthepreviewrowaswell.
Formoreinformation,refertoSettingupPreviewRows.
Searching and Search Dialog
Spread Windows Forms Developer’s Guide 57
Copyright © GrapeCity, Inc. All rights reserved.
-
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,forexample,yourcompanylogo.Youcanspandatacellsorheaders.YoucanalsohaveSpreadautomaticallymergecellsthatarethesamevalue.
Formoreinformationaboutspanningcells,refertoCreatingaSpanofCells.Formoreinformation,refertoAllowingCellstoMergeAutomatically.
Spread Windows Forms Developer’s Guide 58
Copyright © GrapeCity, Inc. All rights reserved.
-
Sparklines
Youcanaddsparklinestoacell.Asparklineisasmallgraphthatfitsinsideacellandusesdatafromarangeofcells.
Formoreinformation,refertoUsingSparklines.
Spread Designer
YoucanusetheSpreadDesignertodesignyourcomponentandtocreateaprototypequickly.UsetheSpreadDesignertoreducedevelopmenttimebyallowingyoutocustomizethelookandfeeloftheSpreadcomponentatdesigntimeusinganintuitive,easy-to-useinterface.
YoucanalsoshowtheSpreadDesignerinyourapplicationatruntime.
Formoreinformation,refertotheSpreadDesignerGuide(on-linedocumentation).
Status Bar
YoucanaddastatusbartotheSpreadcontrolthatallowsyoutozoomanddisplaysinformationaboutselectedcells.
Formoreinformation,refertoAddingaStatusBar.
Tables
Youcanaddtablestothesheet.Youcanalsosortorfilterthetabledata.
Formoreinformation,refertoCreatingTables.
Tab Strip and Sheet Name Tabs
Youcancustomizethepaintingofvariouspartsoftheinterfaceincludingthesheetnametabsandthetabstripthatcontainsthem.
Formoreinformationaboutthetabstrip,refertoCustomizingtheSheetNameTabsoftheComponentandCustomizingPaintingofPartsoftheComponent.
Text Rendering with GDI
YoucanuseGDI(insteadofGDI+)fordrawingtextinVisualStudio2005byusingthespecialFarPoint.Win.TextRendererDLLandaddingittothereferencesinaproject.IfyouusethetextrendererfeatureinyourprojectfortextdrawingthatisGDI-basedratherthanGDI+-based,inversion2.0ofthe.NETFramework,thenyoumustdistributetheFarPoint.Win.TextRenderer.dllfile.OnlyuserswhoareusingVisualStudio2005canbenefitfromthisfile,asthatenvironmentisrequiredtotargetversion2.0ofthe.NETFramework.
TheFarPoint.Win.TextRenderer.dllisathinwrapperforthenewSystem.Windows.FormsTextRendererclassin.NET2.0.TheSpreadcomponenttriestolocatetheFarPoint.Win.TextRendererassemblyifitcanfindtheframeworkSystem.Windows.Forms.TextRendererclassintheSystem.Windows.Formsassembly(thatis,ifSpreadisrunningunder.NET2.0).Ifitcan,SpreadloadstheFarPointTextRendererandusesreflectiontomakedynamiccallsintoittodothetextdrawingwithSystem.Windows.Forms.TextRendererinsteadofSystem.Drawing.Graphics.DrawString.SpreadusesdynamiccallsthroughreflectionsothattheFarPointSpreadassemblyisnotdependentontheFarPoint.Win.TextRendererassembly;iftheFarPointassemblyisnotfound,oriftheSystem.Windows.Forms.TextRendererclassisnotfoundintheSystem.Windows.Formsassembly,thenSpreadusesGraphics.DrawStringtodrawtextasithasalwaysdone.FormoreinformationabouthowthenewTextRendererclassin.NET2.0differsfromthewaytheGraphicsobjectdrawstext,inparticularhowTextRendererusesGDIdrawingAPIsin
Spread Windows Forms Developer’s Guide 59
Copyright © GrapeCity, Inc. All rights reserved.
-
WindowsinsteadofGDI+APIsinthe.NETframework,refertothe.NETframeworkdocumentationaboutusingTextRendererclass.
SpreadcanuseGDI+drawingwhileothertextdrawingintheapplicationusesGDIwiththenewTextRendererclass;SpreadcanusethenewTextRendererclassforGDIdrawingwhileothertextdrawingintheapplicationusesGDI+.Thedifferencesareverysmall(afewpixelsinthespacingandalignment)andnotverynoticeable.
ThisDLLmustbeinstalledtothedirectorywheretheapplication’sexecutablefileresides(thebinfolder)ons