1919using HtmlRenderer . Core . Parse ;
2020using HtmlRenderer . Core . Utils ;
2121using HtmlRenderer . WinForms . Adapters ;
22+ using HtmlRenderer . WinForms . Utilities ;
2223
2324namespace HtmlRenderer . WinForms
2425{
@@ -232,8 +233,8 @@ public bool IsContextMenuEnabled
232233 /// </example>
233234 public PointF ScrollOffset
234235 {
235- get { return new PointF ( _htmlContainerInt . ScrollOffset . X , _htmlContainerInt . ScrollOffset . Y ) ; }
236- set { _htmlContainerInt . ScrollOffset = new PointInt ( value . X , value . Y ) ; }
236+ get { return Utils . Convert ( _htmlContainerInt . ScrollOffset ) ; }
237+ set { _htmlContainerInt . ScrollOffset = Utils . Convert ( value ) ; }
237238 }
238239
239240 /// <summary>
@@ -242,30 +243,30 @@ public PointF ScrollOffset
242243 /// </summary>
243244 public PointF Location
244245 {
245- get { return new PointF ( _htmlContainerInt . Location . X , _htmlContainerInt . Location . Y ) ; }
246- set { _htmlContainerInt . Location = new PointInt ( value . X , value . Y ) ; }
246+ get { return Utils . Convert ( _htmlContainerInt . Location ) ; }
247+ set { _htmlContainerInt . Location = Utils . Convert ( value ) ; }
247248 }
248249
249250 /// <summary>
250251 /// The max width and height of the rendered html.<br/>
251252 /// The max width will effect the html layout wrapping lines, resize images and tables where possible.<br/>
252253 /// The max height does NOT effect layout, but will not render outside it (clip).<br/>
253- /// <see cref="HtmlContainerInt. ActualSize"/> can be exceed the max size by layout restrictions (unwrappable line, set image size, etc.).<br/>
254+ /// <see cref="ActualSize"/> can be exceed the max size by layout restrictions (unwrappable line, set image size, etc.).<br/>
254255 /// Set zero for unlimited (width\height separately).<br/>
255256 /// </summary>
256257 public SizeF MaxSize
257258 {
258- get { return new SizeF ( _htmlContainerInt . MaxSize . Width , _htmlContainerInt . MaxSize . Height ) ; }
259- set { _htmlContainerInt . MaxSize = new SizeInt ( value . Width , value . Height ) ; }
259+ get { return Utils . Convert ( _htmlContainerInt . MaxSize ) ; }
260+ set { _htmlContainerInt . MaxSize = Utils . Convert ( value ) ; }
260261 }
261262
262263 /// <summary>
263264 /// The actual size of the rendered html (after layout)
264265 /// </summary>
265266 public SizeF ActualSize
266267 {
267- get { return new SizeF ( _htmlContainerInt . ActualSize . Width , _htmlContainerInt . ActualSize . Height ) ; }
268- internal set { _htmlContainerInt . ActualSize = new SizeInt ( value . Width , value . Height ) ; }
268+ get { return Utils . Convert ( _htmlContainerInt . ActualSize ) ; }
269+ internal set { _htmlContainerInt . ActualSize = Utils . Convert ( value ) ; }
269270 }
270271
271272 /// <summary>
@@ -313,7 +314,7 @@ public string GetHtml(HtmlGenerationStyle styleGen = HtmlGenerationStyle.Inline)
313314 /// <returns>found attribute value or null if not found</returns>
314315 public string GetAttributeAt ( Point location , string attribute )
315316 {
316- return _htmlContainerInt . GetAttributeAt ( new PointInt ( location . X , location . Y ) , attribute ) ;
317+ return _htmlContainerInt . GetAttributeAt ( Utils . Convert ( location ) , attribute ) ;
317318 }
318319
319320 /// <summary>
@@ -323,7 +324,7 @@ public string GetAttributeAt(Point location, string attribute)
323324 /// <returns>css link href if exists or null</returns>
324325 public string GetLinkAt ( Point location )
325326 {
326- return _htmlContainerInt . GetLinkAt ( new PointInt ( location . X , location . Y ) ) ;
327+ return _htmlContainerInt . GetLinkAt ( Utils . Convert ( location ) ) ;
327328 }
328329
329330 /// <summary>
@@ -336,7 +337,7 @@ public string GetLinkAt(Point location)
336337 public RectangleF ? GetElementRectangle ( string elementId )
337338 {
338339 var r = _htmlContainerInt . GetElementRectangle ( elementId ) ;
339- return r . HasValue ? new RectangleF ( r . Value . X , r . Value . Y , r . Value . Width , r . Value . Height ) : ( RectangleF ? ) null ;
340+ return r . HasValue ? Utils . Convert ( r . Value ) : ( RectangleF ? ) null ;
340341 }
341342
342343 /// <summary>
@@ -377,7 +378,7 @@ public void HandleMouseDown(Control parent, MouseEventArgs e)
377378 ArgChecker . AssertArgNotNull ( parent , "parent" ) ;
378379 ArgChecker . AssertArgNotNull ( e , "e" ) ;
379380
380- _htmlContainerInt . HandleMouseDown ( new ControlAdapter ( parent ) , new PointInt ( e . Location . X , e . Location . Y ) ) ;
381+ _htmlContainerInt . HandleMouseDown ( new ControlAdapter ( parent ) , Utils . Convert ( e . Location ) ) ;
381382 }
382383
383384 /// <summary>
@@ -390,7 +391,7 @@ public void HandleMouseUp(Control parent, MouseEventArgs e)
390391 ArgChecker . AssertArgNotNull ( parent , "parent" ) ;
391392 ArgChecker . AssertArgNotNull ( e , "e" ) ;
392393
393- _htmlContainerInt . HandleMouseUp ( new ControlAdapter ( parent ) , new PointInt ( e . Location . X , e . Location . Y ) , CreateMouseEvent ( e ) ) ;
394+ _htmlContainerInt . HandleMouseUp ( new ControlAdapter ( parent ) , Utils . Convert ( e . Location ) , CreateMouseEvent ( e ) ) ;
394395 }
395396
396397 /// <summary>
@@ -403,7 +404,7 @@ public void HandleMouseDoubleClick(Control parent, MouseEventArgs e)
403404 ArgChecker . AssertArgNotNull ( parent , "parent" ) ;
404405 ArgChecker . AssertArgNotNull ( e , "e" ) ;
405406
406- _htmlContainerInt . HandleMouseDoubleClick ( new ControlAdapter ( parent ) , new PointInt ( e . Location . X , e . Location . Y ) ) ;
407+ _htmlContainerInt . HandleMouseDoubleClick ( new ControlAdapter ( parent ) , Utils . Convert ( e . Location ) ) ;
407408 }
408409
409410 /// <summary>
@@ -416,7 +417,7 @@ public void HandleMouseMove(Control parent, MouseEventArgs e)
416417 ArgChecker . AssertArgNotNull ( parent , "parent" ) ;
417418 ArgChecker . AssertArgNotNull ( e , "e" ) ;
418419
419- _htmlContainerInt . HandleMouseMove ( new ControlAdapter ( parent ) , new PointInt ( e . Location . X , e . Location . Y ) ) ;
420+ _htmlContainerInt . HandleMouseMove ( new ControlAdapter ( parent ) , Utils . Convert ( e . Location ) ) ;
420421 }
421422
422423 /// <summary>
@@ -465,7 +466,7 @@ private static MouseEventInt CreateMouseEvent(MouseEventArgs e)
465466 /// <summary>
466467 /// Create HtmlRenderer key event from win forms key event.
467468 /// </summary>
468- private KeyEventInt CreateKeyEevent ( KeyEventArgs e )
469+ private static KeyEventInt CreateKeyEevent ( KeyEventArgs e )
469470 {
470471 return new KeyEventInt ( e . Control , e . KeyCode == Keys . A , e . KeyCode == Keys . C ) ;
471472 }
0 commit comments