\r
public abstract class TextStoreBase\r
{\r
+ public delegate double GetDpiHandeler();\r
+ public event GetDpiHandeler GetDpi;\r
+\r
public delegate bool IsReadOnlyHandler();\r
public event IsReadOnlyHandler IsReadOnly;\r
\r
var pointBotttomRight = new POINT();\r
GetStringExtent(i_startIndex, i_endIndex, out pointTopLeft, out pointBotttomRight);\r
\r
- o_rect.left = (int)pointTopLeft.x;\r
- o_rect.top = (int)pointTopLeft.y;\r
- o_rect.bottom = (int)pointBotttomRight.y;//startFormattedText.Height);\r
- o_rect.right = (int)pointBotttomRight.x;\r
+ if(this.GetDpi == null)\r
+ throw new NotImplementedException();\r
+\r
+ double dpi = this.GetDpi();\r
+\r
+ o_rect.left = (int)(pointTopLeft.x * dpi / 96.0);\r
+ o_rect.top = (int)(pointTopLeft.y * dpi / 96.0);\r
+ o_rect.bottom = (int)(pointBotttomRight.y * dpi / 96.0);\r
+ o_rect.right = (int)(pointBotttomRight.x * dpi / 96.0);\r
o_isClipped = false;\r
#if TSF_DEBUG_OUTPUT\r
DebugOut.Print("rect left:{0} top:{1} bottom:{2} right:{3}", o_rect.left, o_rect.top, o_rect.bottom, o_rect.right);\r
\r
GetScreenExtent(out pointTopLeft, out pointBottomRight);\r
\r
- o_rect.left = (int)pointTopLeft.x;\r
- o_rect.top = (int)pointTopLeft.y;\r
- o_rect.right = (int)pointBottomRight.x;\r
- o_rect.bottom = (int)pointBottomRight.y;\r
+ if (this.GetDpi == null)\r
+ throw new NotImplementedException();\r
+\r
+ double dpi = this.GetDpi();\r
+\r
+ o_rect.left = (int)(pointTopLeft.x * dpi / 96.0);\r
+ o_rect.top = (int)(pointTopLeft.y * dpi / 96.0);\r
+ o_rect.bottom = (int)(pointBottomRight.y * dpi / 96.0);\r
+ o_rect.right = (int)(pointBottomRight.x * dpi / 96.0);\r
#if TSF_DEBUG_OUTPUT\r
DebugOut.Print("rect left:{0} top:{1} bottom:{2} right:{3}", o_rect.left, o_rect.top, o_rect.bottom, o_rect.right);\r
#endif\r
this.textStore = new TextStore2();\r
this.textStore.IsLoading += textStore_IsLoading;\r
this.textStore.IsReadOnly += textStore_IsReadOnly;\r
+ this.textStore.GetDpi += textStore_GetDpi;\r
this.textStore.GetStringLength += () => this.Document.Length;\r
this.textStore.GetString += _textStore_GetString;\r
this.textStore.GetSelectionIndex += _textStore_GetSelectionIndex;\r
this.Refresh();\r
}\r
\r
+ double textStore_GetDpi()\r
+ {\r
+ float dpi;\r
+ this.Render.GetDpi(out dpi, out dpi);\r
+ return dpi;\r
+ }\r
+\r
bool textStore_IsReadOnly()\r
{\r
return false;\r
this.textStore = new TextStore();\r
this.textStore.IsLoading += textStore_IsLoading;\r
this.textStore.IsReadOnly += textStore_IsReadOnly;\r
+ this.textStore.GetDpi += textStore_GetDpi;\r
this.textStore.GetStringLength += () => this.Document.Length;\r
this.textStore.GetString += _textStore_GetString;\r
this.textStore.GetSelectionIndex += _textStore_GetSelectionIndex;\r
get { return this.textStore; }\r
}\r
\r
+ double textStore_GetDpi()\r
+ {\r
+ float dpi;\r
+ this.Render.GetDpi(out dpi, out dpi);\r
+ return dpi;\r
+ }\r
+\r
bool textStore_IsReadOnly()\r
{\r
return false;\r