Пример #1
0
//		// method to add a pushbutton to the ribbon
//		private bool AddPushButton(RibbonPanel Panel,
//			string ButtonName,
//			string ButtonText,
//			string Image16,
//			string Image32,
//			string dllPath,
//			string dllClass,
//			string ToolTip)
//		{
//			try
//			{
//				PushButtonData m_pdData = new PushButtonData(ButtonName,
//					ButtonText, dllPath, dllClass);
//				// if we have a path for a small image, try to load the image
//				if (Image16.Length != 0)
//				{
//					try
//					{
//						// load the image
//						m_pdData.Image = ShUtil.GetBitmapImage(Image16);
//					}
//					catch
//					{
//						// could not locate the image
//					}
//				}
//
//				// if have a path for a large image, try to load the image
//				if (Image32.Length != 0)
//				{
//					try
//					{
//						// load the image
//						m_pdData.LargeImage = ShUtil.GetBitmapImage(Image32);
//					}
//					catch
//					{
//						// could not locate the image
//					}
//				}
//
//				// set the tooltip
//				m_pdData.ToolTip = ToolTip;
//
//				// add it to the panel
//				PushButton m_pb = Panel.AddItem(m_pdData) as PushButton;
//
//				return true;
//			}
//			catch
//			{
//				return false;
//			}
//		}

        // method to make a pushbutton for the ribbon
        private PushButtonData MakePushButton(RibbonPanel Panel,
                                              string ButtonName,
                                              string ButtonText,
                                              string Image16,
                                              string Image32,
                                              string dllPath,
                                              string dllClass,
                                              string ToolTip)
        {
            try
            {
                PushButtonData pdData = new PushButtonData(ButtonName,
                                                           ButtonText, dllPath, dllClass);
                // if we have a path for a small image, try to load the image
                if (Image16.Length != 0)
                {
                    try
                    {
                        // load the image
                        pdData.Image = ShUtil.GetBitmapImage(Image16);
                    }
                    catch
                    {
                        // could not locate the image
                    }
                }

                // if have a path for a large image, try to load the image
                if (Image32.Length != 0)
                {
                    try
                    {
                        // load the image
                        pdData.LargeImage = ShUtil.GetBitmapImage(Image32);
                    }
                    catch
                    {
                        // could not locate the image
                    }
                }

                // set the tooltip
                pdData.ToolTip = ToolTip;

//				ContextualHelp cHelp = new ContextualHelp(ContextualHelpType.Url,
//					AppStrings.R_CyberStudioAddr);
//
//				pdData.SetContextualHelp(cHelp);

                return(pdData);
            }
            catch
            {
                return(null);
            }
        }
Пример #2
0
        // method to make a pushbutton for the ribbon
        private PushButtonData MakePushButton(RibbonPanel Panel,
                                              string ButtonName,
                                              string ButtonText,
                                              string Image16,
                                              string Image32,
                                              string dllPath,
                                              string dllClass,
                                              string ToolTip)
        {
            try
            {
                PushButtonData pdData = new PushButtonData(ButtonName,
                                                           ButtonText, dllPath, dllClass);
                // if we have a path for a small image, try to load the image
                if (Image16.Length != 0)
                {
                    try
                    {
                        // load the image
                        pdData.Image = ShUtil.GetBitmapImage(Image16);
                    }
                    catch
                    {
                        // could not locate the image
                    }
                }

                // if have a path for a large image, try to load the image
                if (Image32.Length != 0)
                {
                    try
                    {
                        // load the image
                        pdData.LargeImage = ShUtil.GetBitmapImage(Image32);
                    }
                    catch
                    {
                        // could not locate the image
                    }
                }

                // set the tooltip
                pdData.ToolTip = ToolTip;

                return(pdData);
            }
            catch
            {
                return(null);
            }
        }