コード例 #1
0
        /// <summary>
        /// Load properties from registry
        /// </summary>
        public static void LoadFromRegistry()
        {
            try
            {
                RegistryKey key = MkaDefine.RootKey.OpenSubKey(MkaDefine.GraphicsKey);

                LastProperties.BorderColorHtml = key.GetValue(MkaDefine.GraphicBorderColor).ToString();
                LastProperties.PenWidth        = float.Parse(key.GetValue(MkaDefine.GraphicPenWidth).ToString());
                LastProperties.FillColorHtml   = key.GetValue(MkaDefine.GraphicFillColor).ToString();
                LastProperties.FillColorAlpha  = int.Parse(key.GetValue(MkaDefine.GraphicColorAlpha).ToString());
                LastProperties.RFontSize       = float.Parse(key.GetValue(MkaDefine.RFontSize).ToString());
            }
            catch (Exception ex)
            {
                LastProperties = new GraphicsProperties();
                _log.Warn(MkaMessage.WarnLoadRegistry + " - " + ex.Message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Apply properties for all selected objects.
        /// Returns TRue if at least one property is changed.
        /// </summary>
        private bool ApplyProperties(MkaMokkanInfo info, GraphicsProperties properties)
        {
            bool changed = false;

            if (SelectionCount == 1)
            {
                if (SelectedObjects[0].MokkanInfo.RBangou != info.RBangou)
                {
                    SelectedObjects[0].MokkanInfo.RBangou = info.RBangou;
                    changed = true;
                }
            }

            foreach (DrawObject o in Selection)
            {
                if (o.MokkanInfo.KariShakubun != info.KariShakubun)
                {
                    o.MokkanInfo.KariShakubun = info.KariShakubun;
                    changed = true;
                }

                if (o.MokkanInfo.GaihouShoshuuJyouhou != info.GaihouShoshuuJyouhou)
                {
                    o.MokkanInfo.GaihouShoshuuJyouhou = info.GaihouShoshuuJyouhou;
                    changed = true;
                }

                if (o.MokkanInfo.ShasinBangouJyouhou != info.ShasinBangouJyouhou)
                {
                    o.MokkanInfo.ShasinBangouJyouhou = info.ShasinBangouJyouhou;
                    changed = true;
                }

                if (o.MokkanInfo.Bikou != info.Bikou)
                {
                    o.MokkanInfo.Bikou = info.Bikou;
                    changed            = true;
                }

                // border color
                if (o.Properties.BorderColor != properties.BorderColor)
                {
                    o.Properties.BorderColor = properties.BorderColor;
                    changed = true;
                }

                // border pen width
                if (o.Properties.PenWidth != properties.PenWidth)
                {
                    o.Properties.PenWidth = properties.PenWidth;
                    changed = true;
                }


                // fill area color
                if (o.Properties.FillColor != properties.FillColor)
                {
                    o.Properties.FillColor = properties.FillColor;
                    changed = true;
                }

                // fill area transparent
                if (o.Properties.FillColorAlpha != properties.FillColorAlpha)
                {
                    o.Properties.FillColorAlpha = properties.FillColorAlpha;
                    changed = true;
                }

                // remain id show position
                if (o.Properties.RShowPosition != properties.RShowPosition)
                {
                    o.Properties.RShowPosition = properties.RShowPosition;
                    changed = true;
                }
            }

            return(changed);
        }
コード例 #3
0
        /// <summary>
        /// Get properties from selected objects and fill GraphicsProperties instance
        /// </summary>
        /// <returns></returns>
        private void GetProperties(ref MkaMokkanInfo info, ref GraphicsProperties properties)
        {
            bool bFirst = true;

            string       firstKariShakubun         = "";
            string       firstGaihouShoshuuJyouhou = "";
            string       firstShashinBangouJyouhou = "";
            string       firstBikou       = "";
            string       firstBorderColor = "";
            float        firstPenWidth    = 1;
            string       firstFillColor   = "";
            int          firstAreaAlpha   = 0;
            ShowPosition firstPos         = ShowPosition.Top;

            bool allKariShakubunAreEqual         = true;
            bool allGaihouShoshuuJyouhouAreEqual = true;
            bool allShashinBangouJyouhouAreEqual = true;
            bool allBikouAreEqual       = true;
            bool allBorderColorAreEqual = true;
            bool allPenWidthAreEqual    = true;
            bool allFillColorAreEqual   = true;
            bool allAreaAlphaAreEqual   = true;
            bool allShowPosAreEqual     = true;

            foreach (DrawObject o in Selection)
            {
                if (bFirst)
                {
                    firstKariShakubun         = o.MokkanInfo.KariShakubun;
                    firstGaihouShoshuuJyouhou = o.MokkanInfo.GaihouShoshuuJyouhou;
                    firstShashinBangouJyouhou = o.MokkanInfo.ShasinBangouJyouhou;
                    firstBikou = o.MokkanInfo.Bikou;

                    firstBorderColor = o.Properties.BorderColorHtml;
                    firstPenWidth    = o.Properties.PenWidth;
                    firstFillColor   = o.Properties.FillColorHtml;
                    firstAreaAlpha   = o.Properties.FillColorAlpha;
                    firstPos         = o.Properties.RShowPosition;
                    bFirst           = false;
                }
                else
                {
                    if (o.MokkanInfo.KariShakubun != firstKariShakubun)
                    {
                        allKariShakubunAreEqual = false;
                    }

                    if (o.MokkanInfo.GaihouShoshuuJyouhou != firstGaihouShoshuuJyouhou)
                    {
                        allGaihouShoshuuJyouhouAreEqual = false;
                    }

                    if (o.MokkanInfo.ShasinBangouJyouhou != firstShashinBangouJyouhou)
                    {
                        allShashinBangouJyouhouAreEqual = false;
                    }

                    if (o.MokkanInfo.Bikou != firstBikou)
                    {
                        allBikouAreEqual = false;
                    }

                    if (o.Properties.BorderColorHtml != firstBorderColor)
                    {
                        allBorderColorAreEqual = false;
                    }

                    if (o.Properties.PenWidth != firstPenWidth)
                    {
                        allPenWidthAreEqual = false;
                    }

                    if (o.Properties.FillColorHtml != firstFillColor)
                    {
                        allFillColorAreEqual = false;
                    }

                    if (o.Properties.FillColorAlpha != firstAreaAlpha)
                    {
                        allAreaAlphaAreEqual = false;
                    }

                    if (o.Properties.RShowPosition != firstPos)
                    {
                        allShowPosAreEqual = false;
                    }
                }
            }

            if (SelectionCount == 1)
            {
                info.RBangou = SelectedObjects[0].MokkanInfo.RBangou;
            }

            if (allKariShakubunAreEqual)
            {
                info.KariShakubun = firstKariShakubun;
            }

            if (allGaihouShoshuuJyouhouAreEqual)
            {
                info.GaihouShoshuuJyouhou = firstGaihouShoshuuJyouhou;
            }

            if (allShashinBangouJyouhouAreEqual)
            {
                info.ShasinBangouJyouhou = firstShashinBangouJyouhou;
            }

            if (allBikouAreEqual)
            {
                info.Bikou = firstBikou;
            }

            if (allBorderColorAreEqual)
            {
                properties.BorderColor = ColorTranslator.FromHtml(firstBorderColor);
            }

            if (allPenWidthAreEqual)
            {
                properties.PenWidth = firstPenWidth;
            }

            if (allFillColorAreEqual)
            {
                properties.FillColor = ColorTranslator.FromHtml(firstFillColor);
            }

            if (allAreaAlphaAreEqual)
            {
                properties.FillColorAlpha = firstAreaAlpha;
            }

            if (allShowPosAreEqual)
            {
                properties.RShowPosition = firstPos;
            }
        }
コード例 #4
0
        /// <summary>
        /// Clone this instance
        /// </summary>
        public GraphicsProperties Clone()
        {
            GraphicsProperties ret = (GraphicsProperties)this.MemberwiseClone();

            return(ret);
        }