更改分割线突出显示/调整线条大小

2024-01-13

我注意到,当我在 Visual Studio 中调整元素大小时,分割线会被涂成纯透明的黑色,如下所示:

然而,在我自己的 Winforms 应用程序中,我得到了以下调整大小行:

我想知道如何改变这条调整线的绘画?


如果你看一下分离器源代码 http://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/Splitter.cs,您将看到高光的绘制是在绘制分割助手 http://referencesource.microsoft.com/#System.Windows.Forms/winforms/Managed/System/WinForms/Splitter.cs,aba0d38fa9c1c11b私有方法。

由于拆分器方法紧密依赖于控件的私有成员,因此重写使用此方法的控件的成员或处理事件并不能简单地提供这种透明的突出显示。此外,如果您决定暗淡高光,则无法获得无闪烁的绘图,因为控件在私有方法中绘制半色调高光。

显示透明突出显示的想法是基于显示最上面的半透明窗口,该窗口在显示时不会激活。您也可以使用PatBlt方法使用画笔绘制可反转的矩形。

作为一个选项,我从 Splitter.cs 开始,并将其更改为绘制所需的透明突出显示,如下图所示:

Code

作为一个选项,我从 Splitter.cs 开始并将其更改为绘制所需的透明突出显示。我用了一个Form显示透明高亮。我在没有激活的情况下显示了表单,将其显示为最顶层并具有适当的不透明度。

也许您可以使用更少的代码创建一个拆分器,但我更喜欢使用 Splitter 的源代码而不是编写自己的拆分器。感谢微软分享源代码。

using System;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System.Drawing.Drawing2D;
using System.Reflection;
[ComVisible(true)]
[DefaultEvent("SplitterMoved")]
[DefaultProperty("Dock")]
[Designer(typeof(MySplitterDesigner))]
public class MySplitter : Control
{
    private Point anchor = Point.Empty;
    private System.Windows.Forms.BorderStyle borderStyle;
    private const int defaultWidth = 3;
    private const int DRAW_END = 3;
    private const int DRAW_MOVE = 2;
    private const int DRAW_START = 1;
    private static readonly object EVENT_MOVED = new object();
    private static readonly object EVENT_MOVING = new object();
    private int initTargetSize;
    private int lastDrawSplit = -1;
    private int maxSize;
    private int minExtra = 25;
    private int minSize = 25;
    private int splitSize = -1;
    private Control splitTarget;
    private SplitterMessageFilter splitterMessageFilter;
    private int splitterThickness = 3;
    [Category("Behavior")]
    [Description("Occurs when the splitter is done being moved.")]
    public event SplitterEventHandler SplitterMoved
    {
        add
        {
            base.Events.AddHandler(EVENT_MOVED, value);
        }
        remove
        {
            base.Events.RemoveHandler(EVENT_MOVED, value);
        }
    }
    [Category("Behavior")]
    [Description("Occurs when the splitter is being moved.")]
    public event SplitterEventHandler SplitterMoving
    {
        add
        {
            base.Events.AddHandler(EVENT_MOVING, value);
        }
        remove
        {
            base.Events.RemoveHandler(EVENT_MOVING, value);
        }
    }
    HighLight highlight;
    public MySplitter()
    {
        base.SetStyle(ControlStyles.Selectable, false);
        this.TabStop = false;
        this.minSize = 0x19;
        this.minExtra = 0x19;
        this.Dock = DockStyle.Left;
        highlight = new HighLight();
    }
    private void ApplySplitPosition()
    {
        this.SplitPosition = this.splitSize;
    }
    private SplitData CalcSplitBounds()
    {
        SplitData data = new SplitData();
        Control control = this.FindTarget();
        data.target = control;
        if (control != null)
        {
            switch (control.Dock)
            {
                case DockStyle.Top:
                case DockStyle.Bottom:
                    this.initTargetSize = control.Bounds.Height;
                    break;

                case DockStyle.Left:
                case DockStyle.Right:
                    this.initTargetSize = control.Bounds.Width;
                    break;
            }
            Control parentInternal = this.Parent;
            Control.ControlCollection controls = parentInternal.Controls;
            int count = controls.Count;
            int num2 = 0;
            int num3 = 0;
            for (int i = 0; i < count; i++)
            {
                Control control3 = controls[i];
                if (control3 != control)
                {
                    switch (control3.Dock)
                    {
                        case DockStyle.Top:
                        case DockStyle.Bottom:
                            num3 += control3.Height;
                            break;

                        case DockStyle.Left:
                        case DockStyle.Right:
                            num2 += control3.Width;
                            break;
                    }
                }
            }
            Size clientSize = parentInternal.ClientSize;
            if (this.Horizontal)
            {
                this.maxSize = (clientSize.Width - num2) - this.minExtra;
            }
            else
            {
                this.maxSize = (clientSize.Height - num3) - this.minExtra;
            }
            data.dockWidth = num2;
            data.dockHeight = num3;
        }
        return data;
    }
    private Rectangle CalcSplitLine(int splitSize, int minWeight)
    {
        Rectangle bounds = base.Bounds;
        Rectangle rectangle2 = this.splitTarget.Bounds;
        switch (this.Dock)
        {
            case DockStyle.Top:
                if (bounds.Height < minWeight)
                {
                    bounds.Height = minWeight;
                }
                bounds.Y = rectangle2.Y + splitSize;
                return bounds;

            case DockStyle.Bottom:
                if (bounds.Height < minWeight)
                {
                    bounds.Height = minWeight;
                }
                bounds.Y = ((rectangle2.Y + rectangle2.Height) - splitSize) - bounds.Height;
                return bounds;

            case DockStyle.Left:
                if (bounds.Width < minWeight)
                {
                    bounds.Width = minWeight;
                }
                bounds.X = rectangle2.X + splitSize;
                return bounds;

            case DockStyle.Right:
                if (bounds.Width < minWeight)
                {
                    bounds.Width = minWeight;
                }
                bounds.X = ((rectangle2.X + rectangle2.Width) - splitSize) - bounds.Width;
                return bounds;
        }
        return bounds;
    }
    private int CalcSplitSize()
    {
        Control control = this.FindTarget();
        if (control != null)
        {
            Rectangle bounds = control.Bounds;
            switch (this.Dock)
            {
                case DockStyle.Top:
                case DockStyle.Bottom:
                    return bounds.Height;

                case DockStyle.Left:
                case DockStyle.Right:
                    return bounds.Width;
            }
        }
        return -1;
    }
    private void DrawSplitBar(int mode)
    {
        if ((mode != 1) && (this.lastDrawSplit != -1))
        {
            this.DrawSplitHelper(this.lastDrawSplit);
            this.lastDrawSplit = -1;
        }
        else if ((mode != 1) && (this.lastDrawSplit == -1))
        {
            return;
        }
        if (mode != 3)
        {
            this.DrawSplitHelper(this.splitSize);
            this.lastDrawSplit = this.splitSize;
        }
        else
        {
            if (this.lastDrawSplit != -1)
            {
                this.DrawSplitHelper(this.lastDrawSplit);
            }
            this.lastDrawSplit = -1;
            highlight.Hide();
        }
        Console.WriteLine(mode);
    }
    private void DrawSplitHelper(int splitSize)
    {
        if (this.splitTarget != null)
        {
            Rectangle rectangle = this.CalcSplitLine(splitSize, 3);
            var r = this.Parent.RectangleToScreen(rectangle);
            if (!highlight.Visible)
                highlight.ShowInactiveTopmost();
            highlight.Location = r.Location;
            highlight.Size = r.Size;
        }
    }
    private Control FindTarget()
    {
        Control parentInternal = this.Parent;
        if (parentInternal != null)
        {
            Control.ControlCollection controls = parentInternal.Controls;
            int count = controls.Count;
            DockStyle dock = this.Dock;
            for (int i = 0; i < count; i++)
            {
                Control control2 = controls[i];
                if (control2 != this)
                {
                    switch (dock)
                    {
                        case DockStyle.Top:
                            if (control2.Bottom != base.Top)
                            {
                                break;
                            }
                            return control2;

                        case DockStyle.Bottom:
                            if (control2.Top != base.Bottom)
                            {
                                break;
                            }
                            return control2;

                        case DockStyle.Left:
                            if (control2.Right != base.Left)
                            {
                                break;
                            }
                            return control2;

                        case DockStyle.Right:
                            if (control2.Left != base.Right)
                            {
                                break;
                            }
                            return control2;
                    }
                }
            }
        }
        return null;
    }
    private int GetSplitSize(int x, int y)
    {
        int num;
        if (this.Horizontal)
            num = x - this.anchor.X;
        else
            num = y - this.anchor.Y;
        int num2 = 0;
        switch (this.Dock)
        {
            case DockStyle.Top:
                num2 = this.splitTarget.Height + num;
                break;
            case DockStyle.Bottom:
                num2 = this.splitTarget.Height - num;
                break;
            case DockStyle.Left:
                num2 = this.splitTarget.Width + num;
                break;
            case DockStyle.Right:
                num2 = this.splitTarget.Width - num;
                break;
        }
        return Math.Max(Math.Min(num2, this.maxSize), this.minSize);
    }
    protected override void OnKeyDown(KeyEventArgs e)
    {
        base.OnKeyDown(e);
        if ((this.splitTarget != null) && (e.KeyCode == Keys.Escape))
            this.SplitEnd(false);
    }
    protected override void OnMouseDown(MouseEventArgs e)
    {
        base.OnMouseDown(e);
        if ((e.Button == MouseButtons.Left) && (e.Clicks == 1))
            this.SplitBegin(e.X, e.Y);
    }
    protected override void OnMouseMove(MouseEventArgs e)
    {
        base.OnMouseMove(e);
        if (this.splitTarget != null)
        {
            int x = e.X + base.Left;
            int y = e.Y + base.Top;
            Rectangle rectangle = this.CalcSplitLine(this.GetSplitSize(e.X, e.Y), 0);
            int splitX = rectangle.X;
            int splitY = rectangle.Y;
            this.OnSplitterMoving(new SplitterEventArgs(x, y, splitX, splitY));
        }
    }
    protected override void OnMouseUp(MouseEventArgs e)
    {
        base.OnMouseUp(e);
        if (this.splitTarget != null)
        {
            Rectangle rectangle = this.CalcSplitLine(this.GetSplitSize(e.X, e.Y), 0);
            this.SplitEnd(true);
        }
    }
    protected virtual void OnSplitterMoved(SplitterEventArgs sevent)
    {
        SplitterEventHandler handler = (SplitterEventHandler)base.Events[EVENT_MOVED];
        if (handler != null)
            handler(this, sevent);
        if (this.splitTarget != null)
            this.SplitMove(sevent.SplitX, sevent.SplitY);
    }
    protected virtual void OnSplitterMoving(SplitterEventArgs sevent)
    {
        SplitterEventHandler handler = (SplitterEventHandler)base.Events[EVENT_MOVING];
        if (handler != null)
            handler(this, sevent);
        if (this.splitTarget != null)
            this.SplitMove(sevent.SplitX, sevent.SplitY);
    }
    protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
    {
        if (this.Horizontal)
        {
            if (width < 1)
                width = 3;
            this.splitterThickness = width;
        }
        else
        {
            if (height < 1)
                height = 3;
            this.splitterThickness = height;
        }
        base.SetBoundsCore(x, y, width, height, specified);
    }
    private void SplitBegin(int x, int y)
    {
        SplitData data = this.CalcSplitBounds();
        if ((data.target != null) && (this.minSize < this.maxSize))
        {
            this.anchor = new Point(x, y);
            this.splitTarget = data.target;
            this.splitSize = this.GetSplitSize(x, y);
            try
            {
                if (this.splitterMessageFilter != null)
                    this.splitterMessageFilter = new SplitterMessageFilter(this);
                Application.AddMessageFilter(this.splitterMessageFilter);
            }
            finally { }
            this.Capture = true;
            this.DrawSplitBar(1);
        }
    }
    private void SplitEnd(bool accept)
    {
        this.DrawSplitBar(3);
        this.splitTarget = null;
        this.Capture = false;
        if (this.splitterMessageFilter != null)
        {
            Application.RemoveMessageFilter(this.splitterMessageFilter);
            this.splitterMessageFilter = null;
        }
        if (accept)
            this.ApplySplitPosition();
        else if (this.splitSize != this.initTargetSize)
            this.SplitPosition = this.initTargetSize;
        this.anchor = Point.Empty;
    }
    private void SplitMove(int x, int y)
    {
        int splitSize = this.GetSplitSize((x - base.Left) + this.anchor.X, (y - base.Top) + this.anchor.Y);
        if (this.splitSize != splitSize)
        {
            this.splitSize = splitSize;
            this.DrawSplitBar(2);
        }
    }
    public override string ToString()
    {
        string str = base.ToString();
        string[] textArray1 = new string[] { str, ", MinExtra: ", this.MinExtra.ToString(CultureInfo.CurrentCulture), ", MinSize: ", this.MinSize.ToString(CultureInfo.CurrentCulture) };
        return string.Concat(textArray1);
    }
    [DefaultValue(0)]
    [Category("Appearance")]
    [Description("The border type of the control.")]
    public System.Windows.Forms.BorderStyle BorderStyle
    {
        get
        {
            return this.borderStyle;
        }
        set
        {
            if (!IsEnumValid(value, (int)value, 0, 2))
                throw new InvalidEnumArgumentException("value", (int)value, typeof(System.Windows.Forms.BorderStyle));
            if (this.borderStyle != value)
            {
                this.borderStyle = value;
                base.UpdateStyles();
            }
        }
    }
    protected override System.Windows.Forms.CreateParams CreateParams
    {
        get
        {
            System.Windows.Forms.CreateParams createParams = base.CreateParams;
            createParams.ExStyle &= -513;
            createParams.Style &= -8388609;
            System.Windows.Forms.BorderStyle borderStyle = this.borderStyle;
            if (borderStyle != System.Windows.Forms.BorderStyle.FixedSingle)
            {
                if (borderStyle == System.Windows.Forms.BorderStyle.Fixed3D)
                {
                    createParams.ExStyle |= 0x200;
                }
                return createParams;
            }
            createParams.Style |= 0x800000;
            return createParams;
        }
    }
    protected override Cursor DefaultCursor
    {
        get
        {
            switch (this.Dock)
            {
                case DockStyle.Top:
                case DockStyle.Bottom:
                    return Cursors.HSplit;
                case DockStyle.Left:
                case DockStyle.Right:
                    return Cursors.VSplit;
            }
            return base.DefaultCursor;
        }
    }
    protected override System.Windows.Forms.ImeMode DefaultImeMode
    {
        get
        {
            return System.Windows.Forms.ImeMode.Disable;
        }
    }
    protected override Size DefaultSize
    {
        get { return new Size(3, 3); }
    }
    [Localizable(true), DefaultValue(3)]
    public override DockStyle Dock
    {
        get { return base.Dock; }
        set
        {
            if (((value != DockStyle.Top) && (value != DockStyle.Bottom)) && ((value != DockStyle.Left) && (value != DockStyle.Right)))
                throw new ArgumentException("Splitter control must be docked left, right, top, or bottom.");
            int splitterThickness = this.splitterThickness;
            base.Dock = value;
            switch (this.Dock)
            {
                case DockStyle.Top:
                case DockStyle.Bottom:
                    if (this.splitterThickness == -1)
                        break;
                    base.Height = splitterThickness;
                    return;
                case DockStyle.Left:
                case DockStyle.Right:
                    if (this.splitterThickness != -1)
                        base.Width = splitterThickness;
                    break;
                default:
                    return;
            }
        }
    }
    private bool Horizontal
    {
        get
        {
            DockStyle dock = this.Dock;
            if (dock != DockStyle.Left)
                return (dock == DockStyle.Right);
            return true;
        }
    }
    [Category("Behavior")]
    [Localizable(true)]
    [DefaultValue(25)]
    [Description("Specifies the minimum size of the undocked area.")]
    public int MinExtra
    {
        get { return this.minExtra; }
        set
        {
            if (value < 0)
                value = 0;
            this.minExtra = value;
        }
    }
    [Category("Behavior")]
    [Localizable(true)]
    [DefaultValue(25)]
    [Description("Specifies the minimum size of the control being resized.")]
    public int MinSize
    {
        get { return this.minSize; }
        set
        {
            if (value < 0)
                value = 0;
            this.minSize = value;
        }
    }
    [Category("Layout")]
    [Browsable(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    [Description("The current position of the splitter, or -1 if it is not bound to a control.")]
    public int SplitPosition
    {
        get
        {
            if (this.splitSize == -1)
            {
                this.splitSize = this.CalcSplitSize();
            }
            return this.splitSize;
        }
        set
        {
            SplitData data = this.CalcSplitBounds();
            if (value > this.maxSize)
            {
                value = this.maxSize;
            }
            if (value < this.minSize)
            {
                value = this.minSize;
            }
            this.splitSize = value;
            this.DrawSplitBar(3);
            if (data.target == null)
            {
                this.splitSize = -1;
            }
            else
            {
                Rectangle bounds = data.target.Bounds;
                switch (this.Dock)
                {
                    case DockStyle.Top:
                        bounds.Height = value;
                        break;

                    case DockStyle.Bottom:
                        bounds.Y += bounds.Height - this.splitSize;
                        bounds.Height = value;
                        break;

                    case DockStyle.Left:
                        bounds.Width = value;
                        break;

                    case DockStyle.Right:
                        bounds.X += bounds.Width - this.splitSize;
                        bounds.Width = value;
                        break;
                }
                data.target.Bounds = bounds;
                Application.DoEvents();
                this.OnSplitterMoved(new SplitterEventArgs(base.Left, base.Top, base.Left + (bounds.Width / 2), base.Top + (bounds.Height / 2)));
            }
        }
    }
    private class SplitData
    {
        public int dockHeight = -1;
        public int dockWidth = -1;
        internal Control target;
    }
    private class SplitterMessageFilter : IMessageFilter
    {
        private MySplitter owner;
        public SplitterMessageFilter(MySplitter splitter)
        {
            this.owner = splitter;
        }
        public bool PreFilterMessage(ref Message m)
        {
            if ((m.Msg < 0x100) || (m.Msg > 0x108))
            {
                return false;
            }
            if ((m.Msg == 0x100) && (((int)((long)m.WParam)) == 0x1b))
            {
                this.owner.SplitEnd(false);
            }
            return true;
        }
    }
    private static bool IsEnumValid(Enum enumValue, int value, int minValue, int maxValue)
    {
        return ((value >= minValue) && (value <= maxValue));
    }
}

public class MySplitterDesigner : ControlDesigner
{
    public MySplitterDesigner() { base.AutoResizeHandles = true; }
    private void DrawBorder(Graphics graphics)
    {
        Color white;
        Control control = this.Control;
        Rectangle clientRectangle = control.ClientRectangle;
        if (control.BackColor.GetBrightness() < 0.5)
            white = Color.White;
        else
            white = Color.Black;
        using (Pen pen = new Pen(white))
        {
            pen.DashStyle = DashStyle.Dash;
            clientRectangle.Width--;
            clientRectangle.Height--;
            graphics.DrawRectangle(pen, clientRectangle);
        }
    }
    protected override void OnPaintAdornments(PaintEventArgs pe)
    {
        base.OnPaintAdornments(pe);
        if (((MySplitter)base.Component).BorderStyle == BorderStyle.None)
            this.DrawBorder(pe.Graphics);
    }
    protected override void WndProc(ref Message m)
    {
        if (m.Msg == 0x47)
            this.Control.Invalidate();
        base.WndProc(ref m);
    }
}

这是突出显示的形式:

public class HighLight : Form
{
    public HighLight()
    {
        FormBorderStyle = FormBorderStyle.None;
        BackColor = Color.Black;
        Opacity = 0;
        ShowInTaskbar = false;
        StartPosition = FormStartPosition.Manual;
    }
    protected override void OnDeactivate(EventArgs e)
    {
        base.OnDeactivate(e);
        this.Hide();
    }
    private const int SW_SHOWNOACTIVATE = 4;
    private const int HWND_TOPMOST = -1;
    private const uint SWP_NOACTIVATE = 0x0010;

    [DllImport("user32.dll", EntryPoint = "SetWindowPos")]
    static extern bool SetWindowPos(int hWnd, int hWndInsertAfter, 
         int X, int Y, int cx, int cy, uint uFlags);

    [DllImport("user32.dll")]
    static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

    public void ShowInactiveTopmost()
    {
        ShowWindow(this.Handle, SW_SHOWNOACTIVATE);
        SetWindowPos(this.Handle.ToInt32(), HWND_TOPMOST,
        this.Left, this.Top, this.Width, this.Height,
        SWP_NOACTIVATE);
        this.Opacity = 0.3;
    }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

更改分割线突出显示/调整线条大小 的相关文章

  • Qt - QProcess 不工作

    我尝试启动 Internet Explorer 所以我使用下面的代码 QProcess process new QProcess this QString temp C Program Files Internet Explorer iex
  • 使用 CMake 时如何导出 Emscripten 中的 C 函数

    In 本教程 https emscripten org docs porting connecting cpp and javascript Interacting with code html interacting with code
  • 按扩展名过滤搜索文件返回太多结果

    我正在开发一个 C 控制台应用程序 它必须管理 Windows 操作系统上的文件 我需要获取具有特定扩展名的文件名 列表 我找到了很多解决方案 最建议的是以下一种 HANDLE hFind WIN32 FIND DATA data hFin
  • 前向声明类型和“已声明为类类型的非类类型”

    我对以下代码有问题 template
  • MVC3中设置下拉列表中的所选项目

    我必须为视图中的下拉列表设置所选项目 但它不起作用 View div class editor label Html LabelFor model gt model Gender div div class editor field Htm
  • 当事件button.click发生时,如何获取按钮名称/标签?

    我以编程方式制作按钮并将它们添加到堆栈面板中 以便每次用户导航到页面时按钮都会发生变化 我正在尝试做这样的事情 当我单击创建的按钮时 它将获取按钮的标签并转到正确的页面 但是 我无法使用 RoutedEventHandler 访问按钮元素
  • 有些有助于理解“产量”

    在我不断追求少吸的过程中 我试图理解 产量 的说法 但我不断遇到同样的错误 someMethod 的主体不能是迭代器块 因为 System Collections Generic List 不是迭代器接口类型 这是我被卡住的代码 forea
  • 如何将 .txt 文件中的数据转换为 xml? C#

    我在一个文本文件中有数千行数据 我想通过将其转换为更容易搜索的内容来轻松搜索 我希望 XML 或其他类型的大型数据结构 尽管我不确定它是否是最好的对于我的想法 每行的数据如下所示 第 31 册 托马斯 乔治 32 34 154 每本书都不是
  • Eigen 和 OpenMP:由于错误共享和线程开销而没有并行化

    系统规格 Intel Xeon E7 v3 处理器 4 插槽 16 核 插槽 2 线程 核心 Eigen 系列和 C 的使用 以下是代码片段的串行实现 Eigen VectorXd get Row const int j const int
  • 什么是空终止字符串?

    它与什么不同标准 字符串 http www cplusplus com reference string string 字符串 实际上只是一个数组chars 空终止字符串是指其中包含空字符的字符串 0 标记字符串的结尾 不一定是数组的结尾
  • 在 C# 中检查 PowerShell 执行策略的最佳方法是什么?

    当你跑步时Get ExecutionPolicy在 PowerShell 中 它得到有效的执行政策 https learn microsoft com en us powershell module microsoft powershell
  • 是否使用 C# 数据集? [关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 我对 C 中的数据集概念有点困惑 编码 ASP NET 站点 但这并不重要 在我的阅读中 我了解到它们 本质上 用作我的应用程序和我的
  • 在 .NET MAUI 中实现 TouchTracking

    我一直致力于将我们的应用程序从 Xamarin Forms 迁移到 NET MAUI 我们的应用程序几乎没有绘图功能 用户可以用手指进行绘图 我们用了TouchTrackingXamarin Forms 中的 nuget 包 但与 NET
  • 比较:接口方法、虚方法、抽象方法

    它们各自的优点和缺点是什么 接口方法 虚拟方法 抽象方法 什么时候应该选择什么 做出这一决定时应牢记哪些要点 虚拟和抽象几乎是一样的 虚方法在基类中有一个实现 可以选择重写 而抽象方法则没有 并且must在子类中被覆盖 否则它们是相同的 在
  • 模板类的模板构造函数的 C++ 显式模板特化

    我有一个像这样的课程 template
  • 使动态创建的链接标签在 Winforms 中可点击

    我正在制作一个程序 允许用户单击由动态链接标签创建的公司名称 在我想知道如何做到这一点之前 我从未在 C 中使用过链接标签 可为特定用户生成的业务数量各不相同 因此每个用户的链接标签数量并不相同 然后我想捕获业务 ID 以进行 Json 调
  • 代码中的.net Access Forms身份验证“超时”值

    我正在向我的应用程序添加注销过期警报 并希望从我的代码访问我的 web config 表单身份验证 超时 值 我有什么办法可以做到这一点吗 我认为您可以从 FormsAuthentication 静态类方法中读取它 这比直接读取 web c
  • Visual Studio 2015 - Web 项目上缺少共享项目参考选项卡

    我从 MSDN 订阅升级到 Visual Studio 2015 因为我非常兴奋地阅读有关共享项目的信息 当我们想要做的只是重用代码时 不再需要在依赖项中管理 21382 个 nuget 包 所以我构建了一个测试共享项目 其中包含一些代码
  • 了解 Lambda 表达式和委托 [关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 我已经尝试解决这个问题很长一段时间了 阅读在线博客和文章 但到目前为止还没有成功 什么是代表 什么是 Lambda 表达式 两者的优点
  • 当用户更改 Windows 中的语言键盘布局时如何通知?

    I want to show a message to user when the user changes the language keyboard layout of Windows for example from EN to FR

随机推荐

  • 在二维数组上查找第 K 个最小元素(或中值)的最快算法?

    我看到很多相关主题的 SO 主题 但没有一个提供有效的方法 我想找到k th二维数组上的最小元素 或中值 1 M 1 N 其中每行按升序排序 并且所有元素都是不同的 我认为有O M log MN 解决方案 但我不知道实施 中位数的中位数或使
  • 在 pyjade 解决方法中包含 mixin

    正如github问题中提到的 70 https github com SyrusAkbary pyjade issues 70包括 mixins 不受支持 有什么好的解决方法或替代解决方案吗 Pyjade 的 include 实现不支持 m
  • 为 python 项目构建一个wheel/egg以及所有依赖项

    为了在我们公司内部署 python 项目 我需要制作一个可安装的发行版 这应该包括 为我的项目提供一个鸡蛋或whl 项目的每个依赖项都有一个 Egg 或 WHL 可选 生成一个requirements txt 文件 列出此版本的所有可安装组
  • 如何将cefpython编译为exe

    我在用头孢Python https code google com p cefpython 创建一个简单的基于 HTML5 的应用程序 我正在使用 Python 和 pywin32 绘制一个简单的窗口并在那里渲染框架 我想编译我的 py进入
  • 使用curl循环遍历url的Shell脚本

    我一直在尝试创建一个简单的脚本 该脚本将从 txt 文件中获取查询列表 附加主 url 变量 然后抓取内容并将其输出到文本文件 这是我到目前为止所拥有的 bin bash url example com q for i in cat que
  • main函数中的返回类型可以省略吗? [复制]

    这个问题在这里已经有答案了 对于申报有什么特殊规定吗 main功能 根据ideone http ideone com eEoa8n这是合法的 C main As opposed to int main return 0 另一方面 普通函数似
  • 将属性从 inSequence 传递到 outSequence

    我正在使用代理向 HL7 TCP IP 端口发送消息 并在 outSequence 中获取响应 但我的问题是 inSequence 中设置的所有属性都不再可用 它们全部为空 我测试了所有不同的范围 传输 axis2 axis2 client
  • Android Eclipse 项目上 Assets 文件夹中的自己的数据库

    我的 Android 应用程序有一个大问题 我第一次使用 sqlite 数据库开发 Android 应用程序 但我遇到了无法解决的问题 我的 sqlite 数据库位于 eclipse 项目的资产文件夹中 名称为 saldb sqlite 我
  • 窗口在所有空间(包括其他全屏应用程序)上可见

    我正在尝试使窗口 NSWindow 在所有空间 包括其他全屏应用程序窗口 上可见 我一直在尝试设置更高的窗口级别以及在检查器中使用曝光和空间设置 我在这里找到了一些解决方案 但它们不起作用 至少在酋长岩是这样 这是要测试的示例代码 let
  • 检查Firestore中的任何文档是否包含子字符串[重复]

    这个问题在这里已经有答案了 我在 Firestore 中收集了大量具有随机 ID 的文档 每个文档都有两个字段 名称和描述 我希望我的应用程序允许用户输入一系列字符 然后向他展示包含该字符序列 例如名称字段 的所有文档 使用 Firebas
  • 机器学习回归模型预测每张图像的相同值

    我目前正在开展一个项目 涉及训练回归模型 保存它 然后加载它以使用该模型进行进一步的预测 但是我有一个问题 每次我对图像进行 model predict 时 它都会给出相同的预测 我不完全确定问题是什么 也许是在训练阶段 或者我只是做错了什
  • WPF8/C# - 将数据绑定到网格

    我知道我发布了这个问题 但是在接受了上一个问题的答案并阅读本文后 我意识到这不是我正在寻找的答案 我再次发布了一些示例代码 我想用集合中的数据填充网格 不是数据网格 这是我所拥有的 但它不起作用 如果我删除集合并将 DataContext
  • GridLayoutManager 自定义

    i want to know if there is way that i can customize gridlayoutmanager in android to have horizontal layout like this ske
  • Jquery UI 对话框追加到 Div

    我正在使用下面的代码创建一个 Jquery UI 对话框 var dynDiv document createElement div document getElementById divparent appendChild dynDiv
  • 传递不同类型的可变数量的参数 - C++

    我正在使用 C 进行编码 并且有一些关于省略号的问题 是否可以将类或类指针传递到省略号中 基本上我想做的是以以下类型传递可变数量的参数char and class 我目前正在使用省略号 并试图找出如何通过课堂 如果省略号在这里不适用 有哪些
  • 跨不同域和不同应用程序共享 cookie(经典 ASP 和 ASP.NET)

    有没有办法跨不同域和不同应用程序 经典 ASP 和 ASP NET 共享 cookie 不 没有 问题是跨域问题 而不是 asp net classic asp 并且是安全原因 如果域是子域 您可以共享 cookie 前提是您使用双方都可以
  • VSCode 中 jupyter 笔记本中的交互式 python 3d 绘图

    When I use jupyter notebook in Chrome I had the opportunity to show interactive 3d plots like this 现在我想在 VSCode 中看到相同的结果
  • 如何使用 keycloak 和 spring 读取所有用户?

    我在用着keycloak 3 4 and spring boot开发一个网络应用程序 我使用 Active Directory 作为用户联合来检索所有用户信息 但要在我的网络应用程序中使用这些信息 我想我必须将它们保存在 local web
  • 多级页表——分层分页

    过去操作系统期末考试的示例问题 我如何计算此类问题 计算机有 64 位虚拟地址空间和 2048 字节页面 一个页表项占用 4 个字节 使用多级页表是因为每个表必须包含在一个页内 需要多少级 我该如何计算这个 由于页表必须适合一个页面 因此页
  • 更改分割线突出显示/调整线条大小

    我注意到 当我在 Visual Studio 中调整元素大小时 分割线会被涂成纯透明的黑色 如下所示 然而 在我自己的 Winforms 应用程序中 我得到了以下调整大小行 我想知道如何改变这条调整线的绘画 如果你看一下分离器源代码 htt