FormBorderStyle 问题
FormBorderStyle issue
遇到不同 FormBorderStyle 模式的问题。在 'None' 模式下一切正常。
但是一旦我将模式更改为其他模式 - 就会发生这种情况:
我周围出现奇怪的空白区域。就像边界在两个轴上都关闭了
void InitializeComponent(void)
{
this->SuspendLayout();
//
// MainUI
//
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::None;
this->ClientSize = System::Drawing::Size(320, 250);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
this->MaximizeBox = false;
this->MinimizeBox = false;
this->Name = L"MainUI";
this->Text = L"Dota 2 Efficiency Application";
this->ResumeLayout(false);
}
[STAThreadAttribute]
int Main(array<System::String ^> ^args){
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Creating a new form
MainUI^ form = gcnew MainUI();
// Creating a new ListView and adding it to the form
createList();
form->globalTimerInit();
form->Controls->Add(myGlobals::Globals::globalListView);
form->Controls->Add(myGlobals::Globals::labelForTimer);
Application::Run(form);
return 0;
}
当我尝试获取表单的边界和 ClientRectangle 时,它吐出:
{X=0,Y=0,Width=336,Height=284}
{X=0,Y=0,Width=320,Height=250}
看起来是正确的,但是这个区域有点偏。
有什么建议吗?
我有多个 __super::WndProc(m);它导致了这种行为。
ui.h
#include "stdafx.h"
////////////////////////HOTKEYS////////////////////////
protected: // Function that defines a hotkey
virtual void OnHandleCreated(EventArgs^ e) override {
__super::OnHandleCreated(e);
RegisterHotKey((HWND)this->Handle.ToPointer(), 1,
MOD_NOREPEAT, (UINT)Keys::NumPad3);
RegisterHotKey((HWND)this->Handle.ToPointer(), 2,
MOD_NOREPEAT, (UINT)Keys::NumPad2);
RegisterHotKey((HWND)this->Handle.ToPointer(), 3,
MOD_NOREPEAT, (UINT)Keys::NumPad1);
RegisterHotKey((HWND)this->Handle.ToPointer(), 4,
MOD_NOREPEAT, (UINT)Keys::NumPad0);
}
protected: // Function that executes code on hotkey
virtual void WndProc(Message% m) override {
if (m.Msg == WM_HOTKEY && m.WParam.ToInt32() == 1) {
//roshTimer();
}
if (m.Msg == WM_HOTKEY && m.WParam.ToInt32() == 2) {
//wardPurchased();
}
__super::WndProc(m);
if (m.Msg == WM_HOTKEY && m.WParam.ToInt32() == 3) {
//globalTimerStartPause();
}
__super::WndProc(m);
if (m.Msg == WM_HOTKEY && m.WParam.ToInt32() == 4) {
//reserved for future needs
}
__super::WndProc(m);
}
///////////////////////////////////////////////////////
stdafx.h
#pragma once
#include <Windows.h>
#pragma comment(lib, "user32.lib")
遇到不同 FormBorderStyle 模式的问题。在 'None' 模式下一切正常。
但是一旦我将模式更改为其他模式 - 就会发生这种情况:
我周围出现奇怪的空白区域。就像边界在两个轴上都关闭了
void InitializeComponent(void)
{
this->SuspendLayout();
//
// MainUI
//
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::None;
this->ClientSize = System::Drawing::Size(320, 250);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
this->MaximizeBox = false;
this->MinimizeBox = false;
this->Name = L"MainUI";
this->Text = L"Dota 2 Efficiency Application";
this->ResumeLayout(false);
}
[STAThreadAttribute]
int Main(array<System::String ^> ^args){
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Creating a new form
MainUI^ form = gcnew MainUI();
// Creating a new ListView and adding it to the form
createList();
form->globalTimerInit();
form->Controls->Add(myGlobals::Globals::globalListView);
form->Controls->Add(myGlobals::Globals::labelForTimer);
Application::Run(form);
return 0;
}
当我尝试获取表单的边界和 ClientRectangle 时,它吐出:
{X=0,Y=0,Width=336,Height=284}
{X=0,Y=0,Width=320,Height=250}
看起来是正确的,但是这个区域有点偏。
有什么建议吗?
我有多个 __super::WndProc(m);它导致了这种行为。
ui.h
#include "stdafx.h"
////////////////////////HOTKEYS////////////////////////
protected: // Function that defines a hotkey
virtual void OnHandleCreated(EventArgs^ e) override {
__super::OnHandleCreated(e);
RegisterHotKey((HWND)this->Handle.ToPointer(), 1,
MOD_NOREPEAT, (UINT)Keys::NumPad3);
RegisterHotKey((HWND)this->Handle.ToPointer(), 2,
MOD_NOREPEAT, (UINT)Keys::NumPad2);
RegisterHotKey((HWND)this->Handle.ToPointer(), 3,
MOD_NOREPEAT, (UINT)Keys::NumPad1);
RegisterHotKey((HWND)this->Handle.ToPointer(), 4,
MOD_NOREPEAT, (UINT)Keys::NumPad0);
}
protected: // Function that executes code on hotkey
virtual void WndProc(Message% m) override {
if (m.Msg == WM_HOTKEY && m.WParam.ToInt32() == 1) {
//roshTimer();
}
if (m.Msg == WM_HOTKEY && m.WParam.ToInt32() == 2) {
//wardPurchased();
}
__super::WndProc(m);
if (m.Msg == WM_HOTKEY && m.WParam.ToInt32() == 3) {
//globalTimerStartPause();
}
__super::WndProc(m);
if (m.Msg == WM_HOTKEY && m.WParam.ToInt32() == 4) {
//reserved for future needs
}
__super::WndProc(m);
}
///////////////////////////////////////////////////////
stdafx.h
#pragma once
#include <Windows.h>
#pragma comment(lib, "user32.lib")