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


C# Square.setBackGround方法代码示例

本文整理汇总了C#中Square.setBackGround方法的典型用法代码示例。如果您正苦于以下问题:C# Square.setBackGround方法的具体用法?C# Square.setBackGround怎么用?C# Square.setBackGround使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Square的用法示例。


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

示例1: createSquareList

        public static SquareList createSquareList(SquareList simpleList)
        {
            SquareList newList = new SquareList();
            for (int i = simpleList.Count() - 1; i >= 0; i--)
            {
                Square cat = simpleList.Get(i);

                Square square = new Square(SurfaceWindow1.treeArea * cat.Ratio, cat.Name);
                square.setBackGround(cat.BackGroundColor);
                if (cat.TextColor == null)
                    square.setTextColor(Colors.Black);
                else
                    square.setTextColor(cat.TextColor);
                square.Ratio = cat.Ratio;
                if (cat.SubFile != null && !cat.SubFile.Equals(""))
                {
                    square.SubFile = cat.SubFile;
                }
                if (cat.Explanation != null && !cat.Explanation.Equals(""))
                {
                    square.Explanation = cat.Explanation;
                }

                if (cat.VideoString != null && !cat.VideoString.Equals(""))
                {
                    square.VideoString = cat.VideoString;
                }
                if(cat.ImageString !=null && !cat.ImageString.Equals("")){
                    square.ImageString = cat.ImageString;
                }
                newList.Add(square);
            }
            return newList;
        }
开发者ID:RiedigerD2,项目名称:OpenHouse,代码行数:34,代码来源:SquareList.cs

示例2: TouchUpMenu

        /// <summary>
        /// Event Handler finds and executes the correct response to menu Surfacebutton that 
        /// raised an event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void TouchUpMenu(object sender, TouchEventArgs e)
        {
            if (sender is SurfaceButton && e.TouchDevice.GetIsFingerRecognized())
            {
                SurfaceButton button = (SurfaceButton)sender;
                Menu.Menu menu = FindTheMenu(button);

                if (menu == null)
                {
                    return;
                }
                Log.Interaction(this, e.TouchDevice, menu.Get((SurfaceButton)sender), menu);
                menu.interactive = true;
                string file = menu.FileToOpen(button);
                if (menu is TreeMenu)
                {
                    TreeMenu map = (TreeMenu)menu;
                    if (file != null && !file.Equals(""))
                    {
                        TreeMenu childAdded = map.addChild(Catagory.ReadFile( file), map.Get(button));
                        childAdded.AddUpListenerToButtons(TouchUpMenu);
                    }
                    else
                    {
                        if (map.HasExplanation(button))
                        {
                            /*
                             * Creates a new TreeMenu from the information stored in the Square
                             * selected
                             */
                            SquareList list = new SquareList();
                            Square sqr = new Square(1, map.Get(button).Explanation);
                            if (map.Get(button).VideoString != null)
                            {
                                sqr.VideoString = map.Get(button).VideoString;
                            }
                            if (map.Get(button).ImageString != null)
                            {
                                sqr.ImageString = map.Get(button).ImageString;
                            }

                            sqr.setBackGround(map.Get(button).BackGroundColor);
                            sqr.setTextColor((map.Get(button).TextColor));
                            sqr.singleImage = map.Get(button).singleImage;
                            sqr.Slides = map.Get(button).Slides;
                            sqr.Ratio = 1;
                            list.Add(sqr);
                            map.addChild(list, map.Get(button));
                        }

                    }
                    map.ReDraw();
                }
                else//non tree menu
                {
                    if (((IndividualMenu)menu).IsAnimating())
                    {
                        ((IndividualMenu)menu).StopAnimation();
                    }
                    else
                    {
                        if (MenuList.Count < MaxMenus)
                        {
                            TouchDevice c = (TouchDevice)e.TouchDevice;
                            PlaceTreeMap(menu.FileToOpen(button), menu.Get(button), c.GetOrientation(this), c.GetPosition(this));

                        }
                    }
                }
            }
        }
开发者ID:RiedigerD2,项目名称:OpenHouse,代码行数:77,代码来源:SurfaceWindow1.xaml.cs

示例3: createSquareList

        /// <summary>
        /// creates a SqruarList based on simpleList
        /// </summary>
        /// <param name="simpleList">list of catagories typically popullated by a xml reader</param>
        /// <returns></returns>
        public static SquareList createSquareList(List<Catagory> simpleList)
        {
            SquareList newList=new SquareList();
            for(int i=simpleList.Count()-1;i>=0;i--)
            {
                Catagory cat = simpleList[i];
                 Square square = new Square(SurfaceWindow1.treeArea * cat.Ratio, cat.Title);

                // stated in the xsd that all catagories must have at least name ratio and backGroundColor
                square.setBackGround(cat.BackGroundColor);
                square.Ratio = cat.Ratio;

                //set file to open if this square is followed
                if (cat.SubCatagoryFile!=null && !cat.SubCatagoryFile.Equals(""))
                {
                    square.SubFile = @"Resources/Information/" + cat.SubCatagoryFile;
                }

                //provide text explanation if no file is provided to follow
                if (cat.Explanation != null && !cat.Explanation.Equals(""))
                {
                    square.Explanation = cat.Explanation;
                }

                //if the text color is not set
                //set the text color to the inverse of the background color
                //so the text is at least visible
                if (cat.TextColor==null || cat.TextColor.A == 0)
                {
                    Color textColor = new Color();
                    textColor.ScA = 1;
                    textColor.ScR = 1 - cat.BackGroundColor.ScR;
                    textColor.ScG = 1 - cat.BackGroundColor.ScG;
                    textColor.ScB = 1 - cat.BackGroundColor.ScB;
                    square.setTextColor(textColor);
                }
                else
                {
                    square.setTextColor(cat.TextColor);
                }

                //Images for explanation
                if (cat.Image!=null && !cat.Image.Equals(""))
                {
                    square.ImageString = @"Resources/Images/" + cat.Image;
                }
                if (cat.Slides != null && cat.Slides.Count>0)
                {
                    square.Slides = cat.Slides;
                }
                if (cat.ImageSetup != null)
                {
                    square.singleImage = cat.ImageSetup;
                    square.singleImage.Path = @"Resources/Images/" + square.singleImage.Path;
                }
                //video for explanation
                if (cat.Video!=null && !cat.Video.Equals(""))
                {
                    square.VideoString = @"Resources/Videos/" + cat.Video;
                }
                //background image to use instead of backgroundcolor
                if (cat.BackGroundImage!=null && !cat.BackGroundImage.Equals(""))
                {
                    square.setBackGround(cat.BackGroundImage);
                }
                newList.Add(square);
            }

            return newList;
        }
开发者ID:RiedigerD2,项目名称:OpenHouse,代码行数:75,代码来源:Catagory.cs


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