开发者

Moving Picture Box depending on monitor size? C#

I am using a picture box in my C# application, I want it to cover a certain portion of the web browser (the username part on youtube).

I have a 21.5" monitor and this is what it looks like to me:

Moving Picture Box depending on monitor size? C#

But then this is what it looks like to one of my users开发者_开发百科 with a 24" monitor:

Moving Picture Box depending on monitor size? C#

As you can see the position of the picture box has moved up due to that persons screen size (I believe)

Is there a way to make sure that it will always be over that section of the web browser or moving it to that section of the web browser?

Thanks.


I am convinced your approach is wrong and would break anytime either for screen resolution or size changes, or for using the mouse-wheel to zoom in/out the page or whatever. it is just unreliable and patching this by overlapping another UI control like a picture box or a panel on top of what you want to hide is simply insecure and unreliable.

I think the tow real options you have are these:

  1. You try to interpret the page content and remove from the page's DOM the information you do not want to show to the user (eventually HTML Agility Pack could help for this DOM parsing and manipulation but I am not sure if you can read what the WebBrowser control is showing and inject changes into it);

  2. use the YouTube APIs and Tools - .NET APIs to load the videos and details you want to load and show but rendering this information with your specific UI elements in your windows forms application, without using a browser to show the normal YouTube site.

Probably the second option takes more work but is more secure, I am not sure 100%, as I said, if the first option is viable at all. You could search for HTML Agility Pack and web browser control to see if anybody has done this before already :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜