標籤:icon cat 工作列 網址 style logs end show 使用
1.用戶端應用程式:C/S
特點:操作使用者電腦上的檔案
2.表單分類:
記事本類型 --- 表單可以隨便拖動大小
計算機類型 ---- 表單固定大小,無最大化
無變寬類型 --- 殺毒軟體
不規則類型 --- 案頭加速小球
置頂類型 --- 開啟後不被其他表單所掩蓋,比如qq
3.表單基礎屬性
布局:
AutoScroll -- 控制項超出表單會自動出現捲軸
location --- 表單距離案頭左上方的距離,需要配合StartPosition中的Manual使用
MaximumSize --- 表單最大的尺寸
MinimumSize --- 表單最小的尺寸
Size ---- 表單的大小
StartPosition --- 控制表單第一次開啟時候的位置
Manual --- 配合location是確定開啟視窗(距離左上方)的位置
CenterScreen -- 開啟的表單,根據案頭進行置中
CenterParent --- 根據上一個表單進行置中
WindowState --- 表單第一個開啟時候的狀態(最大,最小)
視窗樣式:
ControlBox --- 確定表單是否有菜單控制欄
Icon --- 表單嘯表徵圖
MaximizeBox --- 表單是否有最大化表徵圖
MinimizeBox ---- 表單是否有最小化表徵圖 (如果只設定一個則為灰色,2個都設定則不顯示)
Opacity --- 設定表單透明度
ShowIcon -- 設定表單小表徵圖是否顯示
ShowInTaskbar --- 設定視窗下面工作列是否顯示
TopMost --- 設定最高層級
TransparencyKey --- 設定什麼背景樣色為透明
外觀:
BackColor --- 背景顏色
BackgroundImage --- 設定背景圖片
BackgroundImageLayout --- 設定背景圖片的平鋪方式
tile(瓷磚方式平鋪,多個)center(一個圖片置中,圖片沒有任何變化)
stretch(圖片展開) zoom(圖片水平置中,左右置中,上下佔滿)
Cursor -- 滑鼠樣式
FormBorderStyle --- 邊框樣式 none(什麼也沒有) FixedSingle(固定位置)
雜項:
AcceptButton --- 表單的接受按鍵,設定後按下enter,相當於單擊改按鈕
CancelButton --- 表單取消按鍵,設定後按下esc 相當於單擊了該按鈕
資料:
tag屬性可以放任何屬性
4.ico表徵圖產生:
網址: http://www.bitbug.net/ 迅速產生
5.不規則表單的移動
需要引用api檔案
表單行動程式碼:
//表單移動API[DllImport("user32.dll")]public static extern bool ReleaseCapture();[DllImport("user32.dll")]public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int IParam);public const int WM_SYSCOMMAND = 0x0112;public const int SC_MOVE = 0xF010;public const int HTCAPTION = 0x0002;[DllImport("user32")]private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, IntPtr lParam);private const int WM_SETREDRAW = 0xB;private void Form1_MouseDown(object sender, MouseEventArgs e){ if (this.WindowState == FormWindowState.Normal) { ReleaseCapture(); SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); }}View Code
表單陰影代碼:
1、添加命名空間:using System.Runtime.InteropServices; 2、定義常量值及函數:private const int CS_DropSHADOW = 0x20000; private const int GCL_STYLE = (-26); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern int SetClassLong(IntPtr hwnd, int nIndex, int dwNewLong); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern int GetClassLong(IntPtr hwnd, int nIndex);3、構造方法下引用:SetClassLong(this.Handle, GCL_STYLE, GetClassLong(this.Handle, GCL_STYLE) | CS_DropSHADOW); View Code
6.惡搞小程式
源碼下載:https://i.cnblogs.com/Files.aspx
2017-4-24 winform表單基礎屬性 ico圖片產生 不規則表單的移動 惡搞小程式