当前位置: 首页>>代码示例>>C#>>正文


C# UIFont类代码示例

本文整理汇总了C#中UIFont的典型用法代码示例。如果您正苦于以下问题:C# UIFont类的具体用法?C# UIFont怎么用?C# UIFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UIFont类属于命名空间,在下文中一共展示了UIFont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadMoreElement

		public LoadMoreElement (string normalCaption, string loadingCaption, Action<LoadMoreElement> tapped, UIFont font, UIColor textColor) : base ("")
		{
			this.NormalCaption = normalCaption;
			this.LoadingCaption = loadingCaption;
			this.tapped = tapped;
			this.font = font;
			
			cell = new UITableViewCell (UITableViewCellStyle.Default, "loadMoreElement");
			
			activityIndicator = new UIActivityIndicatorView () {
				ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray,
				Hidden = true
			};
			activityIndicator.StopAnimating ();
			
			caption = new UILabel () {
				Font = font,
				Text = this.NormalCaption,
				TextColor = textColor,
				BackgroundColor = UIColor.Clear,
				TextAlignment = UITextAlignment.Center,
				AdjustsFontSizeToFitWidth = false,
			};
			
			Layout ();
			
			cell.ContentView.AddSubview (caption);
			cell.ContentView.AddSubview (activityIndicator);
		}
开发者ID:jogibear9988,项目名称:MonoTouch.Dialog,代码行数:29,代码来源:LoadMoreElement.cs

示例2: InitFonts

 private void InitFonts()
 {
     _font1 = UIFont.FromName ("HelveticaNeue", 18f);
     _font2 = UIFont.FromName ("HelveticaNeue-Medium", 18f);
     _font3 = UIFont.FromName ("HelveticaNeue-Bold", 18f);
     _roubleFont = UIFont.FromName("Ruble", 18f);
 }
开发者ID:TouchInstinct,项目名称:Training,代码行数:7,代码来源:MainController.cs

示例3: AddText

        public static UIImage AddText(this UIImage image, string text, PointF point, UIFont font, UIColor color, UITextAlignment alignment = UITextAlignment.Left)
        {
            //var labelRect = new RectangleF(point, new SizeF(image.Size.Width - point.X, image.Size.Height - point.Y));
            var h = text.StringHeight(font, image.Size.Width);
            var labelRect = new RectangleF(point, new SizeF(image.Size.Width - point.X, h));

            var label = new UILabel(labelRect)
            { 
                Font = font, 
                Text = text,
                TextColor = color,
                TextAlignment = alignment,
                BackgroundColor = UIColor.Clear
            };

            var labelImage = label.ToNativeImage();
            

            using (var context = image.Size.ToBitmapContext())
            {
                var rect = new RectangleF(new PointF(0, 0), image.Size);
                context.DrawImage(rect, image.CGImage);
                context.DrawImage(labelRect, labelImage.CGImage);
                context.StrokePath();
                return UIImage.FromImage(context.ToImage());
            }
        }
开发者ID:rid00z,项目名称:Xamarin-Forms-Labs,代码行数:27,代码来源:UIImageExtensions.cs

示例4: CreateFont

    static void CreateFont(UIFont font, int create, Material mat)
    {
        if (create == 1)
        {
            // New dynamic font
            font.atlas = null;
            font.dynamicFont = NGUISettings.dynamicFont;
            font.dynamicFontSize = NGUISettings.dynamicFontSize;
            font.dynamicFontStyle = NGUISettings.dynamicFontStyle;
        }
        else
        {
            // New bitmap font
            font.dynamicFont = null;
            BMFontReader.Load(font.bmFont, NGUITools.GetHierarchy(font.gameObject), NGUISettings.fontData.bytes);

            if (create == 2)
            {
                font.atlas = null;
                font.material = mat;
            }
            else if (create == 3)
            {
                font.spriteName = NGUISettings.fontTexture.name;
                font.atlas = NGUISettings.atlas;
            }
        }
    }
开发者ID:Attila22,项目名称:LittleBard,代码行数:28,代码来源:UIFontMaker.cs

示例5: ContentSize

        public static float ContentSize(string text, float width, UIFont font)
        {
            var stringToSize = new NSString (text);
            var size = stringToSize.StringSize (font, new SizeF (width, float.MaxValue), UILineBreakMode.WordWrap);

            return size.Height;
        }
开发者ID:pierceboggan,项目名称:Verses,代码行数:7,代码来源:InterfaceHelper.cs

示例6: Load

	static void Load ()
	{
		mLoaded			= true;
		mPartial		= EditorPrefs.GetString("NGUI Partial");
		mFontName		= EditorPrefs.GetString("NGUI Font Name");
		mAtlasName		= EditorPrefs.GetString("NGUI Atlas Name");
		mFontData		= GetObject("NGUI Font Asset") as TextAsset;
		mFontTexture	= GetObject("NGUI Font Texture") as Texture2D;
		mFont			= GetObject("NGUI Font") as UIFont;
		mAtlas			= GetObject("NGUI Atlas") as UIAtlas;
		mAtlasPadding	= EditorPrefs.GetInt("NGUI Atlas Padding", 1);
		mAtlasTrimming	= EditorPrefs.GetBool("NGUI Atlas Trimming", true);
		mAtlasPMA		= EditorPrefs.GetBool("NGUI Atlas PMA", true);
		mUnityPacking	= EditorPrefs.GetBool("NGUI Unity Packing", true);
		mForceSquare	= EditorPrefs.GetBool("NGUI Force Square Atlas", true);
		mPivot			= (UIWidget.Pivot)EditorPrefs.GetInt("NGUI Pivot", (int)mPivot);
		mLayer			= EditorPrefs.GetInt("NGUI Layer", -1);
		mDynFont		= GetObject("NGUI DynFont") as Font;
		mDynFontSize	= EditorPrefs.GetInt("NGUI DynFontSize", 16);
		mDynFontStyle	= (FontStyle)EditorPrefs.GetInt("NGUI DynFontStyle", (int)FontStyle.Normal);

		if (mLayer < 0 || string.IsNullOrEmpty(LayerMask.LayerToName(mLayer))) mLayer = -1;

		if (mLayer == -1) mLayer = LayerMask.NameToLayer("UI");
		if (mLayer == -1) mLayer = LayerMask.NameToLayer("GUI");
		if (mLayer == -1) mLayer = 5;

		EditorPrefs.SetInt("UI Layer", mLayer);

		LoadColor();
	}
开发者ID:elainerezende,项目名称:Hearthstone,代码行数:31,代码来源:NGUISettings.cs

示例7: Font

        UIFont font = null; //UIFont.SystemFontOfSize(20);

        #endregion Fields

        #region Constructors

        public Font(string fontname,int fontsize)
        {
            font =UIFont.FromName(fontname,fontsize);
            if(font==null)font=UIFont.SystemFontOfSize(fontsize);
            maxcharheight =(int)font.LineHeight;
            //if (gbmp == null)
            {
            //				gdata = new byte[128 * 128 * 4];
            //				var colorSpace = CGColorSpace.CreateDeviceRGB();
            //				gbmp = new CGBitmapContext(gdata, 128, 128,
            //				                                        8, 128 * 4, colorSpace, CGBitmapFlags.PremultipliedLast);
                //gbmp =new Bitmap(128,128);
                //gfont = Graphics.FromImage(gbmp);
                //gfont.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
                //gfont.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            }

            //GdiFont = new System.Drawing.Font(fontname, fontsize,GraphicsUnit.Pixel);
            //maxcharheight = GdiFont.Height;

            //设置文本输出质量
            //g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            //g.SmoothingMode = SmoothingMode.AntiAlias;
            //Font newFont = new Font("Times New Roman", 48);
        }
开发者ID:Gaopest,项目名称:fightclub,代码行数:31,代码来源:Font-IOS.cs

示例8: Initialize

        /// <summary>
        /// Initializes the panel's controls.
        /// </summary>
        /// <param name="titleFont">The font to use for the settings panel title.</param>
        /// <param name="labelTemplate">The template to use for all settings labels.</param>
        public void Initialize(UIFont titleFont, UILabel labelTemplate) {
            this.backgroundSprite = "MenuPanel";
            this.isVisible = false;
            this.canFocus = true;
            this.isInteractive = true;
            this.height = TitleBarHeight + 8f;
            this.width = PanelWidth;

            this.CreatePanelTitle(titleFont);
            this.CreateDragHandle();
            this.CreateCloseButton();
            this.CreateControlPanel();

            int zOrder = 1;
            
            this.defaultVisibilityCheckBox = this.CreateSettingsControl(
                CityVitalsWatch.Settings.DefaultPanelVisibility, "Default Visibility", true, labelTemplate, ref zOrder);
            this.transparentUnhoveredCheckBox = this.CreateSettingsControl(
                CityVitalsWatch.Settings.TransparentUnhovered, "Transparent Unhovered", true, labelTemplate, ref zOrder);

            this.statControlMap = new Dictionary<CityVitalsWatchStat, UICheckBox>();

            foreach (CityVitalsWatchStat stat in Enum.GetValues(typeof(CityVitalsWatchStat)).Cast<CityVitalsWatchStat>()) {
                this.statControlMap[stat] = this.CreateSettingsControl(
                    CityVitalsWatch.Settings.StatDisplayed(stat), StatLocaleIdMap[stat], false, labelTemplate, ref zOrder);
            }
        }
开发者ID:jfisher446,项目名称:CityVitalsWatchMod,代码行数:32,代码来源:CityVitalsWatchSettingsPanel.cs

示例9: RegisterFont

 public static void RegisterFont(UIFont font)
 {
     if (font.UseDynamicFont && !_fontList.Contains(font.dynamicFont))
     {
         _fontList.Add(font.dynamicFont);
         font.dynamicFont.textureRebuildCallback += OnFontRebuilt;
     }
 }
开发者ID:laijingfeng,项目名称:explorer_client,代码行数:8,代码来源:UIFont.cs

示例10: LoadMoreElement

		public LoadMoreElement (string normalCaption, string loadingCaption, Action<LoadMoreElement> tapped, UIFont font, UIColor textColor) : base ("")
		{
			NormalCaption = normalCaption;
			LoadingCaption = loadingCaption;
			Tapped += tapped;
			Font = font;
			TextColor = textColor;
		}
开发者ID:SimonSimCity,项目名称:MvvmCross,代码行数:8,代码来源:LoadMoreElement.cs

示例11: OnSelectFont

    void OnSelectFont(Object obj) {
        // Undo doesn't work correctly in this case... so I won't bother.
        //NGUIEditorTools.RegisterUndo("Font Change");
        //NGUIEditorTools.RegisterUndo("Font Change", mFont);

        mFont.replacement = obj as UIFont;
        mReplacement = mFont.replacement;
        NGUITools.SetDirty(mFont);
    }
开发者ID:Niller,项目名称:LastStand,代码行数:9,代码来源:UIFontInspector.cs

示例12: CustomCell

 static CustomCell()
 {
     if (font == null)
         font = UIFont.BoldSystemFontOfSize(UIFont.SystemFontSize);
     if (background == null)
         background = UIImage.FromFile(@"Images/cell-background.png");
     if (textColor == null)
         textColor = UIColor.FromRGBA(255, 255, 255, 32);
 }
开发者ID:runegri,项目名称:MuPP,代码行数:9,代码来源:CustomCell.cs

示例13: LoadMoreElement

		public LoadMoreElement (string normalCaption, string loadingCaption, Action<LoadMoreElement> tapped, UIFont font, UIColor textColor) 
            : base (UITableViewCellStyle.Default, key.ToString())
		{
			NormalCaption = normalCaption;
			LoadingCaption = loadingCaption;
			Tapped += tapped;
			Font = font;
			TextColor = textColor;
		}
开发者ID:rcaratchuk,项目名称:MonoTouch.Dialog,代码行数:9,代码来源:LoadMoreElement.cs

示例14: GetLineHeight

        protected virtual float GetLineHeight(UIFont font)
        {
            if (Math.Abs(font.PointSize - AppDelegate.Font16pt) < 0.5)
            {
                return 26;
            }

            return 15;
        }
开发者ID:DnyaneshwarWadghanePM,项目名称:notes-for-nurses-redux,代码行数:9,代码来源:ViewBase.cs

示例15: OnFontRebuilt

 public static void OnFontRebuilt(UIFont font)
 {
     UILabel[] list = GameObject.FindObjectsOfType(typeof(UILabel)) as UILabel[];
     foreach (UILabel label in list)
     {
         if (label.font == font)
             label.MarkAsChanged();
     }
 }
开发者ID:laijingfeng,项目名称:explorer_client,代码行数:9,代码来源:UIFont.cs


注:本文中的UIFont类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。