Form without focus/activation

后端 未结 2 592
广开言路
广开言路 2020-12-20 06:47

I want to implement intellisense-like feature for my multiline textbox. The intellisense control is placed in standard form without control box (so, no title or maximize/min

2条回答
  •  一向
    一向 (楼主)
    2020-12-20 06:59

    i have a code somedays i downloaded from code project (i think ) and i dont what is the original download link try using this

    using System;
    using System.Drawing;
    using System.Windows.Forms;
    
    namespace Balloon.NET
    {
        public class BalloonWindow : Form
        {
            public static readonly int TIPMARGIN;
            public static readonly int TIPTAIL;
    
            public BalloonWindow();
    
            public Point AnchorPoint { get; set; }
            public BalloonWindow.BallonQuadrant Quadrant { get; }
    
            public static Point AnchorPointFromControl(Control anchorControl);
            protected override void Dispose(bool disposing);
            protected override void OnLoad(EventArgs e);
            protected virtual Rectangle OnNCCalcSize(Rectangle windowRect);
            protected virtual void OnNCPaint(Graphics g);
            protected override void OnResize(EventArgs e);
            protected void RecalcLayout();
            protected void RepositionWindow(Point oldAnchorPoint, Point newAnchorPoint);
            public void ShowBalloon(Control anchorControl);
            protected override void WndProc(ref Message m);
    
            public enum BallonQuadrant
            {
                TopLeft = 0,
                TopRight = 1,
                BottomLeft = 2,
                BottomRight = 3,
            }
        }
    }
    

    and use this form as follow

    Balloon.NET.BalloonWindow ms = new Balloon.NET.BalloonWindow();
    private void numberEdit1_TextChanged(object sender, EventArgs e)
    {
        if (!ms.Visible)
        {
            ms.ShowBalloon(numberEdit1);
            numberEdit1.Focus();
        }
    }
    

提交回复
热议问题