|
From: Martin C. <mar...@ei...> - 2005-12-13 17:04:36
|
Hi Mark,
This would certainly be a useful addition. Does this approach allow you
to have a different font for Connections versus Shapes. Also it can be
useful to allow different shapes to use a different font. Your approach
certainly looks like a very good starting point.
Just my 2 cent.
Regards,
Martin
Mark Johnson wrote:
> * *
>
> * In the past, there were discutions about a Global Font support.*
>
> * *
>
> * Last March, when I was doing a Praticum where I hoped to get a
> permanent Job,*
>
> * I showed this Library ro the owner and the first question was 'can it
> Zoom, change the Colours and Font'?*
>
> * *
>
> * Building in the proper Zooming and Colouring was not a problem, but
> the Font was.*
>
> * *
>
> * Last month François and I again has a talk about this and came to no
> conclusion.*
>
> * *
>
> * Yesterday, however (still having no Job), while preparing my Shape
> Demo to work within the MDI-Application,*
>
> * I realized that the logic I used there would also solve the Problem
> here.*
>
> * *
>
> * The the main pain there was the commenly used Objects/Methods had to
> be passed to each Frame*
>
> * apon creation.*
>
> * *
>
> * I then tried creating a Class in the Dll that stored Static Fields
> which were filled upon*
>
> * Application start (Main-Form, MainMenu, StatusBar, Colours, Font,
> Project Paths etc) and*
>
> * simply read out by the Forms that used the same Dll.*
>
> * *
>
> * Calling an Application twice from the same /Bin using also the same
> Dll (also in the same /Bin)*
>
> * created an Unique Version of the Static Class for each Application -
> which meant that the*
>
> * first copy could change a static Field (in this case the Font) but
> this would not effect*
>
> * the Value in the second Application (i.e. the Second Application
> would not use the Font*
>
> * set by the first Application).*
>
> * *
>
> * The problem here is that when a Shape is created it uses the default
> Font set in Entity.cs.*
>
> * This could not be changed in a way that after a certin Point another
> Font should be used.*
>
> * *
>
> * Since Entity.Font was 'protected', it could also not be changed
> afterwards.*
>
> * *
>
> * My suggestion is the following :*
>
> * *
>
> * - one small Class in 'Netron.GraphLib' with static Fields*
>
> * - Font*
>
> * - and maybe others like CutureInfo for language support.*
>
> * *
>
> * - When the Application calls the Dll for the first the Default value
> will be set*
>
> * - for CutureInfo this would be that of the Machine called on.*
>
> * The Application could then change the default Values :*
>
> * - 'NetronBase.Font = WinForm.Font; '*
>
> * *
>
> * With Entity.InitEntity() changed to : *
>
> * *
>
> * // mFont = new
> Font(mFontFamily,mFontSize,FontStyle.Regular,GraphicsUnit.Point);*
>
> * Font = NetronBase.Font;*
>
> * *
>
> * all Shapes / Connection etc. would use the desired Font.*
>
> * *
>
> * If Entity.Font was changed from 'protected' to 'internal'*
>
> * *
>
> * internal Font Font*
>
> * {*
>
> * get{return this.mFont;}*
>
> * set*
>
> * {*
>
> * this.mFont = value;*
>
> * this.mFontFamily = value.FontFamily.ToString();*
>
> * this.mFontSize = value.Size; *
>
> * RecalculateSize = true;*
>
> * this.Invalidate();*
>
> * }*
>
> * }*
>
> * - note added 'RecalculateSize = true;' !*
>
> * *
>
> * a Propery in the GraphControl for 'Font' could be written*
>
> * that could change the Font used at any time (i.e. Object allready
> created) :*
>
> * *
>
> * [Category("Graph"), Browsable(true), Description("Gets or sets the
> Font for the GraphControl and all Shapes and Connectors.")]*
>
> * public override Font Font*
>
> * {*
>
> * get*
>
> * {*
>
> * return base.Font;*
>
> * }*
>
> * set*
>
> * {*
>
> * if (value != null)*
>
> * {*
>
> * base.Font = value;*
>
> * NetronBase.Font = base.Font;*
>
> * foreach(Shape so in mAbstract.Shapes)*
>
> * {*
>
> * so.Font = base.Font;*
>
> * foreach(Connector co in so.Connectors)*
>
> * {*
>
> * co.Font = base.Font;*
>
> * foreach (Connection con in co.Connections)*
>
> * **{*
>
> * con.Font = base.Font;*
>
> * } // foreach (Connection con in co.Connections)*
>
> * } // foreach(Connector co in so.Connectors)*
>
> * } // foreach(Shape so in mAbstract.Shapes)*
>
> * // Will force all Controls to Paint with new Font*
>
> * Invalidate();*
>
> * } // if (value != null)*
>
> * } // Set*
>
> * } // public override Font Font*
>
> * *
>
> * With these changes, every thing works well with me after insuring that
> NetronGraphControl*
>
> * uses the Parent.Font when recalulating it size.*
>
> * *
>
> * All Shapes would have to be Font aware, but most are.*
>
> * And if not, they should be changed.*
>
> * *
>
> * If there are no objections to this I would like to commit the needed
> changes to CVS.*
>
> * *
>
> * **Mark Johnson, Berlin Germany *
>
> * mj...@mj... <mailto:mj...@mj...>*
>
> * *
>
> *PS : I wish Windows would do the same, I allways hate changing to the
> Fornt that I use 99,9999 % of the time … *
>
> * *
>
> * *
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.371 / Virus Database: 267.13.13/198 - Release Date: 12/12/2005
>
|