| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using static System.Net.Mime.MediaTypeNames; |
| | | using static System.Runtime.InteropServices.JavaScript.JSType; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace DPumpHydr.WinFrmUI.Volute |
| | | { |
| | |
| | | public ctrlHdrBaseInfo() |
| | | { |
| | | InitializeComponent(); |
| | | Tips(); |
| | | addimage(); |
| | | BuildAllTips(); |
| | | BuildLeadingIcon(); |
| | | } |
| | | private string ResourcesPath = @"Data\MainForm\Icons"; |
| | | |
| | | public void SetBindingData(ViewModel.HdrBaseInfo vm) |
| | | { |
| | | |
| | | } |
| | | public ViewModel.HdrBaseInfo GetBindingData(out string error) |
| | | { |
| | | if(!Verify(out error)) |
| | | { |
| | | return null; |
| | | } |
| | | error = null; |
| | | |
| | | return null; |
| | | } |
| | | public bool Verify(out string error) |
| | | { |
| | | error = ""; |
| | |
| | | if (string.IsNullOrEmpty(mTextBoxEditæ»æµé.Text) || mTextBoxEditæ»æµé.Text == "请è¾å
¥æ»æµé") |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | mTextBoxEditæ»æµé.TrailingIcon = Icon(ResourcesPath, image); |
| | | mTextBoxEditæ»æµé.TrailingIcon = BuildIcon(ResourcesPath, image); |
| | | skyLabelæ»æµé.Visible = true; |
| | | } |
| | | if (string.IsNullOrEmpty(mTextBoxEdit转é.Text) || mTextBoxEdit转é.Text == "请è¾å
¥è½¬é") |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | mTextBoxEdit转é.TrailingIcon = Icon(ResourcesPath, image); |
| | | mTextBoxEdit转é.TrailingIcon = BuildIcon(ResourcesPath, image); |
| | | skyLabel转é.Visible = true; |
| | | } |
| | | if (string.IsNullOrEmpty(mTextBoxEditæ¬ç¨.Text) || mTextBoxEditæ¬ç¨.Text == "请è¾å
¥æ¬ç¨") |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | mTextBoxEditæ¬ç¨.TrailingIcon = Icon(ResourcesPath, image); |
| | | mTextBoxEditæ¬ç¨.TrailingIcon = BuildIcon(ResourcesPath, image); |
| | | skyLabelæ¬ç¨.Visible = true; |
| | | } |
| | | if (string.IsNullOrEmpty(mTextBoxEditåºå£ç´å¾.Text) || mTextBoxEditåºå£ç´å¾.Text == "请è¾å
¥åºå£ç´å¾") |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | mTextBoxEditåºå£ç´å¾.TrailingIcon = Icon(ResourcesPath, image); |
| | | mTextBoxEditåºå£ç´å¾.TrailingIcon = BuildIcon(ResourcesPath, image); |
| | | skyLabelåºå£ç´å¾.Visible = true; |
| | | } |
| | | if (string.IsNullOrEmpty(mTextBoxEditåºå£å®½åº¦.Text) || mTextBoxEditåºå£å®½åº¦.Text == "请è¾å
¥åºå£å®½åº¦") |
| | | { |
| | | error = "请è¾å
¥å¿
填项ï¼"; |
| | | mTextBoxEditåºå£å®½åº¦.TrailingIcon = Icon(ResourcesPath, image); |
| | | mTextBoxEditåºå£å®½åº¦.TrailingIcon = BuildIcon(ResourcesPath, image); |
| | | skyLabelåºå£å®½åº¦.Visible = true; |
| | | } |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | private void addimage() |
| | | |
| | | |
| | | //Leadingicon è¾å
¥æ¡åç¼å¾ç |
| | | private string ResourcesPath = @"Data\MainForm\Icons"; |
| | | private void BuildLeadingIcon() |
| | | { |
| | | //Leadingicon è¾å
¥æ¡åç¼å¾ç |
| | | var image = "north-star.png"; |
| | | mTextBoxEditæ»æµé.LeadingIcon = Icon(ResourcesPath, image); |
| | | mTextBoxEdit转é.LeadingIcon = Icon(ResourcesPath, image); |
| | | mTextBoxEditæ¬ç¨.LeadingIcon = Icon(ResourcesPath, image); |
| | | mTextBoxEditåºå£ç´å¾.LeadingIcon = Icon(ResourcesPath, image); |
| | | mTextBoxEditåºå£å®½åº¦.LeadingIcon = Icon(ResourcesPath, image); |
| | | var image = BuildIcon(ResourcesPath, "north-star.png"); |
| | | if (image == null) |
| | | { |
| | | return; |
| | | } |
| | | mTextBoxEditæ»æµé.LeadingIcon = image; |
| | | mTextBoxEdit转é.LeadingIcon = image; |
| | | mTextBoxEditæ¬ç¨.LeadingIcon = image; |
| | | mTextBoxEditåºå£ç´å¾.LeadingIcon = image; |
| | | mTextBoxEditåºå£å®½åº¦.LeadingIcon = image; |
| | | } |
| | | |
| | | private void Tips() |
| | | private void BuildAllTips() |
| | | { |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.RBtnæè½¬å, "æè½¬å"); |
| | | metroToolTipç¬¬ä¸æ¥æç¤º.SetToolTip(this.RBtnåè壳å, "åè壳å"); |
| | |
| | | /// <param name="path">æä»¶å¤¹è·¯å¾ï¼ç¼è¯è·¯å¾ä¸çï¼</param> |
| | | /// <param name="filename">æä»¶å</param> |
| | | /// <returns></returns> |
| | | private System.Drawing.Image Icon(string path, string filename) |
| | | private System.Drawing.Image BuildIcon(string path, string filename) |
| | | { |
| | | System.Drawing.Image thumbnail = AssembledPath(path, filename).GetThumbnailImage(20, 20, () => false, IntPtr.Zero); |
| | | var image = BuildImage(path, filename); |
| | | if (image == null) |
| | | return null; |
| | | System.Drawing.Image thumbnail = image.GetThumbnailImage(20, 20, () => false, IntPtr.Zero); |
| | | return thumbnail; |
| | | } |
| | | |
| | |
| | | /// <param name="path">è·¯å¾</param> |
| | | /// <param name="filename">æä»¶å</param> |
| | | /// <returns></returns> |
| | | private System.Drawing.Image AssembledPath(string path, string filename) |
| | | private System.Drawing.Image BuildImage(string path, string filename) |
| | | { |
| | | if (path == null && filename == null) |
| | | { |
| | | return null; |
| | | } |
| | | string fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path, filename); |
| | | System.Drawing.Image image = System.Drawing.Image.FromFile(fullPath); |
| | | return image; |
| | | if (File.Exists(fullPath)) |
| | | { |
| | | System.Drawing.Image image = System.Drawing.Image.FromFile(fullPath); |
| | | return image; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |