예제 #1
0
        /// <summary>
        /// Apply properties for all selected objects
        /// </summary>
        private void ApplyProperties(GraphicsProperties properties)
        {
            //foreach (DrawObject o in graphicsList)
            //{
            //    if (o.Selected)
            //    {
            //        if (properties.ColorDefined)
            //        {
            //            o.Color = properties.Color;
            //            DrawObject.LastUsedColor = properties.Color;
            //        }

            //        if (properties.PenWidthDefined)
            //        {
            //            o.PenWidth = properties.PenWidth;
            //            DrawObject.LastUsedPenWidth = properties.PenWidth;
            //        }
            //    }
            //}
        }
예제 #2
0
        /// <summary>
        /// Show Properties dialog. Return true if list is changed
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        public bool ShowPropertiesDialog(IWin32Window parent)
        {
            if (SelectionCount < 1)
            {
                return(false);
            }

            GraphicsProperties properties = GetProperties();
            PropertiesDialog   dlg        = new PropertiesDialog();

            dlg.Properties = properties;

            if (dlg.ShowDialog(parent) != DialogResult.OK)
            {
                return(false);
            }

            ApplyProperties(properties);

            return(true);
        }
예제 #3
0
        /// <summary>
        /// Get properties from selected objects and fill GraphicsProperties instance
        /// </summary>
        /// <returns></returns>
        private GraphicsProperties GetProperties()
        {
            GraphicsProperties properties = new GraphicsProperties();

            //int n = SelectionCount;

            //if (n < 1)
            //    return properties;

            //DrawObject o = GetSelectedObject(0);

            //int firstColor = o.Color.ToArgb();
            //int firstPenWidth = o.PenWidth;

            //bool allColorsAreEqual = true;
            //bool allWidthAreEqual = true;

            //for (int i = 1; i < n; i++)
            //{
            //    if (GetSelectedObject(i).Color.ToArgb() != firstColor)
            //        allColorsAreEqual = false;

            //    if (GetSelectedObject(i).PenWidth != firstPenWidth)
            //        allWidthAreEqual = false;
            //}

            //if (allColorsAreEqual)
            //{
            //    properties.ColorDefined = true;
            //    properties.Color = Color.FromArgb(firstColor);
            //}

            //if (allWidthAreEqual)
            //{
            //    properties.PenWidthDefined = true;
            //    properties.PenWidth = firstPenWidth;
            //}

            return(properties);
        }
예제 #4
0
		/// <summary>
		/// Apply properties for all selected objects
		/// </summary>
		private void ApplyProperties(GraphicsProperties properties)
		{
			//foreach (DrawObject o in graphicsList)
			//{
			//    if (o.Selected)
			//    {
			//        if (properties.ColorDefined)
			//        {
			//            o.Color = properties.Color;
			//            DrawObject.LastUsedColor = properties.Color;
			//        }

			//        if (properties.PenWidthDefined)
			//        {
			//            o.PenWidth = properties.PenWidth;
			//            DrawObject.LastUsedPenWidth = properties.PenWidth;
			//        }
			//    }
			//}
		}
예제 #5
0
		/// <summary>
		/// Get properties from selected objects and fill GraphicsProperties instance
		/// </summary>
		/// <returns></returns>
		private GraphicsProperties GetProperties()
		{
			GraphicsProperties properties = new GraphicsProperties();

			//int n = SelectionCount;

			//if (n < 1)
			//    return properties;

			//DrawObject o = GetSelectedObject(0);

			//int firstColor = o.Color.ToArgb();
			//int firstPenWidth = o.PenWidth;

			//bool allColorsAreEqual = true;
			//bool allWidthAreEqual = true;

			//for (int i = 1; i < n; i++)
			//{
			//    if (GetSelectedObject(i).Color.ToArgb() != firstColor)
			//        allColorsAreEqual = false;

			//    if (GetSelectedObject(i).PenWidth != firstPenWidth)
			//        allWidthAreEqual = false;
			//}

			//if (allColorsAreEqual)
			//{
			//    properties.ColorDefined = true;
			//    properties.Color = Color.FromArgb(firstColor);
			//}

			//if (allWidthAreEqual)
			//{
			//    properties.PenWidthDefined = true;
			//    properties.PenWidth = firstPenWidth;
			//}

			return properties;
		}