private void ScrollViewerClusters_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (_isZoomeMode)
            {
                double deltaZoom = e.Delta > 0 ? 20 : -20;
                double newWidth  = Math.Max(GridCanvasControlClusters.Width + deltaZoom, GridCanvasControlClusters.MinWidth);
                newWidth = Math.Min(newWidth, GridCanvasControlClusters.MaxWidth);

                GridCanvasControlClusters.Width = newWidth;


                RebuildLinesCoord();
                _iCntr++;
                if (_iCntr % 2 == 0)
                {
                    int deltaScaleFont = e.Delta > 0 ? 1 : -1;
                    _fontSizeScaled = Math.Max(_fontSizeScaled + deltaScaleFont, 1);
                    _fontSizeScaled = Math.Min(_fontSizeScaled, FontSize);
                }
                //Mouse.SetCursor(Cursors.ScrollWE);
            }
            else
            {
                double increment = e.Delta > 0 ? 20 : -20;

                double newValue;
                newValue = Math.Min(ScrollViewerClusters.HorizontalOffset + increment, ScrollViewerClusters.ScrollableWidth);
                newValue = Math.Max(ScrollViewerClusters.HorizontalOffset + increment, 0);

                ScrollViewerClusters.ScrollToHorizontalOffset(newValue);
            }
        }
        public ControlClusters()
        {
            InitializeComponent();

            IsInitializeComplete = false;


            GenDPList();

            _renderer = new CRenderer(this, _drwVis);
            _alarmer  = CKernelTerminal.GetKernelTerminalInstance().Alarmer;

            if (_typeFaceDefault == null)
            {
                _typeFaceDefault = new Typeface(_fontFamilyDefault, FontStyles.Normal, _fontWeightDefault, new FontStretch());
            }
            _penClusterTotal = new Pen(Brushes.LightGray, 1.0);
            //KAA removed 2016-May-31
            // StringHeight = 13;
            _lstImageSegments.Add(Image_0);
            _lstImageSegments.Add(Image_1);
            _lstImageSegments.Add(Image_2);
            _lstImageSegments.Add(Image_3);
            _lstImageSegments.Add(Image_4);
            _lstImageSegments.Add(Image_5);
            _lstImageSegments.Add(Image_6);
            _lstImageSegments.Add(Image_7);
            _lstImageSegments.Add(Image_8);
            _lstImageSegments.Add(Image_9);

            ScrollViewerClusters.ScrollToRightEnd();

            for (int i = 0; i < _lstImageSegments.Count; i++)
            {
                RenderOptions.SetBitmapScalingMode(_lstImageSegments[i], BitmapScalingMode.NearestNeighbor);
                TextOptions.SetTextRenderingMode(_lstImageSegments[i], TextRenderingMode.ClearType);
                TextOptions.SetTextFormattingMode(_lstImageSegments[i], TextFormattingMode.Display);
            }
            RenderOptions.SetEdgeMode(this, EdgeMode.Aliased);



            //  CUtil.TaskStart(TaskTriggerPaint);
            CUtil.ThreadStart(ThreadDrawClusters);


            SizeChanged += ControlClusters_SizeChanged;

            GridCanvasControlClusters.MouseEnter += GridCanvasControlClusters_MouseEnter;

            _guiDispatcher = Dispatcher.CurrentDispatcher;
        }