Пример #1
0
 public static void SetButtonStyle4QueryAndClear(UCBase ucBase, ButtonEx btnQuery, ButtonEx btnClear, Boolean autoSize = true)
 {
     var query = new ButtonEx {Caption = btnQuery.Caption};
     query.Click += delegate {
         btnQuery.PerformClick();
     };
     var clear = new ButtonEx {Caption = btnClear.Caption};
     clear.Click += delegate
     {
         btnClear.PerformClick();
     };
     ucBase.AddToolStripItem(clear, 0);
     ucBase.AddToolStripItem(query, 0);
     SetButtonStyle4QueryAndClear(btnQuery, btnClear, false);
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtionClick(object sender, EventArgs e)
        {
            ButtonEx btn        = sender as ButtonEx;
            string   buttonText = string.Empty;

            if (btn != null)
            {
                buttonText = btn.Caption;
            }

            if (buttonText.Equals(STR_BUTTON_TEXT_OK))
            {
                this.DialogResult = DialogResult.OK;
            }
            else if (buttonText.Equals(STR_BUTTON_TEXT_CANCEL))
            {
                this.DialogResult = DialogResult.Cancel;
            }
            else if (buttonText.Equals(STR_BUTTON_TEXT_YES))
            {
                this.DialogResult = DialogResult.Yes;
            }
            else if (buttonText.Equals(STR_BUTTON_TEXT_NO))
            {
                this.DialogResult = DialogResult.No;
            }
            else if (buttonText.Equals(STR_BUTTON_TEXT_ABORT))
            {
                this.DialogResult = DialogResult.Abort;
            }
            else if (buttonText.Equals(STR_BUTTON_TEXT_IGNORE))
            {
                this.DialogResult = DialogResult.Ignore;
            }
            else if (buttonText.Equals(STR_BUTTON_TEXT_RETRY))
            {
                this.DialogResult = DialogResult.Retry;
            }
            else
            {
                this.DialogResult = DialogResult.None;
            }
        }
Пример #3
0
 public static void SetButtonStyle4QueryAndClear(ButtonEx btnQuery, ButtonEx btnClear, Boolean autoSize)
 {
     try
     {
         btnQuery.BackgroundImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage("Query_E", false);
         btnClear.BackgroundImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage("Clear_E", false);
         btnQuery.NormalImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage("Query_E", false);
         btnClear.NormalImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage("Clear_E", false);
         btnQuery.MoveImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage("Query_L", false);
         btnClear.MoveImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage("Clear_L", false);
         btnQuery.DownImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage("Query_L", false);
         btnClear.DownImage = ServiceStationClient.Skin.SkinAssistant.GetResourcesImage("Clear_L", false);
         if(autoSize)
             btnQuery.Anchor = btnClear.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right);
         btnQuery.Size = btnClear.Size = new Size(80, 24);
         btnQuery.Caption = btnClear.Caption = "";
     }
     catch (Exception ex)
     {
         //Write log
     }
 }
Пример #4
0
 private void CopyButtonInfo2MenuItem(ButtonEx cmdButton, ToolStripItem tsmi)
 {
     if (cmdButton == null || tsmi == null) return;
     cmdButton.Tag = tsmi;
     tsmi.Text = cmdButton.Caption;
     tsmi.Enabled = cmdButton.Enabled;
     tsmi.Visible = cmdButton.Visible;
     tsmi.Tag = cmdButton;
     tsmi.Click += TsmiOnClick4ButtonEx;
     cmdButton.EnabledChanged += delegate(object sender, EventArgs args)
     {
         var cSender = sender as ButtonEx;
         if (cSender == null) return;
         if ((cSender.Tag as ToolStripItem) != null)
         {
             (cSender.Tag as ToolStripItem).Enabled = cSender.Enabled;
         }
     };
     cmdButton.VisibleChanged += delegate(object sender, EventArgs args)
     {
         var cSender = sender as ButtonEx;
         if (cSender != null && (cSender.Tag as ToolStripItem) != null)
         {
             (cSender.Tag as ToolStripItem).Visible = cSender.Visible;
         }
     };
     cmdButton.TextChanged += delegate(object sender, EventArgs args)
     {
         var cSender = sender as ButtonEx;
         if (cSender != null && (cSender.Tag as ToolStripItem) != null)
         {
             (cSender.Tag as ToolStripItem).Text = cSender.Text;
         }
     };
 }
Пример #5
0
 public void AddToolStripItem(ButtonEx button, int index)
 {
     if (index < 0) index = 0;
     if (index > cms_Function.Items.Count) index = cms_Function.Items.Count;
     var tsmi = new ToolStripMenuItem
     {
         Name = "tsmi" + button.Name,
         Size = new System.Drawing.Size(165, 22),
     };
     CopyButtonInfo2MenuItem(button, tsmi);
     cms_Function.Items.Insert(index, tsmi);
 }
Пример #6
0
 public void AddToolStripItem(ButtonEx button)
 {
     AddToolStripItem(button, cms_Function.Items.Count);
 }
Пример #7
0
 /// <summary>
 /// 设置查询和清除按钮的样式,此方法会修改一下属性值(BackgroundImage,NormalImage,MoveImage,DownImage,Anchor,Size,Caption)
 /// </summary>
 /// <param name="btnQuery">查询按钮</param>
 /// <param name="btnClear">清除按钮</param>
 public static void SetButtonStyle4QueryAndClear(ButtonEx btnQuery, ButtonEx btnClear)
 {
     SetButtonStyle4QueryAndClear(btnQuery, btnClear, false);
 }