Sprite.Property.10.Text.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. using System.Drawing;
  2. using System.Drawing.Text;
  3. namespace Microsoft.Windows.Forms
  4. {
  5. public partial class Sprite
  6. {
  7. private string m_Text = null;
  8. /// <summary>
  9. /// 文本
  10. /// </summary>
  11. public string Text
  12. {
  13. get
  14. {
  15. return this.m_Text;
  16. }
  17. set
  18. {
  19. if (value != this.m_Text)
  20. {
  21. this.m_Text = value;
  22. this.Feedback();
  23. }
  24. }
  25. }
  26. private Point m_TextOffset = Point.Empty;
  27. /// <summary>
  28. /// 文本偏移
  29. /// </summary>
  30. public Point TextOffset
  31. {
  32. get
  33. {
  34. return this.m_TextOffset;
  35. }
  36. set
  37. {
  38. if (value != this.m_TextOffset)
  39. {
  40. this.m_TextOffset = value;
  41. this.Feedback();
  42. }
  43. }
  44. }
  45. private Point m_TextOffsetHovered = Point.Empty;
  46. /// <summary>
  47. /// 鼠标移上时在TextOffset上再次偏移
  48. /// </summary>
  49. public Point TextOffsetHovered
  50. {
  51. get
  52. {
  53. return this.m_TextOffsetHovered;
  54. }
  55. set
  56. {
  57. if (value != this.m_TextOffsetHovered)
  58. {
  59. this.m_TextOffsetHovered = value;
  60. this.Feedback();
  61. }
  62. }
  63. }
  64. private Point m_TextOffsetPressed = Point.Empty;
  65. /// <summary>
  66. /// 鼠标按下时在TextOffset上再次偏移
  67. /// </summary>
  68. public Point TextOffsetPressed
  69. {
  70. get
  71. {
  72. return this.m_TextOffsetPressed;
  73. }
  74. set
  75. {
  76. if (value != this.m_TextOffsetPressed)
  77. {
  78. this.m_TextOffsetPressed = value;
  79. this.Feedback();
  80. }
  81. }
  82. }
  83. private Point m_TextOffsetFocused = Point.Empty;
  84. /// <summary>
  85. /// 获取焦点时在TextOffset上再次偏移
  86. /// </summary>
  87. public Point TextOffsetFocused
  88. {
  89. get
  90. {
  91. return this.m_TextOffsetFocused;
  92. }
  93. set
  94. {
  95. if (value != this.m_TextOffsetFocused)
  96. {
  97. this.m_TextOffsetFocused = value;
  98. this.Feedback();
  99. }
  100. }
  101. }
  102. private Point m_TextOffsetDisabled = Point.Empty;
  103. /// <summary>
  104. /// 禁用时在TextOffset上再次偏移
  105. /// </summary>
  106. public Point TextOffsetDisabled
  107. {
  108. get
  109. {
  110. return this.m_TextOffsetDisabled;
  111. }
  112. set
  113. {
  114. if (value != this.m_TextOffsetDisabled)
  115. {
  116. this.m_TextOffsetDisabled = value;
  117. this.Feedback();
  118. }
  119. }
  120. }
  121. private Point m_TextOffsetHighlight = Point.Empty;
  122. /// <summary>
  123. /// 高亮时在TextOffset上再次偏移
  124. /// </summary>
  125. public Point TextOffsetHighlight
  126. {
  127. get
  128. {
  129. return this.m_TextOffsetHighlight;
  130. }
  131. set
  132. {
  133. if (value != this.m_TextOffsetHighlight)
  134. {
  135. this.m_TextOffsetHighlight = value;
  136. this.Feedback();
  137. }
  138. }
  139. }
  140. private Font m_Font = DefaultTheme.Font;
  141. /// <summary>
  142. /// 字体.该字体为全局静态变量,不要释放
  143. /// </summary>
  144. public Font Font
  145. {
  146. get
  147. {
  148. return this.m_Font;
  149. }
  150. set
  151. {
  152. if (value != this.m_Font)
  153. {
  154. this.m_Font = value;
  155. this.Feedback();
  156. }
  157. }
  158. }
  159. private Color m_ForeColor = DefaultTheme.ForeColor;
  160. /// <summary>
  161. /// 前景色
  162. /// </summary>
  163. public Color ForeColor
  164. {
  165. get
  166. {
  167. return this.m_ForeColor;
  168. }
  169. set
  170. {
  171. if (value != this.m_ForeColor)
  172. {
  173. this.m_ForeColor = value;
  174. this.Feedback();
  175. }
  176. }
  177. }
  178. private Color m_ForeColorHovered = DefaultTheme.ForeColor + DefaultTheme.ForeColorHoveredVector;
  179. /// <summary>
  180. /// 前景鼠标移上颜色向量
  181. /// </summary>
  182. public Color ForeColorHovered
  183. {
  184. get
  185. {
  186. return this.m_ForeColorHovered;
  187. }
  188. set
  189. {
  190. if (value != this.m_ForeColorHovered)
  191. {
  192. this.m_ForeColorHovered = value;
  193. this.Feedback();
  194. }
  195. }
  196. }
  197. private Color m_ForeColorPressed = DefaultTheme.ForeColor + DefaultTheme.ForeColorPressedVector;
  198. /// <summary>
  199. /// 前景鼠标按下颜色向量
  200. /// </summary>
  201. public Color ForeColorPressed
  202. {
  203. get
  204. {
  205. return this.m_ForeColorPressed;
  206. }
  207. set
  208. {
  209. if (value != this.m_ForeColorPressed)
  210. {
  211. this.m_ForeColorPressed = value;
  212. this.Feedback();
  213. }
  214. }
  215. }
  216. private Color m_ForeColorFocused = DefaultTheme.ForeColor + DefaultTheme.ForeColorFocusedVector;
  217. /// <summary>
  218. /// 前景获取焦点颜色向量
  219. /// </summary>
  220. public Color ForeColorFocused
  221. {
  222. get
  223. {
  224. return this.m_ForeColorFocused;
  225. }
  226. set
  227. {
  228. if (value != this.m_ForeColorFocused)
  229. {
  230. this.m_ForeColorFocused = value;
  231. this.Feedback();
  232. }
  233. }
  234. }
  235. private Color m_ForeColorDisabled = DefaultTheme.ForeColor + DefaultTheme.ForeColorDisabledVector;
  236. /// <summary>
  237. /// 前景状态禁用颜色向量
  238. /// </summary>
  239. public Color ForeColorDisabled
  240. {
  241. get
  242. {
  243. return this.m_ForeColorDisabled;
  244. }
  245. set
  246. {
  247. if (value != this.m_ForeColorDisabled)
  248. {
  249. this.m_ForeColorDisabled = value;
  250. this.Feedback();
  251. }
  252. }
  253. }
  254. private Color m_ForeColorHighlight = DefaultTheme.ForeColor + DefaultTheme.ForeColorHighlightVector;
  255. /// <summary>
  256. /// 前景高亮颜色向量
  257. /// </summary>
  258. public Color ForeColorHighlight
  259. {
  260. get
  261. {
  262. return this.m_ForeColorHighlight;
  263. }
  264. set
  265. {
  266. if (value != this.m_ForeColorHighlight)
  267. {
  268. this.m_ForeColorHighlight = value;
  269. this.Feedback();
  270. }
  271. }
  272. }
  273. private TextRenderingHint m_TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
  274. /// <summary>
  275. /// 文本呈现质量
  276. /// </summary>
  277. public TextRenderingHint TextRenderingHint
  278. {
  279. get
  280. {
  281. return this.m_TextRenderingHint;
  282. }
  283. set
  284. {
  285. if (value != this.m_TextRenderingHint)
  286. {
  287. this.m_TextRenderingHint = value;
  288. this.Feedback();
  289. }
  290. }
  291. }
  292. private ContentAlignment m_TextAlign = ContentAlignment.MiddleCenter;
  293. /// <summary>
  294. /// 文本对齐方式
  295. /// </summary>
  296. public ContentAlignment TextAlign
  297. {
  298. get
  299. {
  300. return this.m_TextAlign;
  301. }
  302. set
  303. {
  304. if (value != this.m_TextAlign)
  305. {
  306. this.m_TextAlign = value;
  307. this.Feedback();
  308. }
  309. }
  310. }
  311. private float m_TextRotateAngle = 0f;
  312. /// <summary>
  313. /// 文本旋转角度
  314. /// </summary>
  315. public float TextRotateAngle
  316. {
  317. get
  318. {
  319. return this.m_TextRotateAngle;
  320. }
  321. set
  322. {
  323. if (value != this.m_TextRotateAngle)
  324. {
  325. this.m_TextRotateAngle = value;
  326. this.Feedback();
  327. }
  328. }
  329. }
  330. private bool m_TextGrayOnDisabled = true;
  331. /// <summary>
  332. /// 状态禁用时文本是否变灰
  333. /// </summary>
  334. public bool TextGrayOnDisabled
  335. {
  336. get
  337. {
  338. return this.m_TextGrayOnDisabled;
  339. }
  340. set
  341. {
  342. if (value != this.m_TextGrayOnDisabled)
  343. {
  344. this.m_TextGrayOnDisabled = value;
  345. this.Feedback();
  346. }
  347. }
  348. }
  349. private ShadowShapeStyle m_TextShadowShapeStyle = ShadowShapeStyle.None;
  350. /// <summary>
  351. /// 文本阴影描边样式
  352. /// </summary>
  353. public ShadowShapeStyle TextShadowShapeStyle
  354. {
  355. get
  356. {
  357. return this.m_TextShadowShapeStyle;
  358. }
  359. set
  360. {
  361. if (value != this.m_TextShadowShapeStyle)
  362. {
  363. this.m_TextShadowShapeStyle = value;
  364. this.Feedback();
  365. }
  366. }
  367. }
  368. private Color m_TextShadowColor = DefaultTheme.LightLightForeColor;
  369. /// <summary>
  370. /// 阴影颜色
  371. /// </summary>
  372. public Color TextShadowColor
  373. {
  374. get
  375. {
  376. return this.m_TextShadowColor;
  377. }
  378. set
  379. {
  380. if (value != this.m_TextShadowColor)
  381. {
  382. this.m_TextShadowColor = value;
  383. this.Feedback();
  384. }
  385. }
  386. }
  387. private Point m_TextShadowMatrixOffset = Point.Empty;
  388. /// <summary>
  389. /// 阴影偏移量
  390. /// </summary>
  391. public Point TextShadowMatrixOffset
  392. {
  393. get
  394. {
  395. return this.m_TextShadowMatrixOffset;
  396. }
  397. set
  398. {
  399. if (value != this.m_TextShadowMatrixOffset)
  400. {
  401. this.m_TextShadowMatrixOffset = value;
  402. this.Feedback();
  403. }
  404. }
  405. }
  406. private Color m_TextShapeOfShadowColor = DefaultTheme.LightLightForeColor;
  407. /// <summary>
  408. /// 阴影描边颜色
  409. /// </summary>
  410. public Color TextShapeOfShadowColor
  411. {
  412. get
  413. {
  414. return this.m_TextShapeOfShadowColor;
  415. }
  416. set
  417. {
  418. if (value != this.m_TextShapeOfShadowColor)
  419. {
  420. this.m_TextShapeOfShadowColor = value;
  421. this.Feedback();
  422. }
  423. }
  424. }
  425. private float m_TextShapeOfShadowWidth = 0f;
  426. /// <summary>
  427. /// 阴影描边宽度
  428. /// </summary>
  429. public float TextShapeOfShadowWidth
  430. {
  431. get
  432. {
  433. return this.m_TextShapeOfShadowWidth;
  434. }
  435. set
  436. {
  437. if (value != this.m_TextShapeOfShadowWidth)
  438. {
  439. this.m_TextShapeOfShadowWidth = value;
  440. this.Feedback();
  441. }
  442. }
  443. }
  444. private Color m_TextShapeOfTextColor = DefaultTheme.LightLightForeColor;
  445. /// <summary>
  446. /// 文本描边颜色
  447. /// </summary>
  448. public Color TextShapeOfTextColor
  449. {
  450. get
  451. {
  452. return this.m_TextShapeOfTextColor;
  453. }
  454. set
  455. {
  456. if (value != this.m_TextShapeOfTextColor)
  457. {
  458. this.m_TextShapeOfTextColor = value;
  459. this.Feedback();
  460. }
  461. }
  462. }
  463. private float m_TextShapeOfTextWidth = 0f;
  464. /// <summary>
  465. /// 文本描边宽度
  466. /// </summary>
  467. public float TextShapeOfTextWidth
  468. {
  469. get
  470. {
  471. return this.m_TextShapeOfTextWidth;
  472. }
  473. set
  474. {
  475. if (value != this.m_TextShapeOfTextWidth)
  476. {
  477. this.m_TextShapeOfTextWidth = value;
  478. this.Feedback();
  479. }
  480. }
  481. }
  482. }
  483. }