private void panel3_Paint(object sender, PaintEventArgs e)
{
ControlPaint.DrawBorder(e.Graphics, panel3.ClientRectangle, Color.White, ButtonBorderStyle.Solid);
}
panel3重繪,顏色改白色
2020年4月13日 星期一
2020年4月9日 星期四
移動到按鈕上顯示提示文字
先寫成method
private void HINT(string tips, Button btn)
{
ToolTip tools = new ToolTip();
tools.AutoPopDelay = 5000; //顯示多少毫秒
tools.InitialDelay = 500; //停頓多少毫秒後顯示
tools.SetToolTip(btn, tips); //要在哪裡出現,顯示內容
}
然後在button1的onMouseHover事件寫下
private void button1_MouseHover(object sender, EventArgs e)
{
HINT("關閉視窗", button1);
}
private void HINT(string tips, Button btn)
{
ToolTip tools = new ToolTip();
tools.AutoPopDelay = 5000; //顯示多少毫秒
tools.InitialDelay = 500; //停頓多少毫秒後顯示
tools.SetToolTip(btn, tips); //要在哪裡出現,顯示內容
}
然後在button1的onMouseHover事件寫下
private void button1_MouseHover(object sender, EventArgs e)
{
HINT("關閉視窗", button1);
}
無邊界模式下可按工具列按鈕直接最小化的方法
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Style |= WS_MINIMIZEBOX;
cp.ClassStyle |= CS_DBLCLKS;
return cp;
}
}
放入Form中
{
get
{
CreateParams cp = base.CreateParams;
cp.Style |= WS_MINIMIZEBOX;
cp.ClassStyle |= CS_DBLCLKS;
return cp;
}
}
放入Form中
2020年4月8日 星期三
在WINFORM上利用BUTTON切換PANEL
例如在PANEL1上要切換成子視窗FORM2和FORM3
為了檢查不重複產生子視窗,所以先用全域變數宣告在前面
private static Form F2;
private static Form F3;
為了檢查不重複產生子視窗,所以先用全域變數宣告在前面
private static Form F2;
private static Form F3;
無框體FORM拖曳事件
我是在PANEL1才能拖曳
bool beginMove = false; //開關拖曳功能
Point mouseXY; //紀錄滑鼠座標
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
beginMove = false;
Cursor = Cursors.Default;
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if(beginMove)
{
Left += e.X - mouseXY.X; //移動XY軸位置
Top += e.Y - mouseXY.Y;
}
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
mouseXY = new Point(e.X, e.Y); //紀錄現在的座標
beginMove = true;
Cursor = Cursors.Hand; //更改滑鼠圖示
}
bool beginMove = false; //開關拖曳功能
Point mouseXY; //紀錄滑鼠座標
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
beginMove = false;
Cursor = Cursors.Default;
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if(beginMove)
{
Left += e.X - mouseXY.X; //移動XY軸位置
Top += e.Y - mouseXY.Y;
}
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
mouseXY = new Point(e.X, e.Y); //紀錄現在的座標
beginMove = true;
Cursor = Cursors.Hand; //更改滑鼠圖示
}
2020年4月7日 星期二
美化WINFORM UI
暫時試用CSKIN看看
先到
http://www.cskin.net
下載套件
裡面的4.0是.net framework4.0
C#工具箱右鍵→加入索引標籤→填入名字(CSkin)
把資料夾內的dll等檔案拖入標籤下即可套用CSKIN的版型
先到
http://www.cskin.net
下載套件
裡面的4.0是.net framework4.0
C#工具箱右鍵→加入索引標籤→填入名字(CSkin)
把資料夾內的dll等檔案拖入標籤下即可套用CSKIN的版型
2020年4月2日 星期四
訂閱:
意見 (Atom)