RichTextBox pseudo caret when it doesn't have focus
This commit is contained in:
parent
c0a822d4f7
commit
41c8a90bdf
@ -187,6 +187,7 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
void frmVEPROMS_Activated(object sender, EventArgs e)
|
void frmVEPROMS_Activated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (ActiveControl == tc) tc.HideCaret();
|
||||||
// refresh anything that pertains to external files or programs:
|
// refresh anything that pertains to external files or programs:
|
||||||
|
|
||||||
// if ro.fst was 'updated' from the roeditor, enable the update ro.fst values on
|
// if ro.fst was 'updated' from the roeditor, enable the update ro.fst values on
|
||||||
@ -260,6 +261,21 @@ namespace VEPROMS
|
|||||||
displayBookMarks.MyDisplayTabControl = tc; // allows bookmark selection to bring up steps/docs
|
displayBookMarks.MyDisplayTabControl = tc; // allows bookmark selection to bring up steps/docs
|
||||||
office2007StartButton1.MouseDown +=new MouseEventHandler(office2007StartButton1_MouseDown);
|
office2007StartButton1.MouseDown +=new MouseEventHandler(office2007StartButton1_MouseDown);
|
||||||
//displayRO.EnabledChanged += new EventHandler(displayRO_EnabledChanged);
|
//displayRO.EnabledChanged += new EventHandler(displayRO_EnabledChanged);
|
||||||
|
tc.Enter += new EventHandler(tc_Enter);
|
||||||
|
tc.Leave += new EventHandler(tc_Leave);
|
||||||
|
this.Deactivate += new EventHandler(frmVEPROMS_Deactivate);
|
||||||
|
}
|
||||||
|
void frmVEPROMS_Deactivate(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
tc.HideCaret(); // Hide the pseudo caret
|
||||||
|
}
|
||||||
|
void tc_Leave(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
tc.ShowCaret();// Show the pseudo caret
|
||||||
|
}
|
||||||
|
void tc_Enter(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
tc.HideCaret();// Hide the pseudo caret
|
||||||
}
|
}
|
||||||
//void displayRO_EnabledChanged(object sender, EventArgs e)
|
//void displayRO_EnabledChanged(object sender, EventArgs e)
|
||||||
//{
|
//{
|
||||||
|
@ -36,6 +36,7 @@ namespace Volian.Controls.Library
|
|||||||
this.bottomDocDockSite = new DevComponents.DotNetBar.DockSite();
|
this.bottomDocDockSite = new DevComponents.DotNetBar.DockSite();
|
||||||
this.fillDocDockSite = new DevComponents.DotNetBar.DockSite();
|
this.fillDocDockSite = new DevComponents.DotNetBar.DockSite();
|
||||||
this._MyBar = new DevComponents.DotNetBar.Bar();
|
this._MyBar = new DevComponents.DotNetBar.Bar();
|
||||||
|
this._PnlCaret = new System.Windows.Forms.Panel();
|
||||||
this.leftDocDockSite = new DevComponents.DotNetBar.DockSite();
|
this.leftDocDockSite = new DevComponents.DotNetBar.DockSite();
|
||||||
this.rightDocDockSite = new DevComponents.DotNetBar.DockSite();
|
this.rightDocDockSite = new DevComponents.DotNetBar.DockSite();
|
||||||
this.bottomBarDockSite = new DevComponents.DotNetBar.DockSite();
|
this.bottomBarDockSite = new DevComponents.DotNetBar.DockSite();
|
||||||
@ -44,8 +45,10 @@ namespace Volian.Controls.Library
|
|||||||
this.topBarDockSite = new DevComponents.DotNetBar.DockSite();
|
this.topBarDockSite = new DevComponents.DotNetBar.DockSite();
|
||||||
this.topDocDockSite = new DevComponents.DotNetBar.DockSite();
|
this.topDocDockSite = new DevComponents.DotNetBar.DockSite();
|
||||||
this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip();
|
this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip();
|
||||||
|
this.tmrCaret = new System.Windows.Forms.Timer(this.components);
|
||||||
this.fillDocDockSite.SuspendLayout();
|
this.fillDocDockSite.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this._MyBar)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this._MyBar)).BeginInit();
|
||||||
|
this._MyBar.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// dotNetBarManager1
|
// dotNetBarManager1
|
||||||
@ -60,7 +63,6 @@ namespace Volian.Controls.Library
|
|||||||
this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.Del);
|
this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.Del);
|
||||||
this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.Ins);
|
this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.Ins);
|
||||||
this.dotNetBarManager1.BottomDockSite = this.bottomDocDockSite;
|
this.dotNetBarManager1.BottomDockSite = this.bottomDocDockSite;
|
||||||
this.dotNetBarManager1.DefinitionName = "";
|
|
||||||
this.dotNetBarManager1.EnableFullSizeDock = false;
|
this.dotNetBarManager1.EnableFullSizeDock = false;
|
||||||
this.dotNetBarManager1.FillDockSite = this.fillDocDockSite;
|
this.dotNetBarManager1.FillDockSite = this.fillDocDockSite;
|
||||||
this.dotNetBarManager1.LeftDockSite = this.leftDocDockSite;
|
this.dotNetBarManager1.LeftDockSite = this.leftDocDockSite;
|
||||||
@ -114,7 +116,9 @@ namespace Volian.Controls.Library
|
|||||||
this._MyBar.CanHide = true;
|
this._MyBar.CanHide = true;
|
||||||
this._MyBar.CanUndock = false;
|
this._MyBar.CanUndock = false;
|
||||||
this._MyBar.CloseSingleTab = true;
|
this._MyBar.CloseSingleTab = true;
|
||||||
|
this._MyBar.Controls.Add(this._PnlCaret);
|
||||||
this._MyBar.DockTabAlignment = DevComponents.DotNetBar.eTabStripAlignment.Top;
|
this._MyBar.DockTabAlignment = DevComponents.DotNetBar.eTabStripAlignment.Top;
|
||||||
|
this._MyBar.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this._MyBar.LayoutType = DevComponents.DotNetBar.eLayoutType.DockContainer;
|
this._MyBar.LayoutType = DevComponents.DotNetBar.eLayoutType.DockContainer;
|
||||||
this._MyBar.Location = new System.Drawing.Point(0, 0);
|
this._MyBar.Location = new System.Drawing.Point(0, 0);
|
||||||
this._MyBar.Name = "_MyBar";
|
this._MyBar.Name = "_MyBar";
|
||||||
@ -125,6 +129,16 @@ namespace Volian.Controls.Library
|
|||||||
this._MyBar.TabNavigation = true;
|
this._MyBar.TabNavigation = true;
|
||||||
this._MyBar.TabStop = false;
|
this._MyBar.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// _PnlCaret
|
||||||
|
//
|
||||||
|
this._PnlCaret.BackColor = System.Drawing.Color.Red;
|
||||||
|
this._PnlCaret.Location = new System.Drawing.Point(5, 5);
|
||||||
|
this._PnlCaret.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this._PnlCaret.Name = "_PnlCaret";
|
||||||
|
this._PnlCaret.Size = new System.Drawing.Size(142, 16);
|
||||||
|
this._PnlCaret.TabIndex = 1;
|
||||||
|
this._PnlCaret.Visible = false;
|
||||||
|
//
|
||||||
// leftDocDockSite
|
// leftDocDockSite
|
||||||
//
|
//
|
||||||
this.leftDocDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window;
|
this.leftDocDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window;
|
||||||
@ -202,6 +216,11 @@ namespace Volian.Controls.Library
|
|||||||
//
|
//
|
||||||
this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
|
this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
|
||||||
//
|
//
|
||||||
|
// tmrCaret
|
||||||
|
//
|
||||||
|
this.tmrCaret.Interval = 500;
|
||||||
|
this.tmrCaret.Tick += new System.EventHandler(this.tmrCaret_Tick);
|
||||||
|
//
|
||||||
// DisplayTabControl
|
// DisplayTabControl
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@ -219,6 +238,7 @@ namespace Volian.Controls.Library
|
|||||||
this.Size = new System.Drawing.Size(673, 383);
|
this.Size = new System.Drawing.Size(673, 383);
|
||||||
this.fillDocDockSite.ResumeLayout(false);
|
this.fillDocDockSite.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)(this._MyBar)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this._MyBar)).EndInit();
|
||||||
|
this._MyBar.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -240,5 +260,7 @@ namespace Volian.Controls.Library
|
|||||||
//private DevComponents.DotNetBar.DockContainerItem dockContainerItem2;
|
//private DevComponents.DotNetBar.DockContainerItem dockContainerItem2;
|
||||||
//private DevComponents.DotNetBar.DockContainerItem dockContainerItem3;
|
//private DevComponents.DotNetBar.DockContainerItem dockContainerItem3;
|
||||||
private DevComponents.DotNetBar.SuperTooltip superTooltip1;
|
private DevComponents.DotNetBar.SuperTooltip superTooltip1;
|
||||||
|
private System.Windows.Forms.Panel _PnlCaret;
|
||||||
|
private System.Windows.Forms.Timer tmrCaret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ namespace Volian.Controls.Library
|
|||||||
private int _UniqueBarCount;
|
private int _UniqueBarCount;
|
||||||
private ItemInfo _MyItemInfo = null;
|
private ItemInfo _MyItemInfo = null;
|
||||||
private EditItem _MyEditItem = null;
|
private EditItem _MyEditItem = null;
|
||||||
|
private StepRTB _MyStepRTB = null;
|
||||||
private bool _RibbonExpanded=true;
|
private bool _RibbonExpanded=true;
|
||||||
public bool RibbonExpanded
|
public bool RibbonExpanded
|
||||||
{
|
{
|
||||||
@ -155,11 +156,16 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
_MyItemInfo = args.MyItemInfo;
|
_MyItemInfo = args.MyItemInfo;
|
||||||
_MyEditItem = args.MyEditItem;
|
_MyEditItem = args.MyEditItem;
|
||||||
|
if (_MyEditItem != null)
|
||||||
|
_MyStepRTB = _MyEditItem.MyStepRTB;
|
||||||
|
else
|
||||||
|
_MyStepRTB = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_MyItemInfo = null;
|
_MyItemInfo = null;
|
||||||
_MyEditItem = null;
|
_MyEditItem = null;
|
||||||
|
_MyStepRTB = null;
|
||||||
}
|
}
|
||||||
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args);
|
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args);
|
||||||
}
|
}
|
||||||
@ -471,6 +477,54 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
get { return _MyBar; }
|
get { return _MyBar; }
|
||||||
}
|
}
|
||||||
|
public Panel PnlCaret
|
||||||
|
{
|
||||||
|
get { return _PnlCaret; }
|
||||||
|
}
|
||||||
|
public void ShowCaret()
|
||||||
|
{
|
||||||
|
if (_MyStepRTB != null)
|
||||||
|
{
|
||||||
|
if (!_MyStepRTB.Visible)
|
||||||
|
_MyStepRTB.Visible = true;
|
||||||
|
if (_MyStepRTB.SelectionLength == 0)
|
||||||
|
{
|
||||||
|
Point pt = _MyStepRTB.GetPositionFromCharIndex(_MyStepRTB.SelectionStart);
|
||||||
|
pt = _MyStepRTB.PointToScreen(pt);
|
||||||
|
pt = this.PointToClient(pt);
|
||||||
|
PnlCaret.Location = pt;
|
||||||
|
PnlCaret.BackColor = _MyStepRTB.ForeColor;
|
||||||
|
using (Graphics gr = this.CreateGraphics())
|
||||||
|
{
|
||||||
|
SizeF sf = gr.MeasureString("Mg", _MyStepRTB.SelectionFont);
|
||||||
|
sf.Width = 1;
|
||||||
|
PnlCaret.Size = sf.ToSize();
|
||||||
|
}
|
||||||
|
tmrCaret.Enabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_MyStepRTB.SelectionColor = Color.White;
|
||||||
|
_MyStepRTB.SelectionBackColor = Color.FromName("Highlight");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void HideCaret()
|
||||||
|
{
|
||||||
|
if (_MyStepRTB != null && ! _MyStepRTB.Disposing)
|
||||||
|
{
|
||||||
|
if (_MyStepRTB.SelectionLength == 0)
|
||||||
|
{
|
||||||
|
tmrCaret.Enabled = false;
|
||||||
|
PnlCaret.Visible = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_MyStepRTB.SelectionColor = _MyStepRTB.ForeColor;
|
||||||
|
_MyStepRTB.SelectionBackColor = _MyStepRTB.BackColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
///// <summary>
|
///// <summary>
|
||||||
@ -686,5 +740,9 @@ namespace Volian.Controls.Library
|
|||||||
myDisplayTabItem.Dispose();
|
myDisplayTabItem.Dispose();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
private void tmrCaret_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
PnlCaret.Visible = !PnlCaret.Visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,4 +123,7 @@
|
|||||||
<metadata name="superTooltip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="superTooltip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>168, 17</value>
|
<value>168, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="tmrCaret.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>295, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
@ -29,7 +29,8 @@ namespace Volian.Controls.Library
|
|||||||
* 4) KBR ContextMenu for table. May want it to function in a similar way to spellcheck, with
|
* 4) KBR ContextMenu for table. May want it to function in a similar way to spellcheck, with
|
||||||
* the contentmenu to support table options and a last item that supports existing
|
* the contentmenu to support table options and a last item that supports existing
|
||||||
* contextmenu
|
* contextmenu
|
||||||
* 5) RHM Copy step - including modifying SQL code to copy grid/image data.
|
* 5) RHM Copy step - including modifying SQL code to copy grid/image data.
|
||||||
|
* The Grid includes links which also need to be updated.
|
||||||
* 6) RHM Selection is NOT selection, i.e. if merged cells, selection isn't selecting the 'merged'
|
* 6) RHM Selection is NOT selection, i.e. if merged cells, selection isn't selecting the 'merged'
|
||||||
* i.e. parent cell.
|
* i.e. parent cell.
|
||||||
* 7) RHM Selecting a range can end up with uneven rows or uneven columns. We need to handle,
|
* 7) RHM Selecting a range can end up with uneven rows or uneven columns. We need to handle,
|
||||||
@ -197,10 +198,17 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MyStepRTB_EditModeChanged(object sender, EventArgs args)
|
void MyStepRTB_EditModeChanged(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
AdjustColorsForEditMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AdjustColorsForEditMode()
|
||||||
{
|
{
|
||||||
if (MyStepRTB.EditMode)
|
if (MyStepRTB.EditMode)
|
||||||
|
{
|
||||||
MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Focus"].BackColor =
|
MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Focus"].BackColor =
|
||||||
MyFlexGrid.Styles["Highlight"].ForeColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.SkyBlue;
|
MyFlexGrid.Styles["Highlight"].ForeColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.SkyBlue;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Highlight"].ForeColor = Color.Black;
|
MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Highlight"].ForeColor = Color.Black;
|
||||||
@ -587,7 +595,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
public override void SetActive()
|
public override void SetActive()
|
||||||
{
|
{
|
||||||
MyFlexGrid.Styles["Focus"].BackColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.LightCyan;
|
AdjustColorsForEditMode();
|
||||||
}
|
}
|
||||||
private bool _Empty = false;
|
private bool _Empty = false;
|
||||||
public override bool Empty
|
public override bool Empty
|
||||||
|
@ -532,6 +532,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
private void SetUpStepRTB()
|
private void SetUpStepRTB()
|
||||||
{
|
{
|
||||||
|
DetectUrls = false;
|
||||||
C1SpellChecker2.SetActiveSpellChecking(this, true);
|
C1SpellChecker2.SetActiveSpellChecking(this, true);
|
||||||
this.Height = 10; // initialize the height to 10, the default height was too big for the cells in grid tables
|
this.Height = 10; // initialize the height to 10, the default height was too big for the cells in grid tables
|
||||||
BorderStyle = System.Windows.Forms.BorderStyle.None;
|
BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||||
@ -893,7 +894,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
string fonttab = FontTable;
|
string fonttab = FontTable;
|
||||||
string fontsize = FontSize;
|
string fontsize = FontSize;
|
||||||
this.DetectUrls = false;
|
//if (this.DetectUrls) this.DetectUrls = false;
|
||||||
if (SelectionLength > 0)HandleDeleteKeyWithSelectedText(new KeyEventArgs(Keys.None), null);
|
if (SelectionLength > 0)HandleDeleteKeyWithSelectedText(new KeyEventArgs(Keys.None), null);
|
||||||
int position = SelectionStart;
|
int position = SelectionStart;
|
||||||
SelectionLength = 0;
|
SelectionLength = 0;
|
||||||
@ -905,7 +906,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
private void AddLink50(string linkValue, string linkUrl)
|
private void AddLink50(string linkValue, string linkUrl)
|
||||||
{
|
{
|
||||||
this.DetectUrls = false;
|
//this.DetectUrls = false;
|
||||||
int position = SelectionStart;
|
int position = SelectionStart;
|
||||||
SelectionLength = 0;
|
SelectionLength = 0;
|
||||||
SelectedRtf = string.Format(@"{{\rtf\field{{\*\fldinst{{HYPERLINK ""www.volian.com #{0}"" }}}}{{\fldrslt{{\cf2\ul {1}}}}}}}", linkUrl, linkValue);
|
SelectedRtf = string.Format(@"{{\rtf\field{{\*\fldinst{{HYPERLINK ""www.volian.com #{0}"" }}}}{{\fldrslt{{\cf2\ul {1}}}}}}}", linkUrl, linkValue);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user