- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
这个
public Form1()
{
InitializeComponent();
Size = new System.Drawing.Size(8, 8);
Console.WriteLine("Size: " + Size);
}
产生这个作为输出:
Size: {Width=178, Height=47}
现在我猜这是因为标题栏及其控件和表单边框需要一些空间。
但是在删除所有这些东西之后,结果仍然是一样的,即使我可以在使用鼠标时将表单缩小到任何更小的东西!
这是我尝试用键盘界面改进的小程序:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
MinimumSize = new System.Drawing.Size(6, 6);
}
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}
private void Form1_Resize(object sender, EventArgs e)
{
label1.Text = Width + " x " + Height + " px";
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Right && e.Shift) Width++;
else if (e.KeyCode == Keys.Down && e.Shift) Height++;
else if (e.KeyCode == Keys.Left && e.Shift) Width--;
else if (e.KeyCode == Keys.Up && e.Shift) Height--;
else if (e.KeyCode == Keys.Right) Left++;
else if (e.KeyCode == Keys.Down) Top++;
else if (e.KeyCode == Keys.Left) Left--;
else if (e.KeyCode == Keys.Up) Top--;
}
}
表单只有一个标签,没有别的:
//
// Form1
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(282, 253);
this.ControlBox = false;
this.Controls.Add(this.label1);
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(2, 2);
this.Name = "Form1";
this.ShowIcon = false;
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
this.Resize += new System.EventHandler(this.Form1_Resize);
this.ResumeLayout(false);
this.PerformLayout();
我想知道为什么鼠标让我缩小它但代码却不允许?是否需要设置一些样式位?
最佳答案
我认为这是因为表单边框样式,看起来将其更改为 None 可以让表单缩小。将调整大小代码移动到表单的加载事件也有帮助。
编辑:将 FormBorderStyle 设置为 SizeableToolWindow
似乎是最合适的,它允许表单非常小并且仍然可以使用鼠标调整大小。
关于c# - 使用鼠标调整表单大小有效,代码不会低于 178x47,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34315798/
我有 5 个对象,a、b、c。d 和 e。 5个对象的hashcode如下: a => 72444 b => 110327396 c => 107151 d => 2017793190 e => 68
我目前正在为我当前的元素创建媒体查询,我目前面临的问题是某些东西导致我的导航栏在宽度低于 600 像素时无法响应。所发生的情况如附图所示。 这个问题其实我在之前的元素中曾经解决过一次,但是我对比了代码
我正在为网页编写媒体查询,并设法为 768 及以下版本编写媒体查询。但它不能正常工作。我想捕捉大多数 320 像素的手机(iphone4、iphone5、iphone3、asus galaxy 7、s
我开发了一个android应用,我所有android低于api 23的用户都无法连接到服务器,其余的都正常工作,从今天(2020-05-30)开始,在这一天之前多年来一直正常工作。 任何想法是什么原因
我正在上一门加密课,主要是作为学术练习,我一直在尝试获得尽可能高的速度。我发现了一些奇怪的事情,即异或字节数组的成本非常低,但在相同大小的字节数组上使用 arraycopy 的成本更高。我想这一定是一
我启动了一个新的应用程序,它大量使用了 firebase 功能以及支持库。我很快就达到了 65k dex 的限制,尽管考虑到应用程序的简单性,我没有理由应该在那里。我知道我需要排除某些我没有用的依赖项
我在 Lollipop 及以下发生了奇怪的崩溃。尝试从服务器下载文件时出现安全异常,但在运行 Marshmallow 及以上版本的设备中,应用程序不会崩溃。 Logcat: Caused by: ja
我正在构建一个相当简单的网站,我需要它具有一定的响应能力。 现在,当我调整浏览器大小时,导航菜单与 Logo 标题重叠,变得非常困惑。 HTML: Prince Innoce
如演示中所示,maxValue 设置为 2017 年,但图表一直到 2020 年。 如何让图表真正停在 2017 年?它在我的页面上占用了太多空间,因此我想对其进行优化 See demo fiddle
我正在用 python 尝试第二个 Project Euler 问题,想了解为什么我的代码不起作用。 此代码查找低于 400 万的偶数斐波那契数的总和 counter = 2 total = 0 wh
我想回答其中一个问题,这些问题有时是由销售人员试图在预算内进行销售而交给我们开发人员的。 我们有一个客户需要以下内容: 支持 AD 身份验证的文档管理系统(即使服务器可能位于其他位置 - 可能位于 V
我有一系列值(Pandas DF 或 Numpy Arr): vals = [0,1,3,4,5,5,4,2,1,0,-1,-2,-3,-2,3,5,8,4,2,0,-1,-3,-8,-20,-10,
当我创建使用 Google map API v2 的项目时,这条线有问题。 GoogleMap map = ((MapFragment) getFragmentManager().findFragme
如何在 UITableView 下方但在 TabBar 上方放置一个按钮,以便 UIButton 保持静止(不随 tableview 滚动)? 这是一张我想要帮凶的照片:http://i.imgur.
我正在使用 MockMvcResultMatchers 来测试我的 Controller 类。 这是一个示例代码 RequestBuilder request = get("/empl
function randomise(){ var ran_number=Math.floor(Math.random() * 100); return ran_number;
我正在尝试为 iOS9 以下的 NSManagedObjects init(context:) 方法“polyfill”。有没有办法为 iOS10 进行预处理器可用性检查? 这是否有意义,或者是否会出
我对 Web 开发的冒险还很陌生。我在使用的网站上遇到问题。在我达到大约 640px 之前,我的响应式设计没有问题。一旦我达到 640px 或将我的 html 全部压缩到左侧,除了我的主页英雄和导航栏
所以,我遇到的问题真的很难解释,但是,当页面宽度小于 600 像素时,我试图让我的导航行为有所不同。我几乎按照我想要的方式工作,但是当我点击菜单按钮时,当它低于 600px 时,它会在它下面的内容顶部
我在一个多语言网站上工作,我想在它的图标下方放置一个固定语言的菜单 div。我正在使用 Bootstrap 3。
我是一名优秀的程序员,十分优秀!