開始
新增2個列舉,分別控制進出風口的位置
複製**
1 ///
2 /// enum blowerentrancedirection
3 ///
4 public enum blowerentrancedirection
5 23
24 ///
25 /// enum blowerexitdirection
26 ///
27 public enum blowerexitdirection
28 複製**
屬性複製**
1 ///
2 /// the entrance direction
3 ///
4 private blowerentrancedirection entrancedirection = blowerentrancedirection.none;
56 ///
7 /// gets or sets the entrance direction.
8 ///
9 /// the entrance direction.
10 [description(「入口方向」), category(「自定義」)]
11 public blowerentrancedirection entrancedirection
12 14 set
15 19 }
2021 ///
22 /// the exit direction
23 ///
24 private blowerexitdirection exitdirection = blowerexitdirection.right;
2526 ///
27 /// gets or sets the exit direction.
28 ///
29 /// the exit direction.
30 [description(「出口方向」), category(「自定義」)]
31 public blowerexitdirection exitdirection
32 34 set
35 39 }
4041 ///
42 /// the blower color
43 ///
44 private color blowercolor = color.fromargb(255, 77, 59);
4546 ///
47 /// gets or sets the color of the blower.
48 ///
49 /// the color of the blower.
50 [description(「風機顏色」), category(「自定義」)]
51 public color blowercolor
52 54 set
55 59 }
6061 ///
62 /// the fan color
63 ///
64 private color fancolor = color.fromargb(3, 169, 243);
6566 ///
67 /// gets or sets the color of the fan.
68 ///
69 /// the color of the fan.
70 [description(「風葉顏色」), category(「自定義」)]
71 public color fancolor
72 74 set
75 79 }
8081 ///
82 /// the m rect working
83 ///
84 rectangle m_rectworking;
複製**
重繪複製**
1 protected override void onpaint(painteventargs e)
2 31
32 switch (entrancedirection)
33 50
51 //漸變色
52 int _intpenwidth = intlinepenwidth;
53 int intcount = _intpenwidth / 2 / 4;
54 for (int i = 0; i < intcount; i++)
55 65
66 //底座
67 graphicspath gpdz = new graphicspath();
68 gpdz.addlines(new point
69 );
74 gpdz.closeallfigures();
75 g.fillpath(new solidbrush(blowercolor), gpdz);
76 g.fillpath(new solidbrush(color.fromargb(50, color.white)), gpdz);
77 g.drawline(new pen(new solidbrush(blowercolor), 3), new point(m_rectworking.left, this.height - 2), new point(m_rectworking.right, this.height - 2));
7879 //中心
80 g.fillellipse(new solidbrush(blowercolor), m_rectworking);
81 g.fillellipse(new solidbrush(color.fromargb(20, color.white)), m_rectworking);
8283
84 //扇葉
85 rectangle _rect = new rectangle(m_rectworking.left + (m_rectworking.width - (m_rectworking.width / 3 * 2)) / 2, m_rectworking.top + (m_rectworking.height - (m_rectworking.width / 3 * 2)) / 2, (m_rectworking.width / 3 * 2), (m_rectworking.width / 3 * 2));
8687 int _splitcount = 8;
88 float fltsplitvalue = 360f / (float)_splitcount;
89 for (int i = 0; i <= _splitcount; i++)
90 102
103 g.fillellipse(new solidbrush(fancolor), new rectangle(_rect.left + _rect.width / 2 - _rect.width / 4 + 2, _rect.top + _rect.width / 2 - _rect.width / 4 + 2, _rect.width / 2 - 4, _rect.width / 2 - 4));
104 g.fillellipse(new solidbrush(color.fromargb(50, color.white)), new rectangle(_rect.left - 5, _rect.top - 5, _rect.width + 10, _rect.height + 10));
105 }
複製**
深圳**建設www.sz886.com
C WinForm 載入自定義控制項閃爍問題
winform載入多個自定義控制項時,會出現很嚴重的閃爍問題,很卡,一塊一塊的載入 像開啟網頁時,網路很卡的那種感覺 簡直沒法忍受。在網上搜尋了好久,網上大部分的方法是一下4種,但是都不能有效的解決問題。1.將doublebuffered 設定 true,用雙快取處理form介面內容載入,可以提高頁...
C winform 窗體自定義
今天看了篇技術帖,原來是可以不通過工具欄的現有工具進行布局的。以前 當我要有2個窗體的時候,就會拖拽2個 然後進行編輯。現在才明白,只要寫成類也是可以使用的。開啟乙個窗體的檔案,發現當自動新建個窗體時,其實是系統幫忙做了很多的準備工作。例如designer.cs中就有 initializecompo...
C WinForm 使用者自定義控制項閃爍的問題
使用winform開發,當使用了大量的使用者自定義控制項usercontrol時,介面拖動或切換時就會出現閃爍的問題。解決方法主要就是重寫usercontrol和form的createparams方法。前端呼叫usercontrol的窗體form這樣寫 protected override crea...