using System; namespace FarPointUtils { /// /// /// public class CustomHyperLinkCellType : FarPoint.Win.Spread.CellType.HyperLinkCellType { //Specified font System.Drawing.Font _specifiedFont = null; public CustomHyperLinkCellType() { } public CustomHyperLinkCellType(System.Drawing.Font pFont) { _specifiedFont = pFont; } public override object GetEditorValue() { // *** M8755 *** // When a hyperlink cell is clicked, it changes the value and text properties to // a boolean that signifies whether the link has been clicked. Since we are // using the text property to store information (ID's, etc...) we don't want this // boolean value to return, so we will return the text instead. return base.Text; } public override void StartEditing(EventArgs e, bool selectAll, bool autoClipboard) { // *** M8755 *** // When a hyperlink cell goes into edit mode, it won't generate any cell click events // unless the user leaves the cell and returns. By preventing editing, // we can avoid cells from becoming "Disabled". base.CancelEditing(); } public override void PaintCell(System.Drawing.Graphics g, System.Drawing.Rectangle r, FarPoint.Win.Spread.Appearance appearance, object value, bool isSelected, bool isLocked, float zoomFactor) { /* * Inform #24770 * Adding CustomHyperlinkCellType to resolve display issues (bold font) that were introduced * with 1.0.9. A fix should be in the next maint release (Bug #16328). When we get the * fix, we can remove the class from the project, compile, and revert back to * HyperlinkCellType where errors appear. */ FarPoint.Win.Spread.Appearance ourAppearance = new FarPoint.Win.Spread.Appearance(); ourAppearance.Font = appearance.Font; ourAppearance.BackColor = appearance.BackColor; ourAppearance.HorizontalAlignment = appearance.HorizontalAlignment; ourAppearance.VerticalAlignment = appearance.VerticalAlignment; ourAppearance.DrawPrimaryButton = appearance.DrawPrimaryButton; ourAppearance.DrawSecondaryButton = appearance.DrawSecondaryButton; ourAppearance.LockForeColor = appearance.LockForeColor; ourAppearance.LockBackColor = appearance.LockBackColor; //oAppearance.ForeColor = appearance.ForeColor; //Call base PaintCell function base.PaintCell (g, r, ourAppearance, value, isSelected, isLocked, zoomFactor); } } }