コード例 #1
0
ファイル: Painter.cs プロジェクト: aureliopires/gisa
		public static void DrawBorder(Graphics g,ViewStyle viewStyle,Rectangle controlRect,bool hot)
		{
			controlRect = new Rectangle(controlRect.X,controlRect.Y,controlRect.Width - 1,controlRect.Height - 1);

			if(hot){
				g.DrawRectangle(new Pen(viewStyle.BorderHotColor),controlRect);
			}
			else{
				g.DrawRectangle(new Pen(viewStyle.BorderColor),controlRect);
			}
		}
コード例 #2
0
ファイル: Painter.cs プロジェクト: aureliopires/gisa
		public static void DrawButton(Graphics g,ViewStyle viewStyle,Rectangle buttonRect,bool border_hot,bool btn_hot,bool btn_pressed)
		{
			if(btn_hot){
				if(btn_pressed){
					g.FillRectangle(new SolidBrush(viewStyle.ButtonPressedColor),buttonRect);
				}
				else{
					g.FillRectangle(new SolidBrush(viewStyle.ButtonHotColor),buttonRect);
				}
			}
			else{
				g.FillRectangle(new SolidBrush(viewStyle.ButtonColor),buttonRect);
			}

			//----- Draw border around button ----------------------------//
			// Append borders to button
			buttonRect = new Rectangle(buttonRect.X-1,buttonRect.Y-1,buttonRect.Width+1,buttonRect.Height+1);
			if(border_hot || btn_hot || btn_pressed){
				g.DrawRectangle(new Pen(viewStyle.BorderHotColor),buttonRect);
			}
			else{
				g.DrawRectangle(new Pen(viewStyle.BorderColor),buttonRect);
			}
		}
コード例 #3
0
ファイル: ViewStyle.cs プロジェクト: aureliopires/gisa
		/// <summary>
		/// Copies ViewStyle from source ViewStyle.
		/// Copies values even if, ViewStyle is ReadOnly !
		/// </summary>
		/// <param name="sourceViewStyle"></param>
		public void CopyFrom(ViewStyle sourceViewStyle)
		{
			bool readOnly = m_ReadOnly;

			if(m_ReadOnly){
				m_ReadOnly = false;
			}

			this.BorderColor              = sourceViewStyle.BorderColor; 
			this.BorderHotColor           = sourceViewStyle.BorderHotColor; 
			this.ButtonColor              = sourceViewStyle.ButtonColor; 
			this.ButtonHotColor           = sourceViewStyle.ButtonHotColor; 
			this.ButtonPressedColor       = sourceViewStyle.ButtonPressedColor;
			this.ControlBackColor         = sourceViewStyle.ControlBackColor; 
		//	this.ControlForeColor         = sourceViewStyle.ControlForeColor; 
			this.EditColor                = sourceViewStyle.EditColor; 
			this.EditFocusedColor         = sourceViewStyle.EditFocusedColor;
			this.EditReadOnlyColor        = sourceViewStyle.EditReadOnlyColor;
		    this.EditDisabledColor        = sourceViewStyle.EditDisabledColor;
			this.BarColor                 = sourceViewStyle.BarColor;
			this.BarHotColor              = sourceViewStyle.BarHotColor;
			this.BarTextColor             = sourceViewStyle.BarTextColor;
			this.BarHotTextColor          = sourceViewStyle.BarHotTextColor;
			this.BarPressedColor          = sourceViewStyle.BarPressedColor;
			this.BarBorderColor           = sourceViewStyle.BarBorderColor;
			this.BarHotBorderColor        = sourceViewStyle.BarHotBorderColor;
			this.BarClientAreaColor1      = sourceViewStyle.BarClientAreaColor1;
			this.BarClientAreaColor2      = sourceViewStyle.BarClientAreaColor2;
			this.BarItemSelectedColor     = sourceViewStyle.BarItemSelectedColor;
			this.BarItemSelectedTextColor = sourceViewStyle.BarItemSelectedTextColor;
			this.BarItemHotColor          = sourceViewStyle.BarItemHotColor; 
			this.BarItemPressedColor      = sourceViewStyle.BarItemPressedColor;
			this.BarItemBorderHotColor    = sourceViewStyle.BarItemBorderHotColor;
			this.BarItemTextColor         = sourceViewStyle.BarItemTextColor;
			this.BarItemHotTextColor      = sourceViewStyle.BarItemHotTextColor;
			this.BarItemsStyle            = sourceViewStyle.BarItemsStyle;
			this.FlashColor               = sourceViewStyle.FlashColor; 	
		
			m_ReadOnly = readOnly;
		}
コード例 #4
0
ファイル: ViewStyle.cs プロジェクト: aureliopires/gisa
		/// <summary>
		/// Copies instance viewStyle to destination vieStyle.
		/// If destViewStyle is ReadOnly, values isn't copied !
		/// </summary>
		/// <param name="destView">ViewStyle where to copy.</param>
		public void CopyTo(ViewStyle destViewStyle)
		{
			destViewStyle.BorderColor              = this.BorderColor;
			destViewStyle.BorderHotColor           = this.BorderHotColor;
			destViewStyle.ButtonColor              = this.ButtonColor;
			destViewStyle.ButtonHotColor           = this.ButtonHotColor;
			destViewStyle.ButtonPressedColor       = this.ButtonPressedColor;
			destViewStyle.ControlBackColor         = this.ControlBackColor;
		//	destViewStyle.ControlForeColor         = this.ControlForeColor;
			destViewStyle.EditColor                = this.EditColor;
			destViewStyle.EditFocusedColor         = this.EditFocusedColor;
			destViewStyle.EditReadOnlyColor        = this.EditReadOnlyColor;
		    destViewStyle.EditDisabledColor        = this.EditDisabledColor;
			destViewStyle.BarColor                 = this.BarColor;   
			destViewStyle.BarHotColor              = this.BarHotColor;   
			destViewStyle.BarTextColor             = this.BarTextColor;  
			destViewStyle.BarHotTextColor          = this.BarHotTextColor;  
         	destViewStyle.BarPressedColor          = this.BarPressedColor;     
			destViewStyle.BarBorderColor           = this.BarBorderColor;     
			destViewStyle.BarHotBorderColor        = this.BarHotBorderColor;    
			destViewStyle.BarClientAreaColor1      = this.BarClientAreaColor1; 
			destViewStyle.BarClientAreaColor2      = this.BarClientAreaColor2; 
			destViewStyle.BarItemSelectedColor     = this.BarItemSelectedColor;
			destViewStyle.BarItemSelectedTextColor = this.BarItemSelectedTextColor;
			destViewStyle.BarItemHotColor          = this.BarItemHotColor;     
			destViewStyle.BarItemPressedColor      = this.BarItemPressedColor;  
			destViewStyle.BarItemBorderHotColor    = this.BarItemBorderHotColor;
			destViewStyle.BarItemTextColor         = this.BarItemTextColor; 
			destViewStyle.BarItemHotTextColor      = this.BarItemHotTextColor;
			destViewStyle.BarItemsStyle            = this.BarItemsStyle;
			destViewStyle.FlashColor               = this.FlashColor;
		}
コード例 #5
0
        public override object Serialize(IDesignerSerializationManager manager, object value)
        {
            ViewStyle viewStyle = (ViewStyle)value;

            CodeDomSerializer baseClassSerializer = (CodeDomSerializer)manager.GetSerializer(value.GetType().BaseType, typeof(CodeDomSerializer));
            object            codeObject          = baseClassSerializer.Serialize(manager, value);

            if (codeObject is CodeStatementCollection)
            {
                CodeStatementCollection statements = (CodeStatementCollection)codeObject;

                ArrayList dontSerializeList = new ArrayList();

                //--- loop through all statements
                foreach (CodeStatement st in statements)
                {
                    if (st is CodeAssignStatement)
                    {
                        CodeAssignStatement cAssign = (CodeAssignStatement)st;

                        // If left is eg. 'this.ViewStyle.BorderColor'
                        if (cAssign.Left is CodePropertyReferenceExpression)
                        {
                            string propertyName  = ((CodePropertyReferenceExpression)cAssign.Left).PropertyName;
                            object propertyValue = null;

                            // If right is eg. 'System.Drawing.Color.FromArgb(183,193,214)'
                            if (cAssign.Right is CodeMethodInvokeExpression)
                            {
                                CodeMethodInvokeExpression mInvokeExp = (CodeMethodInvokeExpression)cAssign.Right;

                                if (mInvokeExp.Method.MethodName == "FromArgb")
                                {
                                    CodeCastExpression cCastExpR = (CodeCastExpression)mInvokeExp.Parameters[0];
                                    CodeCastExpression cCastExpG = (CodeCastExpression)mInvokeExp.Parameters[1];
                                    CodeCastExpression cCastExpB = (CodeCastExpression)mInvokeExp.Parameters[2];

                                    int r = Convert.ToInt32(((CodePrimitiveExpression)cCastExpR.Expression).Value);
                                    int g = Convert.ToInt32(((CodePrimitiveExpression)cCastExpG.Expression).Value);
                                    int b = Convert.ToInt32(((CodePrimitiveExpression)cCastExpB.Expression).Value);

                                    propertyValue = Color.FromArgb(r, g, b);
                                }
                            }

                            // If right is eg. 'System.Drawing.Color.Lime'
                            if (cAssign.Right is CodePropertyReferenceExpression)
                            {
                                CodePropertyReferenceExpression propRefExp = (CodePropertyReferenceExpression)cAssign.Right;
                                CodeTypeReferenceExpression     tRefExp    = (CodeTypeReferenceExpression)propRefExp.TargetObject;

                                if (tRefExp.Type.BaseType == "System.Drawing.Color" || tRefExp.Type.BaseType == "System.Drawing.SystemColors")
                                {
                                    propertyValue = Color.FromName(propRefExp.PropertyName);
                                }
                            }

                            if (cAssign.Right is CodeFieldReferenceExpression)
                            {
                                CodeFieldReferenceExpression fRefExp = (CodeFieldReferenceExpression)cAssign.Right;

                                if (fRefExp.FieldName == "FullSelect")
                                {
                                    propertyValue = LumiSoft.UI.Controls.WOutlookBar.ItemsStyle.FullSelect;
                                }
                                if (fRefExp.FieldName == "IconSelect")
                                {
                                    propertyValue = LumiSoft.UI.Controls.WOutlookBar.ItemsStyle.IconSelect;
                                }
                                if (fRefExp.FieldName == "UseDefault")
                                {
                                    propertyValue = LumiSoft.UI.Controls.WOutlookBar.ItemsStyle.UseDefault;
                                }
                            }

                            //--- Check if we need to serialize property.
                            if (!viewStyle.MustSerialize(propertyName, propertyValue))
                            {
                                // Add to remove list
                                dontSerializeList.Add(st);
                            }
                        }
                    }
                }

                // Remove not neede properties
                foreach (CodeStatement obj in dontSerializeList)
                {
                    statements.Remove(obj);
                }
            }

            return(codeObject);
        }