コード例 #1
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.checkPaddingSize    = 1;
            layout.everettButtonCompat = !Application.RenderWithVisualStyles;

            // VSWhidbey 420870
            if (Application.RenderWithVisualStyles)
            {
                using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics(Control)) {
                    layout.checkSize = CheckBoxRenderer.GetGlyphSize(g, CheckBoxRenderer.ConvertFromButtonState(GetState(), true, Control.MouseIsOver), Control.HandleInternal).Width;
                }
            }
            // Dev10 bug 525537
            else
            {
                if (DpiHelper.EnableDpiChangedMessageHandling)
                {
                    layout.checkSize = Control.LogicalToDeviceUnits(layout.checkSize);
                }
                else
                {
                    layout.checkSize = (int)(layout.checkSize * GetDpiScaleRatio(e.Graphics));
                }
            }

            return(layout);
        }
コード例 #2
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.checkPaddingSize    = 1;
            layout.everettButtonCompat = !Application.RenderWithVisualStyles;

            if (Application.RenderWithVisualStyles)
            {
                layout.checkSize = CheckBoxRenderer.GetGlyphSize(
                    WindowsFormsUtils.GetMeasurementDeviceContext(),
                    CheckBoxRenderer.ConvertFromButtonState(
                        GetState(),
                        true,
                        Control.MouseIsOver),
                    Control.HandleInternal).Width;
            }
            else
            {
                if (DpiHelper.IsPerMonitorV2Awareness)
                {
                    layout.checkSize = Control.LogicalToDeviceUnits(layout.checkSize);
                }
                else
                {
                    layout.checkSize = (int)(layout.checkSize * GetDpiScaleRatio());
                }
            }

            return(layout);
        }
コード例 #3
0
ファイル: Performance.cs プロジェクト: xiechun/SquareOne
 public Performance() : base()
 {
     base.TabText = "Performance";
     this.InitializeComponent();
     this.fontsByStyle = new Dictionary <FontStyle, Font>();
     WindowsFormsUtils.SetDoubleBuffered(this.olvReport);
     this.objectListViewCustomize();
 }
コード例 #4
0
        public ExceptionsControl() : base()
        {
            this.Exceptions     = new List <Exception>();
            this.ExceptionTimes = new Dictionary <Exception, DateTime>();

            this.InitializeComponent();
            //WindowsFormsUtils.SetDoubleBuffered(this.tree);	//doesn't help, still flickers
            WindowsFormsUtils.SetDoubleBuffered(this.lvStackTrace);
            WindowsFormsUtils.SetDoubleBuffered(this);

            this.exceptionsTreeListViewCustomize();
            this.treeExceptions.SetObjects(this.Exceptions);
        }
コード例 #5
0
        public ExecutionTreeControl()
        {
            this.InitializeComponent();
            this.buildMniShortcutsAfterInitializeComponent();

            this.orderTreeListViewCustomize();
            this.messagesListViewCustomize();

            //this.fontNormal = this.Font;
            //this.fontBold = new Font(this.fontNormal, FontStyle.Bold);
            WindowsFormsUtils.SetDoubleBuffered(this.OrdersTree);
            WindowsFormsUtils.SetDoubleBuffered(this.lvMessages);
            WindowsFormsUtils.SetDoubleBuffered(this);
        }
コード例 #6
0
        internal override Size GetPreferredSizeCore(Size proposedSize)
        {
            if (Appearance == Appearance.Button)
            {
                return(ButtonAdapter.GetPreferredSizeCore(proposedSize));
            }

            using (Graphics measurementGraphics = WindowsFormsUtils.CreateMeasurementGraphics()) {
                using (PaintEventArgs pe = new PaintEventArgs(measurementGraphics, new Rectangle())) {
                    LayoutOptions options = Layout(pe);
                    return(options.GetPreferredSizeCore(proposedSize));
                }
            }
        }
コード例 #7
0
        public virtual int IndexOfKey(string key)
        {
            if (!string.IsNullOrEmpty(key))
            {
                for (int i = 0; i < this.Count; i++)
                {
                    if (WindowsFormsUtils.SafeCompareStrings(this[i].Name, key, true))
                    {
                        return(i);
                    }
                }
            }

            return(-1);
        }
コード例 #8
0
 protected override ButtonBaseAdapter.LayoutOptions Layout(PaintEventArgs e)
 {
     ButtonBaseAdapter.LayoutOptions options = this.CommonLayout();
     options.hintTextUp          = false;
     options.everettButtonCompat = !Application.RenderWithVisualStyles;
     if (Application.RenderWithVisualStyles)
     {
         using (Graphics graphics = WindowsFormsUtils.CreateMeasurementGraphics())
         {
             options.checkSize = RadioButtonRenderer.GetGlyphSize(graphics, RadioButtonRenderer.ConvertFromButtonState(base.GetState(), base.Control.MouseIsOver)).Width;
             return(options);
         }
     }
     options.checkSize = (int)(options.checkSize * CheckableControlBaseAdapter.GetDpiScaleRatio(e.Graphics));
     return(options);
 }
コード例 #9
0
        internal override Size GetPreferredSizeCore(Size proposedSize)
        {
            Size preferredSizeCore;

            if (this.Appearance == System.Windows.Forms.Appearance.Button)
            {
                return(this.ButtonAdapter.GetPreferredSizeCore(proposedSize));
            }
            using (Graphics graphics = WindowsFormsUtils.CreateMeasurementGraphics())
            {
                using (PaintEventArgs args = new PaintEventArgs(graphics, new Rectangle()))
                {
                    preferredSizeCore = this.Layout(args).GetPreferredSizeCore(proposedSize);
                }
            }
            return(preferredSizeCore);
        }
コード例 #10
0
        internal override Size GetPreferredSizeCore(Size proposedSize)
        {
            Size preferredSizeCore;

            if (base.Control.Appearance == Appearance.Button)
            {
                ButtonStandardAdapter adapter = new ButtonStandardAdapter(base.Control);
                return(adapter.GetPreferredSizeCore(proposedSize));
            }
            using (Graphics graphics = WindowsFormsUtils.CreateMeasurementGraphics())
            {
                using (PaintEventArgs args = new PaintEventArgs(graphics, new Rectangle()))
                {
                    preferredSizeCore = this.Layout(args).GetPreferredSizeCore(proposedSize);
                }
            }
            return(preferredSizeCore);
        }
コード例 #11
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.hintTextUp          = false;
            layout.everettButtonCompat = !Application.RenderWithVisualStyles;

            if (Application.RenderWithVisualStyles)
            {
                ButtonBase b = Control;
                using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics()) {
                    layout.checkSize = RadioButtonRenderer.GetGlyphSize(g, RadioButtonRenderer.ConvertFromButtonState(GetState(), b.MouseIsOver), b.HandleInternal).Width;
                }
            }
            else
            {
                layout.checkSize = (int)(layout.checkSize * GetDpiScaleRatio(e.Graphics));
            }

            return(layout);
        }
コード例 #12
0
        private ArrayList FindInternal(string key, bool searchAllChildren, CalendarViewCollection viewsCollectionToLookIn)
        {
            ArrayList foundViews = new ArrayList();

            if ((viewsCollectionToLookIn == null) || (foundViews == null))
            {
                return(null);
            }
            for (int i = 0; i < viewsCollectionToLookIn.Count; i++)
            {
                if ((viewsCollectionToLookIn[i] != null) &&
                    WindowsFormsUtils.SafeCompareStrings(viewsCollectionToLookIn[i].Name, key, true))
                {
                    foundViews.Add(viewsCollectionToLookIn[i]);
                    if (searchAllChildren && viewsCollectionToLookIn[i].Children.Count > 0)
                    {
                        foundViews.AddRange(this.FindInternal(key, searchAllChildren, viewsCollectionToLookIn[i].Children));
                    }
                }
            }
            return(foundViews);
        }
コード例 #13
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.checkPaddingSize    = 1;
            layout.everettButtonCompat = !Application.RenderWithVisualStyles;

            // VSWhidbey 420870
            if (Application.RenderWithVisualStyles)
            {
                using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics()) {
                    layout.checkSize = CheckBoxRenderer.GetGlyphSize(g, CheckBoxRenderer.ConvertFromButtonState(GetState(), true, Control.MouseIsOver)).Width;
                }
            }
            // Dev10
            else
            {
                layout.checkSize = (int)(layout.checkSize * GetDpiScaleRatio(e.Graphics));
            }

            return(layout);
        }
コード例 #14
0
        public virtual int IndexOfKey(string key)
        {
            if (!string.IsNullOrEmpty(key))
            {
                if (this.IsValidIndex(this.lastAccessedIndex) && WindowsFormsUtils.SafeCompareStrings(this[this.lastAccessedIndex].Name, key, true))
                {
                    return(this.lastAccessedIndex);
                }

                for (int i = 0; i < this.Count; i++)
                {
                    if (WindowsFormsUtils.SafeCompareStrings(this[i].Name, key, true))
                    {
                        this.lastAccessedIndex = i;
                        return(i);
                    }
                }

                this.lastAccessedIndex = -1;
            }

            return(-1);
        }
コード例 #15
0
        private ArrayList FindInternal(
            string key,
            bool searchAllChildren,
            CalendarViewCollection viewsCollectionToLookIn)
        {
            ArrayList arrayList = new ArrayList();

            if (viewsCollectionToLookIn == null || arrayList == null)
            {
                return((ArrayList)null);
            }
            for (int index = 0; index < viewsCollectionToLookIn.Count; ++index)
            {
                if (viewsCollectionToLookIn[index] != null && WindowsFormsUtils.SafeCompareStrings(viewsCollectionToLookIn[index].Name, key, true))
                {
                    arrayList.Add((object)viewsCollectionToLookIn[index]);
                    if (searchAllChildren && viewsCollectionToLookIn[index].Children.Count > 0)
                    {
                        arrayList.AddRange((ICollection)this.FindInternal(key, searchAllChildren, viewsCollectionToLookIn[index].Children));
                    }
                }
            }
            return(arrayList);
        }
コード例 #16
0
 public override int GetHashCode()
 {
     return(((this.Left ^ WindowsFormsUtils.RotateLeft(this.Top, 8)) ^ WindowsFormsUtils.RotateLeft(this.Right, 16)) ^ WindowsFormsUtils.RotateLeft(this.Bottom, 24));
 }
コード例 #17
0
        public Positions() : base()
        {
            this.positionsAllReversedCached = new List <Position>();
            this.cumulativeProfitDollar     = new Dictionary <Position, double>();
            this.cumulativeProfitPercent    = new Dictionary <Position, double>();

            base.TabText = "Positions";
            this.InitializeComponent();

            //VS2010 way to manage resources, autogen inside InitializeComponent()
            //System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Positions));
            //private ImageList tradeTypes;
            //this.tradeTypes = new System.Windows.Forms.ImageList(this.components);
            //this.tradeTypes.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("tradeTypes.ImageStream")));
            //this.tradeTypes.TransparentColor = System.Drawing.Color.Transparent;
            //this.tradeTypes.Images.SetKeyName(0, "45degrees3-LongEntryUnknown.png");
            //this.tradeTypes.Images.SetKeyName(1, "45degrees3-LongEntryProfit.png");
            //this.tradeTypes.Images.SetKeyName(2, "45degrees3-LongEntryLoss.png");
            //this.tradeTypes.Images.SetKeyName(3, "45degrees3-ShortEntryUnknown.png");
            //this.tradeTypes.Images.SetKeyName(4, "45degrees3-ShortEntryProfit.png");
            //this.tradeTypes.Images.SetKeyName(5, "45degrees3-ShortEntryLoss.png");

//			this.olvPositions.AllColumns.Add(this.olvcPosition);
//	        this.olvPositions.AllColumns.Add(this.olvcSerno);
//			this.olvPositions.AllColumns.Add(this.olvcSymbol);
//			this.olvPositions.AllColumns.Add(this.olvcQuantity);
//			this.olvPositions.AllColumns.Add(this.olvcEntryDate);
//			this.olvPositions.AllColumns.Add(this.olvcEntryPrice);
//			this.olvPositions.AllColumns.Add(this.olvcEntryOrder);
//			this.olvPositions.AllColumns.Add(this.olvcExitDate);
//			this.olvPositions.AllColumns.Add(this.olvcExitPrice);
//			this.olvPositions.AllColumns.Add(this.olvcExitOrder);
//			this.olvPositions.AllColumns.Add(this.olvcProfitPct);
//			this.olvPositions.AllColumns.Add(this.olvcProfitDollar);
//			this.olvPositions.AllColumns.Add(this.olvcBarsHeld);
//			this.olvPositions.AllColumns.Add(this.olvcProfitPerBar);
//			this.olvPositions.AllColumns.Add(this.olvcEntrySignalName);
//			this.olvPositions.AllColumns.Add(this.olvcExitSignalName);
//			this.olvPositions.AllColumns.Add(this.olvcMaePct);
//			this.olvPositions.AllColumns.Add(this.olvcMfePct);
//			this.olvPositions.AllColumns.Add(this.olvcCumProfitPct);
//			this.olvPositions.AllColumns.Add(this.olvcCumProfitDollar);
//			this.olvPositions.AllColumns.Add(this.olvcComission);

            WindowsFormsUtils.SetDoubleBuffered(this.olvPositions);
            WindowsFormsUtils.SetDoubleBuffered(this);
            columnsByFilters = new Dictionary <ToolStripMenuItem, List <OLVColumn> >();
            columnsByFilters.Add(this.mniShowEntriesExits, new List <OLVColumn>()
            {
                this.olvcEntryDate,
                this.olvcEntryPrice,
                this.olvcEntryOrder,
                this.olvcExitDate,
                this.olvcExitPrice,
                this.olvcExitOrder
            });
            columnsByFilters.Add(this.mniShowPercentage, new List <OLVColumn>()
            {
                this.olvcProfitPct,
                this.olvcCumProfitPct
            });
            columnsByFilters.Add(this.mniShowBarsHeld, new List <OLVColumn>()
            {
                this.olvcBarsHeld,
                this.olvcProfitPerBar
            });
            columnsByFilters.Add(this.mniShowMaeMfe, new List <OLVColumn>()
            {
                this.olvcMaePct,
                this.olvcMfePct
            });
            columnsByFilters.Add(this.mniShowSignals, new List <OLVColumn>()
            {
                this.olvcEntrySignalName,
                this.olvcExitSignalName
            });
            columnsByFilters.Add(this.mniShowCommission, new List <OLVColumn>()
            {
                this.olvcComission
            });
            //LEFT_NULL_INTENTIONALLY_SINCE_ReportersFormManager_IS_RESPONSIBLE_TO_CALL_OUR_CreateSnapshotToStoreInScriptContext() snap = new PositionsDataSnapshot();
        }