使用格式刷
Contents
[
Hide
]
格式刷是Aspose.Cells.GridDesktop中适配的MS Excel的特性。这是一个非常好的功能。对于那些还没有使用过此功能的人,格式刷允许用户将任何焦点单元格的格式设置应用到另一个单元格。这个特性的实现非常简单。在本主题中,我们也将介绍这一点。
使用格式刷
的特点格式刷要求用户选择一个单元格,您希望将其格式设置应用于其他单元格,然后调用启动格式刷方法网格桌面.格式刷有以下两种模式:
- 使用一次格式刷
- 始终使用格式刷
使用一次格式刷
如果开发人员只想使用一次格式刷功能,将焦点单元格的格式设置应用到单个单元格,那么他们可以通过调用启动格式刷方法并传递一个错误的对它的价值。这个错误的值将永远禁止格式刷绘制。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Starting format painter to paint once | |
gridDesktop1.StartFormatPainter(false); |
始终使用格式刷
当我们需要在多个单元格上应用格式设置时,始终使用格式刷是一项有用的功能。开发者只需调用即可实现此功能启动格式刷方法并传递一个真的对它的价值。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Starting format painter to keep painting forever | |
gridDesktop1.StartFormatPainter(true); |
这种格式画家会一直画下去,除非我们停止它。所以,要阻止格式刷一直绘画,我们可以简单地调用EndFormatPainter的方法网格桌面.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Ending format painter to stop painting | |
gridDesktop1.EndFormatPainter(); |