如何使用鼠标滚轮在 WPF 中水平滚动?

2024-03-05

如何使 WPF 能够响应使用鼠标滚轮的水平滚动?例如,我有一个 Microsoft Explorer 迷你鼠标,并尝试使用以下命令水平滚动 ScrollViewer 中包含的内容

HorizontalScrollBarVisibility="Visible"

但内容不会水平滚动。然而,垂直滚动可以像往常一样可靠地工作。

如果 WPF 目前不直接支持此类输入,是否有办法使用非托管代码的互操作来实现此目的?

Thanks!


我刚刚做了一个课程,添加了预览鼠标水平轮 and 鼠标水平滚轮将事件附加到所有 UI 元素。 这些事件包括 MouseHorizo​​ntalWheelEventArgs Horizo​​ntal Delta 作为参数。

Update 3

根据WPF标准,倾斜值被反转,向上为正,向下为负,因此左为正,右为负。

Update 2

If the 自动启用鼠标水平滚轮支持设置为 true (默认情况下),使用这些事件没有特殊要求。

仅当设置为 false 时那么你需要打电话MouseHorizontalWheelEnabler.EnableMouseHorizontalWheel(X)其中 X 是顶级元素(Window、Popup 或 ContextMenu)或MouseHorizontalWheelEnabler.EnableMouseHorizontalWheelForParentOf(X)与要启用支持的元素。您可以阅读提供的文档以获取有关这些方法的更多信息。

请注意,所有这些在 XP 上都不起作用,因为 WM_MOUSE-H-WHEEL 是在 Vista 上添加的。

MouseHorizo​​ntalWheelEnabler.cs

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
using JetBrains.Annotations;

namespace WpfExtensions
{
    public static class MouseHorizontalWheelEnabler
    {
        /// <summary>
        ///   When true it will try to enable Horizontal Wheel support on parent windows/popups/context menus automatically
        ///   so the programmer does not need to call it.
        ///   Defaults to true.
        /// </summary>
        public static bool AutoEnableMouseHorizontalWheelSupport = true;

        private static readonly HashSet<IntPtr> _HookedWindows = new HashSet<IntPtr>();

        /// <summary>
        ///   Enable Horizontal Wheel support for all the controls inside the window.
        ///   This method does not need to be called if AutoEnableMouseHorizontalWheelSupport is true.
        ///   This does not include popups or context menus.
        ///   If it was already enabled it will do nothing.
        /// </summary>
        /// <param name="window">Window to enable support for.</param>
        public static void EnableMouseHorizontalWheelSupport([NotNull] Window window) {
            if (window == null) {
                throw new ArgumentNullException(nameof(window));
            }

            if (window.IsLoaded) {
                // handle should be available at this level
                IntPtr handle = new WindowInteropHelper(window).Handle;
                EnableMouseHorizontalWheelSupport(handle);
            }
            else {
                window.Loaded += (sender, args) => {
                    IntPtr handle = new WindowInteropHelper(window).Handle;
                    EnableMouseHorizontalWheelSupport(handle);
                };
            }
        }

        /// <summary>
        ///   Enable Horizontal Wheel support for all the controls inside the popup.
        ///   This method does not need to be called if AutoEnableMouseHorizontalWheelSupport is true.
        ///   This does not include sub-popups or context menus.
        ///   If it was already enabled it will do nothing.
        /// </summary>
        /// <param name="popup">Popup to enable support for.</param>
        public static void EnableMouseHorizontalWheelSupport([NotNull] Popup popup) {
            if (popup == null) {
                throw new ArgumentNullException(nameof(popup));
            }

            if (popup.IsOpen) {
                // handle should be available at this level
                // ReSharper disable once PossibleInvalidOperationException
                EnableMouseHorizontalWheelSupport(GetObjectParentHandle(popup.Child).Value);
            }

            // also hook for IsOpened since a new window is created each time
            popup.Opened += (sender, args) => {
                // ReSharper disable once PossibleInvalidOperationException
                EnableMouseHorizontalWheelSupport(GetObjectParentHandle(popup.Child).Value);
            };
        }

        /// <summary>
        ///   Enable Horizontal Wheel support for all the controls inside the context menu.
        ///   This method does not need to be called if AutoEnableMouseHorizontalWheelSupport is true.
        ///   This does not include popups or sub-context menus.
        ///   If it was already enabled it will do nothing.
        /// </summary>
        /// <param name="contextMenu">Context menu to enable support for.</param>
        public static void EnableMouseHorizontalWheelSupport([NotNull] ContextMenu contextMenu) {
            if (contextMenu == null) {
                throw new ArgumentNullException(nameof(contextMenu));
            }

            if (contextMenu.IsOpen) {
                // handle should be available at this level
                // ReSharper disable once PossibleInvalidOperationException
                EnableMouseHorizontalWheelSupport(GetObjectParentHandle(contextMenu).Value);
            }

            // also hook for IsOpened since a new window is created each time
            contextMenu.Opened += (sender, args) => {
                // ReSharper disable once PossibleInvalidOperationException
                EnableMouseHorizontalWheelSupport(GetObjectParentHandle(contextMenu).Value);
            };
        }

        private static IntPtr? GetObjectParentHandle([NotNull] DependencyObject depObj) {
            if (depObj == null) {
                throw new ArgumentNullException(nameof(depObj));
            }

            var presentationSource = PresentationSource.FromDependencyObject(depObj) as HwndSource;
            return presentationSource?.Handle;
        }

        /// <summary>
        ///   Enable Horizontal Wheel support for all the controls inside the HWND.
        ///   This method does not need to be called if AutoEnableMouseHorizontalWheelSupport is true.
        ///   This does not include popups or sub-context menus.
        ///   If it was already enabled it will do nothing.
        /// </summary>
        /// <param name="handle">HWND handle to enable support for.</param>
        /// <returns>True if it was enabled or already enabled, false if it couldn't be enabled.</returns>
        public static bool EnableMouseHorizontalWheelSupport(IntPtr handle) {
            if (_HookedWindows.Contains(handle)) {
                return true;
            }

            _HookedWindows.Add(handle);
            HwndSource source = HwndSource.FromHwnd(handle);
            if (source == null) {
                return false;
            }

            source.AddHook(WndProcHook);
            return true;
        }

        /// <summary>
        ///   Disable Horizontal Wheel support for all the controls inside the HWND.
        ///   This method does not need to be called in most cases.
        ///   This does not include popups or sub-context menus.
        ///   If it was already disabled it will do nothing.
        /// </summary>
        /// <param name="handle">HWND handle to disable support for.</param>
        /// <returns>True if it was disabled or already disabled, false if it couldn't be disabled.</returns>
        public static bool DisableMouseHorizontalWheelSupport(IntPtr handle) {
            if (!_HookedWindows.Contains(handle)) {
                return true;
            }

            HwndSource source = HwndSource.FromHwnd(handle);
            if (source == null) {
                return false;
            }

            source.RemoveHook(WndProcHook);
            _HookedWindows.Remove(handle);
            return true;
        }

        /// <summary>
        ///   Disable Horizontal Wheel support for all the controls inside the window.
        ///   This method does not need to be called in most cases.
        ///   This does not include popups or sub-context menus.
        ///   If it was already disabled it will do nothing.
        /// </summary>
        /// <param name="window">Window to disable support for.</param>
        /// <returns>True if it was disabled or already disabled, false if it couldn't be disabled.</returns>
        public static bool DisableMouseHorizontalWheelSupport([NotNull] Window window) {
            if (window == null) {
                throw new ArgumentNullException(nameof(window));
            }

            IntPtr handle = new WindowInteropHelper(window).Handle;
            return DisableMouseHorizontalWheelSupport(handle);
        }

        /// <summary>
        ///   Disable Horizontal Wheel support for all the controls inside the popup.
        ///   This method does not need to be called in most cases.
        ///   This does not include popups or sub-context menus.
        ///   If it was already disabled it will do nothing.
        /// </summary>
        /// <param name="popup">Popup to disable support for.</param>
        /// <returns>True if it was disabled or already disabled, false if it couldn't be disabled.</returns>
        public static bool DisableMouseHorizontalWheelSupport([NotNull] Popup popup) {
            if (popup == null) {
                throw new ArgumentNullException(nameof(popup));
            }

            IntPtr? handle = GetObjectParentHandle(popup.Child);
            if (handle == null) {
                return false;
            }

            return DisableMouseHorizontalWheelSupport(handle.Value);
        }

        /// <summary>
        ///   Disable Horizontal Wheel support for all the controls inside the context menu.
        ///   This method does not need to be called in most cases.
        ///   This does not include popups or sub-context menus.
        ///   If it was already disabled it will do nothing.
        /// </summary>
        /// <param name="contextMenu">Context menu to disable support for.</param>
        /// <returns>True if it was disabled or already disabled, false if it couldn't be disabled.</returns>
        public static bool DisableMouseHorizontalWheelSupport([NotNull] ContextMenu contextMenu) {
            if (contextMenu == null) {
                throw new ArgumentNullException(nameof(contextMenu));
            }

            IntPtr? handle = GetObjectParentHandle(contextMenu);
            if (handle == null) {
                return false;
            }

            return DisableMouseHorizontalWheelSupport(handle.Value);
        }


        /// <summary>
        ///   Enable Horizontal Wheel support for all that control and all controls hosted by the same window/popup/context menu.
        ///   This method does not need to be called if AutoEnableMouseHorizontalWheelSupport is true.
        ///   If it was already enabled it will do nothing.
        /// </summary>
        /// <param name="uiElement">UI Element to enable support for.</param>
        public static void EnableMouseHorizontalWheelSupportForParentOf(UIElement uiElement) {
            // try to add it right now
            if (uiElement is Window) {
                EnableMouseHorizontalWheelSupport((Window)uiElement);
            }
            else if (uiElement is Popup) {
                EnableMouseHorizontalWheelSupport((Popup)uiElement);
            }
            else if (uiElement is ContextMenu) {
                EnableMouseHorizontalWheelSupport((ContextMenu)uiElement);
            }
            else {
                IntPtr? parentHandle = GetObjectParentHandle(uiElement);
                if (parentHandle != null) {
                    EnableMouseHorizontalWheelSupport(parentHandle.Value);
                }

                // and in the rare case the parent window ever changes...
                PresentationSource.AddSourceChangedHandler(uiElement, PresenationSourceChangedHandler);
            }
        }

        private static void PresenationSourceChangedHandler(object sender, SourceChangedEventArgs sourceChangedEventArgs) {
            var src = sourceChangedEventArgs.NewSource as HwndSource;
            if (src != null) {
                EnableMouseHorizontalWheelSupport(src.Handle);
            }
        }

        private static void HandleMouseHorizontalWheel(IntPtr wParam) {
            int tilt = -Win32.HiWord(wParam);
            if (tilt == 0) {
                return;
            }

            IInputElement element = Mouse.DirectlyOver;
            if (element == null) {
                return;
            }

            if (!(element is UIElement)) {
                element = VisualTreeHelpers.FindAncestor<UIElement>(element as DependencyObject);
            }
            if (element == null) {
                return;
            }

            var ev = new MouseHorizontalWheelEventArgs(Mouse.PrimaryDevice, Environment.TickCount, tilt) {
                RoutedEvent = PreviewMouseHorizontalWheelEvent
                //Source = handledWindow
            };

            // first raise preview
            element.RaiseEvent(ev);
            if (ev.Handled) {
                return;
            }

            // then bubble it
            ev.RoutedEvent = MouseHorizontalWheelEvent;
            element.RaiseEvent(ev);
        }

        private static IntPtr WndProcHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) {
            // transform horizontal mouse wheel messages 
            switch (msg) {
                case Win32.WM_MOUSEHWHEEL:
                    HandleMouseHorizontalWheel(wParam);
                    break;
            }
            return IntPtr.Zero;
        }

        private static class Win32
        {
            // ReSharper disable InconsistentNaming
            public const int WM_MOUSEHWHEEL = 0x020E;
            // ReSharper restore InconsistentNaming

            public static int GetIntUnchecked(IntPtr value) {
                return IntPtr.Size == 8 ? unchecked((int)value.ToInt64()) : value.ToInt32();
            }

            public static int HiWord(IntPtr ptr) {
                return unchecked((short)((uint)GetIntUnchecked(ptr) >> 16));
            }
        }

        #region MouseWheelHorizontal Event

        public static readonly RoutedEvent MouseHorizontalWheelEvent =
          EventManager.RegisterRoutedEvent("MouseHorizontalWheel", RoutingStrategy.Bubble, typeof(RoutedEventHandler),
            typeof(MouseHorizontalWheelEnabler));

        public static void AddMouseHorizontalWheelHandler(DependencyObject d, RoutedEventHandler handler) {
            var uie = d as UIElement;
            if (uie != null) {
                uie.AddHandler(MouseHorizontalWheelEvent, handler);

                if (AutoEnableMouseHorizontalWheelSupport) {
                    EnableMouseHorizontalWheelSupportForParentOf(uie);
                }
            }
        }

        public static void RemoveMouseHorizontalWheelHandler(DependencyObject d, RoutedEventHandler handler) {
            var uie = d as UIElement;
            uie?.RemoveHandler(MouseHorizontalWheelEvent, handler);
        }

        #endregion

        #region PreviewMouseWheelHorizontal Event

        public static readonly RoutedEvent PreviewMouseHorizontalWheelEvent =
          EventManager.RegisterRoutedEvent("PreviewMouseHorizontalWheel", RoutingStrategy.Tunnel, typeof(RoutedEventHandler),
            typeof(MouseHorizontalWheelEnabler));

        public static void AddPreviewMouseHorizontalWheelHandler(DependencyObject d, RoutedEventHandler handler) {
            var uie = d as UIElement;
            if (uie != null) {
                uie.AddHandler(PreviewMouseHorizontalWheelEvent, handler);

                if (AutoEnableMouseHorizontalWheelSupport) {
                    EnableMouseHorizontalWheelSupportForParentOf(uie);
                }
            }
        }

        public static void RemovePreviewMouseHorizontalWheelHandler(DependencyObject d, RoutedEventHandler handler) {
            var uie = d as UIElement;
            uie?.RemoveHandler(PreviewMouseHorizontalWheelEvent, handler);
        }

        #endregion
    }
}

MouseHorizo​​ntalWheelEventArgs.cs

using System.Windows.Input;

namespace WpfExtensions
{
    public class MouseHorizontalWheelEventArgs : MouseEventArgs
    {
        public int HorizontalDelta { get; }

        public MouseHorizontalWheelEventArgs(MouseDevice mouse, int timestamp, int horizontalDelta)
          : base(mouse, timestamp) {
            HorizontalDelta = horizontalDelta;
        }
    }
}

至于VisualTreeHelpers.FindAncestor,其定义如下:

/// <summary>
///   Returns the first ancestor of specified type
/// </summary>
public static T FindAncestor<T>(DependencyObject current) where T : DependencyObject {
  current = GetVisualOrLogicalParent(current);

  while (current != null) {
    if (current is T) {
      return (T)current;
    }
    current = GetVisualOrLogicalParent(current);
  }

  return null;
}

private static DependencyObject GetVisualOrLogicalParent(DependencyObject obj) {
  if (obj is Visual || obj is Visual3D) {
    return VisualTreeHelper.GetParent(obj);
  }
  return LogicalTreeHelper.GetParent(obj);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用鼠标滚轮在 WPF 中水平滚动? 的相关文章

  • ASP.NET MVC 中的经典 ASP (C#)

    我有一个应用程序想要 最终 转换为 ASP NET MVC 我想要进行全面的服务升级 到 ASP NET 但想要使用当前的 ASP 内容来运行当前的功能 这样我就可以在对新框架进行增量升级的同时升级小部分 该站点严重依赖于不太成熟的 VB6
  • 为什么要序列化对象需要 Serialized 属性

    根据我的理解 SerializedAttribute 不提供编译时检查 因为它都是在运行时完成的 如果是这样 那么为什么需要将类标记为可序列化呢 难道序列化器不能尝试序列化一个对象然后失败吗 这不就是它现在所做的吗 当某些东西被标记时 它会
  • 构造函数中显式关键字的使用

    我试图了解 C 中显式关键字的用法 并查看了这个问题C 中的explicit关键字是什么意思 https stackoverflow com questions 121162 但是 那里列出的示例 实际上是前两个答案 对于用法并不是很清楚
  • JSON 数组到 C# 列表

    如何将这个简单的 JSON 字符串反序列化为 C 中的列表 on4ThnU7 n71YZYVKD CVfSpM2W 10kQotV 这样 List
  • WPF - 路径几何...有没有办法绑定数据属性?

    我有一个ControlTemplate作为 气泡 弹出窗口AdornerLayer给定的控制 它工作正常 但我需要能够计算它应该显示的位置 中间 底部 代替
  • 如何配置 WebService 返回 ArrayList 而不是 Array?

    我有一个在 jax ws 上实现的 java Web 服务 此 Web 服务返回用户的通用列表 它运行得很好 Stateless name AdminToolSessionEJB RemoteBinding jndiBinding Admi
  • 如何从 C# 控制器重定向到外部 url

    我使用 C 控制器作为网络服务 在其中我想将用户重定向到外部网址 我该怎么做 Tried System Web HttpContext Current Response Redirect 但没有成功 使用控制器的重定向 http msdn
  • 检查算术运算中的溢出情况[重复]

    这个问题在这里已经有答案了 可能的重复 检测 C C 中整数溢出的最佳方法 https stackoverflow com questions 199333 best way to detect integer overflow in c
  • 如何从网站下载 .EXE 文件?

    我正在编写一个应用程序 需要从网站下载 exe 文件 我正在使用 Visual Studio Express 2008 我正在使用以下代码 private void button1 Click object sender EventArgs
  • C 语言中 =+(等于加)是什么意思?

    我碰到 与标准相反 今天在一些 C 代码中 我不太确定这里发生了什么 我在文档中也找不到它 In ancientC 版本 相当于 它的残余物与最早的恐龙骨头一起被发现 例如 B 引入了广义赋值运算符 使用x y to add y to x
  • 将构建日期放入“关于”框中

    我有一个带有 关于 框的 C WinForms 应用程序 我使用以下方法将版本号放入 关于 框中 FileVersionInfo GetVersionInfo Assembly GetExecutingAssembly Location F
  • 当我“绘制”线条时,如何将点平均分配到 LineRenderer 的宽度曲线?

    我正在使用线条渲染器创建一个 绘图 应用程序 现在我尝试使用线条渲染器上的宽度曲线启用笔压 问题在于 AnimationCurve 的 时间 值 水平轴 从 0 标准化为 1 因此我不能在每次添加位置时都在其末尾添加一个值 除非有一个我不知
  • 获取 2 个数据集 c# 中的差异

    我正在编写一个简短的算法 它必须比较两个数据集 以便可以进一步处理两者之间的差异 我尝试通过合并这两个数据集并将结果更改放入新的数据集来实现此目标 我的方法如下所示 private DataSet ComputateDiff DataSet
  • 如何一步步遍历目录树?

    我发现了很多关于遍历目录树的示例 但我需要一些不同的东西 我需要一个带有某种方法的类 每次调用都会从目录返回一个文件 并逐渐遍历目录树 请问我该怎么做 我正在使用函数 FindFirstFile FindNextFile 和 FindClo
  • 尚未处理时调用 Form 的 Invoke 时出现 ObjectDisposeException

    我们得到一个ObjectDisposedException从一个电话到Invoke在尚未处理的表格上 这是一些演示该问题的示例代码 public partial class Form2 Form void Form2 Load object
  • 将代码拆分为标头/源文件

    我从 Asio 的示例页面中获取了以下代码 class tcp connection public boost enable shared from this
  • 剪贴板在 .NET 3.5 和 4 中的行为有所不同,但为什么呢?

    我们最近将一个非常大的项目从 NET Framework 3 5 升级到 4 最初一切似乎都工作正常 但现在复制粘贴操作开始出现错误 我已经成功制作了一个小型的可复制应用程序 它显示了 NET 3 5 和 4 中的不同行为 我还找到了一种解
  • 我在在线程序挑战编译器中遇到演示错误

    include
  • 是否可以在 C# 中强制接口实现为虚拟?

    我今天遇到了一个问题 试图重写尚未声明为虚拟的接口方法的实现 在这种情况下 我无法更改接口或基本实现 而必须尝试其他方法 但我想知道是否有一种方法可以强制类使用虚拟方法实现接口 Example interface IBuilder
  • 错误:无效使用不完整类型“类 Move”/未定义对 Move::NONE 的引用

    拜托 我不知道为什么这个简单的代码被拒绝 它给了我 2 个编译错误 请帮帮我 I use 代码 块 20 03 我的编译器是GNU GCC 移动 hpp class Move public Move Move int int public

随机推荐

  • 用作默认参数的 C#“常量对象”

    有没有办法创建一个常量对象 即它不能编辑并且在编译时创建 我只是在玩 C 语言 注意到可选参数功能 并认为能够使用默认对象作为可选参数可能会很不错 考虑以下 this class has default settings private c
  • 无状态 Apache Wicket 无状态页面/请求

    所以我在读另一个问题 https stackoverflow com questions 2168249在 Wicket 标签下进行比较阿帕奇检票口 http wicket apache org and 阿帕奇点击 http incubat
  • 将电子表格数据显示为 HTML 表格

    我的 HTML 表有问题 我希望我的电子表格数据显示在那里 我不知道我错过了什么 这是我的代码 GS function getTableData var url3 https docs google com spreadsheets d x
  • Vue 3:getCurrentInstance() 是否已弃用?

    我看过参考文献getCurrentInstance 可以在一些旧的 文档和代码上使用 但在当前的 Vue 3 文档中找不到它 Is getCurrentInstance 已弃用 如果有 原因是什么 inject 考虑够了吗 如果没有 为什么
  • Ruby 在哪里跟踪其打开的文件描述符?

    这个问题是什么Not About 这个问题是not关于如何使用 File close 或 File open 块语法自动关闭文件 这是一个关于 Ruby 在运行时将打开的文件描述符列表存储在哪里的问题 实际问题 如果您有一个具有打开描述符的
  • Typeahead.js 在 Knockout 3 foreach 绑定中不起作用

    我将一个 Web 应用程序更新为 Bootstrap 3 和 Knockout 3 因此丢失了 Bootstrap 2 中的内置 typeahead 我添加了 typeahead js 它工作得很好 除非我在 Knockout foreac
  • 如何在C#中快速将二维数组转换为一维数组?

    我有一个多维的double 数组 其大小为 1 N 假设 N 已知 将其转换为一维的最快方法是什么double 长度为 N 的数组 我是 C 新手 我用它与 Matlab 函数交互 我使用的 Matlab 函数返回一个一维行向量 在 C 中
  • 如何确定 DICOM 系列是 3D 体积还是一系列图像?

    我们正在为 dicom 文件编写一个导入器 人们通常如何确定一系列图像形成 3D 体积还是只是一系列 2D 图像 对于大多数供应商来说 是否有通用的方法来决定这一点 我查看了 DICOM 标签 但找不到明显的解决方案 DICOM 标准定义了
  • 如何捕获Tomcat启动日志

    如何捕获Tomcat启动日志 要在Windows中启动Tomcat 可以执行命令 卡塔琳娜运行 在你的 tomcat bin 文件夹中 Tomcat 启动的输出将保留在当前窗口中 以便您可以对其进行分析
  • ValidationResult.MemberNames 属性是否会包含多个值?

    我用反射器搜索 但没有找到一个案例ValidationResult MemberNames http msdn microsoft com en us library system componentmodel dataannotation
  • VBA Excel 中的范围查找

    我正在尝试使用以下指令在 Excel 工作表中执行 查找 Set Found Columns 2 Find What value to find After ActiveCell LookIn xlFormulas LookAt xlPar
  • 有关 IsNullOrWhiteSpace() 的快速提示中的“字符串”与“字符串”

    在 Visual Studio 2015 中工作 我对以下效果进行了条件检查 if String IsNullOrWhiteSpace stringToTest 我看到了一个 IDE001快速提示或行动 https msdn microso
  • 与分布式源代码控制的持续集成

    我想我误解了一些东西 但无法找到到底是什么 我用谷歌搜索 但没有明白这个想法 有两种流行的技术 持续集成和分布式源代码控制 人们以某种 方式将它们结合起来 但我不明白如何结合 AFAIK 持续集成意味着在本地测试代码后立即提交到中央存储库
  • 如何使 WPF 滑块拇指从任意点跟随光标

    我有这样的滑块
  • Google Spreadsheet API 插入图像

    有没有办法通过谷歌电子表格API插入图像 我查看了文档 但除了插入 更新 删除行之外 没有提及与工作表相关的其他数据 例如图像 例如 在 Excel 上 图像附加到工作表而不是任何特定单元格 因此 您必须从工作表中插入删除图像 然后将其放置
  • 如何在 Ubuntu Web 服务器上为 Dart 安装 pub(命令行使用)

    我已按照说明进行操作 在 Linux 选项卡下 将 Dart 安装到 Ubuntu Web 服务器上 Dart 本身工作正常 但我无法使用 Pub 命令 仅限 Dart 命令 如何为服务器安装 Pub 以下是使用 Aptitude apt
  • Google Assistant Dialogflow API V2 webhook ETag 错误

    我正在尝试返回简单的文本响应并使用以下代码在 Google Assistant 应用程序中显示基本卡片 public GoogleCloudDialogflowV2WebhookResponse Search GoogleCloudDial
  • Hadoop 块大小 vs 分割 vs 块大小

    我对 Hadoop 的概念有点困惑 有什么区别Hadoop Chunk size Split size and Block size 提前致谢 块大小和块大小是一样的 分体尺寸可能不同于块 块 size 地图缩减算法不适用于文件的物理块 它
  • 获取当月第一天的最有效方法是什么?

    使用 ruby 我尝试将日期格式化为 2009 10 01 我采用当前日期 2009 10 26 然后将日期更改为 01 我知道有多种方法可以做到这一点 但很好奇从代码角度来看 实现这一目标的最短方法是什么 如果您不介意在应用程序中包含 A
  • 如何使用鼠标滚轮在 WPF 中水平滚动?

    如何使 WPF 能够响应使用鼠标滚轮的水平滚动 例如 我有一个 Microsoft Explorer 迷你鼠标 并尝试使用以下命令水平滚动 ScrollViewer 中包含的内容 HorizontalScrollBarVisibility