Created
November 8, 2019 20:42
-
-
Save bjoerntx/98a2cd4051ee250f5fa8b072c9617263 to your computer and use it in GitHub Desktop.
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
private void rulerBar1_MouseDoubleClick(object sender, MouseEventArgs e) | |
{ | |
// calculate zoom factor | |
float fZoomFactor = (float)textControl1.ZoomFactor / 100; | |
// get the click location in the ruler bar | |
int iClickLocation = (int)((e.X * iDpiX) + (textControl1.ScrollLocation.X * fZoomFactor)); | |
// loop through all tab positions | |
foreach (int tabPosition in textControl1.Paragraphs.GetItem( | |
textControl1.Selection.Start).Format.TabPositions) | |
{ | |
// retrieve the exact location including zoom factor | |
int iTabLocation = (int)((tabPosition + | |
textControl1.Sections.GetItem().Format.PageMargins.Left) * fZoomFactor); | |
// if click location matches tab position | |
// open the tab dialog | |
if (iClickLocation >= iTabLocation - 50 && iClickLocation <= iTabLocation + 50) | |
{ | |
textControl1.TabDialog(); // open dialog | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment