I need to get the actual number of pixels that an IHTMLElements margin is taking up, in my c# code. I've looked in it's style and currentStyle members, but the relevant parts are either null or set to "auto".

我需要在我的c#代码中获得IHTMLElements余量占用的实际像素数。我查看了它的样式和currentStyle成员,但相关部分为null或设置为“auto”。

Searching the internet has shown up the getCurrentStyle function in javascript, but I need these numbers in my c# code.

搜索互联网已经在javascript中显示了getCurrentStyle函数,但我需要在我的c#代码中使用这些数字。

Obviously I'm a bit new to js and html and everything...

显然我对js和html以及所有内容都有点新鲜......

So, is there any way to get at the actual calculated number of pixels being used for an elements margin (or any of it's other measurements for that matter) in c# code?

那么,有没有办法在c#代码中获得用于元素边距(或其中任何其他测量值)的实际计算像素数?

I forgot to add: This will only be getting used in Internet Explorer for the foreseeable future

我忘了添加:这只会在可预见的将来在Internet Explorer中使用

3 个解决方案

#1


Does it have to be in the C# code? It may be easier to do this at the client through script - for example, with jQuery some combination of width(), innerWidth() and outerWidth() should return the margin.

它必须在C#代码中吗?通过脚本在客户端执行此操作可能更容易 - 例如,使用jQuery,width(),innerWidth()和outerWidth()的某些组合应返回边距。

更多相关文章

  1. iframe调用后台方法通过response返回html代码
  2. 将我的代码中的JavaDoc注释转换为HTML
  3. 【置顶】 不显示删除回复显示所有回复显示星级回复显示得分回复
  4. 在Emacs中将语法突出显示的代码转换为HTML
  5. HTML5用户身份认证源代码:注册、登录、会话保持的解决方案
  6. 将PHP代码添加到.html文件
  7. 如何让你的前端代码更像HTML5(用语义元素构造html5)
  8. 如何在CSS中单独定位此HTML代码?
  9. QQ、MSN、淘包旺旺、Skype常设对话的html链接代码

随机推荐

  1. 开发者请注意:Python2 的最后版本将于 4
  2. Python 之父的解析器系列之六:给 PEG 语法
  3. Python 任务自动化工具 tox 教程
  4. 2019 年 stackoverflow 网站最受欢迎的 2
  5. 面向对象综合练习(超市收银系统)
  6. 你可能不知道的 Python 技巧
  7. 一文读懂python的map、reduce函数
  8. LightningChart JS Angular图表使用示例
  9. 最全Python数据科学小抄,赶紧收藏吧!
  10. 使用NIM Server网络半自动安装AIX系统