![]() |
Windows.RangeFromPoint method is not working properly
RangeFromPoint method is not working ok when the direction righ_to_left
I'm the position from of cursor by Windows.Forms.Cursor.Position() and then I invoke Window.RangeFromPoint with coordination I got from Cursor. It works perfect when the direction of the work book is left to right. Regards Raja |
Windows.RangeFromPoint method is not working properly
Raja,
I don't have a R to L system handy, but are the coordinates reversed ? Or something else ? NickHK "Raja" wrote in message ... RangeFromPoint method is not working ok when the direction righ_to_left I'm the position from of cursor by Windows.Forms.Cursor.Position() and then I invoke Window.RangeFromPoint with coordination I got from Cursor. It works perfect when the direction of the work book is left to right. Regards Raja |
Windows.RangeFromPoint method is not working properly
Hello NickHK,
how could I do the coordinates reversed? I've tried to that using Application.Width and Application.Left and Window.Left and Window.Width. but i got wrong values from these properties. for instance Application.Width was 966 instead of 1200 which my resolution. Regards Raja "NickHK" wrote: Raja, I don't have a R to L system handy, but are the coordinates reversed ? Or something else ? NickHK "Raja" wrote in message ... RangeFromPoint method is not working ok when the direction righ_to_left I'm the position from of cursor by Windows.Forms.Cursor.Position() and then I invoke Window.RangeFromPoint with coordination I got from Cursor. It works perfect when the direction of the work book is left to right. Regards Raja |
Windows.RangeFromPoint method is not working properly
Raja,
Yes, I get Application.Width =966 with a screen resolution set at 1280 x 1027 pixels. It all depends on which units your various coordinates are in and also relative to what. You will (probably) need some conversion between Windows coords<Excel coords. So what do you mean by "RangeFromPoint method is not working ok" ? And "It works perfect when the direction of the work book is left to right" ? NickHK "Raja" wrote in message ... Hello NickHK, how could I do the coordinates reversed? I've tried to that using Application.Width and Application.Left and Window.Left and Window.Width. but i got wrong values from these properties. for instance Application.Width was 966 instead of 1200 which my resolution. Regards Raja "NickHK" wrote: Raja, I don't have a R to L system handy, but are the coordinates reversed ? Or something else ? NickHK "Raja" wrote in message ... RangeFromPoint method is not working ok when the direction righ_to_left I'm the position from of cursor by Windows.Forms.Cursor.Position() and then I invoke Window.RangeFromPoint with coordination I got from Cursor. It works perfect when the direction of the work book is left to right. Regards Raja |
Windows.RangeFromPoint method is not working properly
Hello NickHk,
thank you for your resopond, i feel we getting close to the solution. still one question How could I Convert the From Point value to Pixel Value? Could I take the screenWidth/Application.Width ? Regards Raja "NickHK" wrote: Raja, Yes, I get Application.Width =966 with a screen resolution set at 1280 x 1027 pixels. It all depends on which units your various coordinates are in and also relative to what. You will (probably) need some conversion between Windows coords<Excel coords. So what do you mean by "RangeFromPoint method is not working ok" ? And "It works perfect when the direction of the work book is left to right" ? NickHK "Raja" wrote in message ... Hello NickHK, how could I do the coordinates reversed? I've tried to that using Application.Width and Application.Left and Window.Left and Window.Width. but i got wrong values from these properties. for instance Application.Width was 966 instead of 1200 which my resolution. Regards Raja "NickHK" wrote: Raja, I don't have a R to L system handy, but are the coordinates reversed ? Or something else ? NickHK "Raja" wrote in message ... RangeFromPoint method is not working ok when the direction righ_to_left I'm the position from of cursor by Windows.Forms.Cursor.Position() and then I invoke Window.RangeFromPoint with coordination I got from Cursor. It works perfect when the direction of the work book is left to right. Regards Raja |
Windows.RangeFromPoint method is not working properly
See the VBA below. Adapt to you .Net language. You should also get the
display resolution, but I have just hard coded to more common value using Small Fonts of 96 dpi. So whilst Help is not explicit, it would seem that the dimensions returned about the Excel environemt are in points, not pixels. Note: This assumes there are no task bars etc docked to the left/right of the desktop. In release code, you should check for this. Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long Const SM_CXSCREEN = 0 'X Size of screen Private Sub CommandButton1_Click() Const SMALLFONTS_DPI As Long = 96 Const POINTS_INCH As Long = 72 With Application .WindowState = xlMaximized Debug.Print "Screen in Points = " & GetSystemMetrics(SM_CXSCREEN) / SMALLFONTS_DPI * POINTS_INCH Debug.Print "Application.Left = " & .Left Debug.Print "Application.Width = " & .Width End With End Sub NickHK "Raja" wrote in message ... Hello NickHk, thank you for your resopond, i feel we getting close to the solution. still one question How could I Convert the From Point value to Pixel Value? Could I take the screenWidth/Application.Width ? Regards Raja "NickHK" wrote: Raja, Yes, I get Application.Width =966 with a screen resolution set at 1280 x 1027 pixels. It all depends on which units your various coordinates are in and also relative to what. You will (probably) need some conversion between Windows coords<Excel coords. So what do you mean by "RangeFromPoint method is not working ok" ? And "It works perfect when the direction of the work book is left to right" ? NickHK "Raja" wrote in message ... Hello NickHK, how could I do the coordinates reversed? I've tried to that using Application.Width and Application.Left and Window.Left and Window.Width. but i got wrong values from these properties. for instance Application.Width was 966 instead of 1200 which my resolution. Regards Raja "NickHK" wrote: Raja, I don't have a R to L system handy, but are the coordinates reversed ? Or something else ? NickHK "Raja" wrote in message ... RangeFromPoint method is not working ok when the direction righ_to_left I'm the position from of cursor by Windows.Forms.Cursor.Position() and then I invoke Window.RangeFromPoint with coordination I got from Cursor. It works perfect when the direction of the work book is left to right. Regards Raja |
All times are GMT +1. The time now is 11:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com