ãã1.ç»å¶ä¸è§åçªä½ä½å¾
ãã2.设置çªä½åºæ¬å±æ§
ãã3.ç¼åçªä½ç¸å
³ä»£ç ãï¼è¦å®ç°çªå£çå
³éï¼ç§»å¨çæä½ï¼ã
ãã
ãã1.ç»å¶ä¸è§åçªä½ä½å¾
ããå¯ä»¥ä½¿ç¨ä»»æä¸ç§ä½ å欢çä½å¾å·¥å
·ï¼å¶ä½ä¸ä¸ªæå½¢ç¶çä½å¾ï¼èæ¯ä½¿ç¨ä¸ç§å
¶ä»çé¢è²ãè¿ä¸ªé¢è²å¨ç¼ç¨ä¸ç¨å¾çï¼æ以æ好使ç¨ä¸ç§å®¹æè®°å¿çé¢è²ã
ããæ¬ä¾ä¸ä½¿ç¨çèæ¯è²ä¸ºé»è²ï¼#ffff00/yellowï¼,æ件å为bk.bmp
ããwindowsçªä½å¹¶è®¾ç½®çªä½åºæ¬å±æ§
ãã1ãæ°å»ºwindowsåºç¨ç¨åº
ãã ã
ãã2ãéä¸æ°å»ºççªä½ï¼è®¾ç½®å
¶ç¸åºå±æ§ï¼
ããï¼1ï¼ãå° FormBorderStyle å±æ§è®¾ç½®ä¸º Noneã
ããï¼2ï¼ãå°çªä½ç BackgroundImage å±æ§è®¾ç½®ä¸ºå
åå建çä½å¾æ件ãä¸å¿
å°æ件添å å°é¡¹ç®ç³»ç»ä¸ï¼è¿å°å¨æå®è¯¥æ件ä½ä¸ºèæ¯å¾åæ¶èªå¨å®æã
ããï¼3ï¼ãå° TransparencyKey å±æ§è®¾ç½®ä¸ºä½å¾æ件çèæ¯è²ï¼æ¬ä¾ä¸ä¸ºé»è²ãï¼æ¤å±æ§åè¯åºç¨ç¨åºçªä½ä¸çåªäºé¨åéè¦è®¾ç½®ä¸ºéæã ï¼
ããè¿æ¶ä½ å°±å¯ä»¥æF5æµè¯ä½ çç¨åºï¼å¯ä»¥çå°å¦å¾æ示ççªä½ãç°å¨çªä½è¿ä¸è½æå¨ï¼åªè½éè¿ç»æç¨åºï¼æè
alt+F4å
³éãä¸é¢æ们ç¼åç¸åºç代ç æ¥å®ç°æ é¢æ çç¸åºåè½ã
ãã
ãã3.ç¼åçªä½ç¸å
³ä»£ç
ããè¦å®ç°çªå£çå
³éï¼ç§»å¨çæä½ï¼
ãããã
ããï¼1ï¼ãå®ç°çªå£å
³é
ããä»å·¥å
·æ ä¸æè¿ä¸ä¸ªæé®ï¼è®¾ç½®å
¶æé®æå为âÃâï¼è®¾ç½®å
¶å¤§å°ä¸ºåé大å°ãåå»è¯¥æé®è¿å
¥å
¶è§¦åæ¶é´å½æ°ã
ããåå
¥å¦ä¸ä»£ç ï¼ãããããããããããã
ããthis.Close(); ã//å
³éæ¬çªä½ãã
ããï¼2ï¼ã设置çªä½ç移å¨æä½ï¼æ们è¦ç¨å°ä¸¤ä¸ªå
¨å±çåé
ããprivate Point mouseOffset; ãããã//è®°å½é¼ æ æéçåæ
ããprivate bool isMouseDown = false; //è®°å½é¼ æ æé®æ¯å¦æä¸
ãã
ããå建该çªä½ MouseDownäºä»¶çç¸åºå¤çç¨åºã
ããprivate void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
ãã{
ããint xOffset;
ããint yOffset;
ãã
ããif (e.Button == MouseButtons.Left)
ãã {
ããããxOffset = -e.X - SystemInformation.FrameBorderSize.Width;
ããããyOffset = -e.Y - SystemInformation.CaptionHeight -
ããããSystemInformation.FrameBorderSize.Height;
ããããmouseOffset = new Point(xOffset, yOffset);
ããããisMouseDown = true;
ããã}
ãã }
ãã
ããå建该çªä½ç MouseMoveäºä»¶çç¸åºå¤çç¨åº
ããprivate void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
ããã{
ããã if (isMouseDown)
ããã{
ããããPoint mousePos = Control.MousePosition;
ããããmousePos.Offset(mouseOffset.X, mouseOffset.Y);
ããããLocation = mousePos;
ããã }
ããã}
ãããããããã
ããå建该çªä½çMouseUpäºä»¶çç¸åºå¤çç¨åº
ããprivate void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
ãã{
ãã// ä¿®æ¹é¼ æ ç¶æisMouseDownçå¼
ãã// ç¡®ä¿åªæé¼ æ å·¦é®æä¸å¹¶ç§»å¨æ¶ï¼æ移å¨çªä½
ããif (e.Button == MouseButtons.Left)
ãã{
ããisMouseDown = false;
ãã}
ãã}
ãã
ããï¼3ï¼ãå å
¥ç¸åºçå
¶ä»çæ§ä»¶
ããå
¶ä»çå°±æ¯çä½ èªå·±çéè¦ï¼æ¥æ·»å æ§ä»¶ï¼å®ç°èªå·±æ³è¦å®ç°çåè½ã
ããæ¬ä¾ä¸æ·»å äºä¸ææ¬æ¡ï¼è®¾ç½®å
¶èæ¯ä¸ºé»è²ï¼æ以æ¾ç¤ºæ¶ä¹æäºéæçã
ãããã
ãã注æï¼å¦æçè§å¨çé¢è²æ·±åº¦è®¾ç½®å¤§äº 24 ä½ï¼åä¸ç®¡ TransparencyKey å±æ§æ¯å¦ä½è®¾ç½®çï¼çªä½çééæé¨åé½ä¼äº§çæ¾ç¤ºé®é¢ãè¥è¦é¿å
åºç°è¿ç§é®é¢ï¼è¯·ç¡®ä¿âæ¾ç¤ºâæ§å¶é¢æ¿ä¸ççè§å¨é¢è²æ·±åº¦ç设置å°äº 24 ä½ã
温馨提示:答案为网友推荐,仅供参考