Home > Net >  C # form without borders how to zoom in on the form
C # form without borders how to zoom in on the form

Time:09-15

O form without borders how to zoom in on the form

CodePudding user response:

FormWindowState set to normal

And then you can set the width and the height of

I want you to ask this question, because you find set high invalid wide, it is because he maximize,

Ps: I think you the follow-up questions and how to move form, form no mobile kinetic energy without borders, need you

CodePudding user response:

Without the borders, shadows
 
Using System;
using System.Drawing;
Using System. The Runtime. InteropServices;
using System.Windows.Forms;

The namespace contextUI
{
Public partial class ConextForm: Form
{
Public bool Sizeable=true;

[DllImport (" Gdi32. DLL, "EntryPoint=" CreateRoundRectRgn ")]
Private static extern IntPtr CreateRoundRectRgn
(
Int nLeftRect,
Int nTopRect,
Int nRightRect,
Int nBottomRect,
Int nWidthEllipse,
Int nHeightEllipse
);

[DllImport (" dwmapi. DLL)]
Public static extern int DwmExtendFrameIntoClientArea (IntPtr hWnd, ref MARGINS pMarInset);

[DllImport (" dwmapi. DLL)]
Public static extern int DwmSetWindowAttribute (IntPtr HWND, int attr, ref int attrValue, int attrSize);

[DllImport (" dwmapi. DLL)]
Public static extern int DwmIsCompositionEnabled (ref int pfEnabled);

Private bool m_aeroEnabled=false;
Private const int CS_DROPSHADOW=0 x00020000;
Private const int WM_NCPAINT=0 x0085;
Private const int WM_ACTIVATEAPP=0 x001c;

Public struct MARGINS
{
Public int leftWidth;
Public int rightWidth;
Public int topHeight;
Public int bottomHeight;
}

Private const int WM_NCHITTEST=0 x84;
Private const int HTCLIENT=0 x1;
Private const int HTCAPTION=0 x2;

Protected override CreateParams CreateParams
{
The get
{
M_aeroEnabled=CheckAeroEnabled ();

CreateParams cp=base. CreateParams;
if (! M_aeroEnabled)
Cp. ClassStyle |=CS_DROPSHADOW;

Return the cp;
}
}

Private bool CheckAeroEnabled ()
{
If (Environment) OSVersion) Version. The Major & gt;
=6){
Int enabled=0;
DwmIsCompositionEnabled (ref enabled);
Return (enabled==1)? true : false;
}
return false;
}

Const int HTLEFT=10;
Const int HTRIGHT=11;
Const int HTTOP=12;
Const int HTTOPLEFT=13;
Const int HTTOPRIGHT=14;
Const int HTBOTTOM=15;
Const int HTBOTTOMLEFT=0 x10;
Const int HTBOTTOMRIGHT=17;

Protected override void WndProc (ref Message m)
{
Base. WndProc (ref m);
The switch (m.M sg)
{
Case WM_NCPAINT:
If (m_aeroEnabled)
{
Var v=2;
DwmSetWindowAttribute (this. Handle, 2, ref v, 4);
MARGINS MARGINS=new MARGINS ()
{
BottomHeight=1,
LeftWidth=1,
RightWidth=1,
TopHeight=1
};
DwmExtendFrameIntoClientArea (this Handle, ref margins);

}
break;
Case 0 x0084:
If (Sizeable)
{
Base. WndProc (ref m);
Point vPoint=new Point ((int) m.L Param & amp; 0 XFFFF, (int) m.L Param & gt;> 16 & amp; 0 XFFFF);
VPoint=PointToClient (vPoint);
If (vPoint. X & lt;
=5){
If (vPoint. Y & lt;
=5){
M.R esult=(IntPtr) HTTOPLEFT;
}
The else
If (vPoint. Y & gt;=ClientSize. Height - 5)
{
M.R esult=(IntPtr) HTBOTTOMLEFT;
}
The else
{
M.R esult=(IntPtr) HTLEFT;
}
}
The else
If (vPoint. X & gt;=ClientSize. Width - 5)
{
If (vPoint. Y & lt;
=5){
M.R esult=(IntPtr) HTTOPRIGHT;
}
The else
If (vPoint. Y & gt;=ClientSize. Height - 5)
{
M.R esult=(IntPtr) HTBOTTOMRIGHT;
}
The else
{
M.R esult=(IntPtr) HTRIGHT;
}
}
The else
If (vPoint. Y & lt;
=5){
HTTOP m.R esult=(IntPtr);
}
The else
{
If (vPoint. Y & gt;=ClientSize. Height - 5)
{
HTBOTTOM m.R esult=(IntPtr);
}
}

}
break;

Default:
break;
}
}

Private void InitializeComponent ()
{
Enclosing SuspendLayout ();
Enclosing ClientSize=new Size (284, 261);
Enclosing DoubleBuffered=true;
This. Name="conextForm";
Enclosing ResumeLayout (false);

}
}
}

CodePudding user response:

To form a double-click events, you can zoom in,

CodePudding user response:

Can double-click the zoom in, also can right click a menu to zoom in, 1/f, drag, when the window is narrow to drag, it is not hard to

CodePudding user response:

refer to the second floor desperaso response:
without borders, shadow

What is the effect you? I tried it on or have a border,

CodePudding user response:

The mouse wheel event handling?

CodePudding user response:

Manually add two functions, maximize, minimize, or close,
Can be a button, also can double-click, that you can handle, a line of code,
Try to use the API drag fixnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related