當前位置: 首頁>>代碼示例>>C#>>正文


C# Size.ScaleSize方法代碼示例

本文整理匯總了C#中System.Drawing.Size.ScaleSize方法的典型用法代碼示例。如果您正苦於以下問題:C# Size.ScaleSize方法的具體用法?C# Size.ScaleSize怎麽用?C# Size.ScaleSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.Size的用法示例。


在下文中一共展示了Size.ScaleSize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Drawing_OnEndScene

        private void Drawing_OnEndScene(EventArgs args)
        {
            if (!IsActive() || !_drawActive)
                return;
            try
            {
                float percentScale =
                    (float) Menu.UimTracker.GetMenuItem("SAwarenessUIMTrackerScale").GetValue<Slider>().Value/100;

                if (_s.IsDisposed)
                {
                    return;
                }
                _s.Begin();
                foreach (var enemy in _enemies)
                {
                    if (enemy.Key.IsVisible)
                        continue;
                    Vector2 serverPos = Drawing.WorldToMinimap(enemy.Key.ServerPosition);
                    var mPos = new Size((int) (serverPos[0] - 32*0.3f), (int) (serverPos[1] - 32*0.3f));
                    DirectXDrawer.DrawSprite(_s, enemy.Value,
                        mPos.ScaleSize(percentScale, new Vector2(mPos.Width, mPos.Height)),
                        new[] {0.7f*percentScale, 0.7f*percentScale});
                }
                _s.End();
                foreach (var enemy in _enemies)
                {
                    if (Menu.RecallDetector.GetActive())
                    {
                        RecallDetector.RecallInfo info = GetRecall(enemy.Key.NetworkId);
                        if (info != null && info.StartTime != 0)
                        {
                            float time = Game.Time + info.Recall.Duration/1000 - info.StartTime;
                            Vector2 vec = Drawing.WorldToMinimap(enemy.Key.ServerPosition);
                            var pos = new Size((int) vec.X, (int) vec.Y);
                            if (time > 0.0f &&
                                (info.Recall.Status == Packet.S2C.Recall.RecallStatus.TeleportStart ||
                                 info.Recall.Status == Packet.S2C.Recall.RecallStatus.RecallStarted))
                            {
                                DirectXDrawer.DrawText(_recF, enemy.Key.ChampionName, pos, SharpDX.Color.Chartreuse);
                            }
                        }
                    }
                }
                if (Menu.UimTracker.GetMenuItem("SAwarenessUIMTrackerShowSS").GetValue<bool>())
                {
                    foreach (var enemy in SsCaller.Enemies)
                    {
                        if (Menu.SsCaller.GetActive())
                        {
                            if (!enemy.Key.IsVisible && enemy.Value.InvisibleTime > 0)
                            {
                                Vector2 vec = Drawing.WorldToMinimap(enemy.Key.ServerPosition);
                                var pos = new Size((int)vec.X, (int)vec.Y);
                                DirectXDrawer.DrawText(_recF, enemy.Value.InvisibleTime.ToString(), pos, SharpDX.Color.Chartreuse);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                if (ex.GetType() == typeof (SharpDXException))
                {
                    Menu.UimTracker.SetActive(false);
                    Game.PrintChat("UIM: An error occured. Please activate UI Minimap in your menu again.");
                }
            }
        }
開發者ID:zjian1013,項目名稱:SAwareness,代碼行數:70,代碼來源:Trackers.cs

示例2: Drawing_OnEndScene

        void Drawing_OnEndScene(EventArgs args)
        {
            if (!IsActive() || !drawActive)
                return;
            try
            {
                float percentScale = (float)Menu.UimTracker.GetMenuItem("SAwarenessUIMTrackerScale").GetValue<Slider>().Value / 100;

                if (S.IsDisposed)
                {
                    return;
                }
                S.Begin();
                foreach (var enemy in Enemies)
                {
                    if(enemy.Key.IsVisible)
                        continue;
                    Vector2 serverPos = Drawing.WorldToMinimap(enemy.Key.ServerPosition);
                    Size mPos = new Size((int) (serverPos[0] - 32 * 0.3f), (int) (serverPos[1] - 32 * 0.3f));
                    DirectXDrawer.DrawSprite(S, enemy.Value,
                        mPos.ScaleSize(percentScale, new Vector2(mPos.Width, mPos.Height)),
                        new[] {0.3f*percentScale, 0.3f*percentScale});
                }
                S.End();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                if (ex.GetType() == typeof(SharpDXException))
                {
                    Menu.UimTracker.SetActive(false);
                    Game.PrintChat("UIM: An error occured. Please activate UI Minimap in your menu again.");
                }
            }
        }
開發者ID:hhhmmm2,項目名稱:SAwareness,代碼行數:35,代碼來源:Trackers.cs


注:本文中的System.Drawing.Size.ScaleSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。