public void DrawImage(GraphicsContext dc, int partId, int stateId, Rect destinationRect, Bitmap bitmap, Color maskColor)
 {
     // Don't AssertPartDefined() here, as the other overload of DrawImage() will do that for us.
     using (ImageList list = new ImageList(bitmap.Size, 1, 1))
     {
         int index = list.AddImage(bitmap, maskColor);
         DrawImage(dc, partId, stateId, destinationRect, list, index);
     }
 }
        private void CustomInitializeGrid()
        {
            var columns = _tgMsgs.Columns;

            var imageList = new ImageList {
                ColorDepth = ColorDepth.Depth32Bit
            };

            _tgMsgs.SmallImageList = imageList;

            // Картинки в заголовке грида
            columns[1].ImageIndex = imageList.AddImage(_imgManager.GetMarkImage(MessageFlagExistence.OnMessage));
            columns[2].ImageIndex = imageList.AddImage(
                _imgManager.GetMessageImage(
                    MessageType.Ordinal,
                    MessageFlagExistence.None,
                    false,
                    MessageFlagExistence.None,
                    false));
            columns[3].ImageIndex = imageList.AddImage(_imgManager.GetUserImage(UserClass.User));
            columns[7].ImageIndex = imageList.AddImage(_imgManager.GetMessageDateImage(DateTime.Now));

            // Делаем поддержку локализации для TreeGrid'а
            // В случае изменения TreeGrid'а в Designer'е, необходимо
            // внести изменения сюда.
            columns[2].Text = SR.TGColumnSubject;
            columns[3].Text = SR.TGColumnAuthor;
            columns[4].Text = SR.TGColumnMessageRate;
            columns[5].Text = SR.TGColumnForumName;
            columns[6].Text = SR.TGColumnAnswers;
            columns[7].Text = SR.TGColumnDate;

            if (Config.Instance.SearchColumnOrder.Length == _tgMsgs.Columns.Count)
            {
                _tgMsgs.ColumnsOrder = Config.Instance.SearchColumnOrder;
            }
            if (Config.Instance.SearchColumnWidth.Length == _tgMsgs.Columns.Count)
            {
                _tgMsgs.ColumnsWidth = Config.Instance.SearchColumnWidth;
            }
        }
예제 #3
0
        private void CustomInitializeComponent()
        {
            StyleConfig.StyleChange += OnStyleChanged;

            State = Config.Instance.ForumFormState;

            var imageList = new ImageList {
                ColorDepth = ColorDepth.Depth32Bit
            };

            // Делаем поддержку локализации для TreeGrid'а
            // В случае изменения TreeGrid'а в Designer'е, необходимо внести изменения сюда
            _tgMsgs.Columns[1].ImageIndex =
                imageList.AddImage(_imageManager.GetMarkImage(MessageFlagExistence.OnMessage));

            _tgMsgs.Columns[2].Text       = SR.TGColumnSubject;
            _tgMsgs.Columns[2].ImageIndex =
                imageList.AddImage(
                    _imageManager.GetMessageImage(
                        MessageType.Ordinal,
                        MessageFlagExistence.None,
                        false,
                        MessageFlagExistence.None,
                        false));

            _tgMsgs.Columns[3].Text       = SR.TGColumnAuthor;
            _tgMsgs.Columns[3].ImageIndex =
                imageList.AddImage(_imageManager.GetUserImage(UserClass.User));

            _tgMsgs.Columns[4].Text = SR.TGColumnRate;

            _tgMsgs.Columns[5].Text = SR.TGColumnSubjectRate;

            _tgMsgs.Columns[6].Text = SR.TGColumnAnswers;

            _tgMsgs.Columns[7].Text       = SR.TGColumnDate;
            _tgMsgs.Columns[7].ImageIndex =
                imageList.AddImage(_imageManager.GetMessageDateImage(DateTime.Now));

            _tgMsgs.Font           = Config.Instance.StyleConfig.MessageTreeFont;
            _tgMsgs.BackColor      = Config.Instance.StyleConfig.MessageTreeBack;
            _tgMsgs.GridLines      = Config.Instance.ForumDisplayConfig.MsgListGridLines;
            _tgMsgs.SmallImageList = imageList;

            if (Config.Instance.ForumColumnOrder.Length == _tgMsgs.Columns.Count)
            {
                _tgMsgs.ColumnsOrder = Config.Instance.ForumColumnOrder;
            }
            if (Config.Instance.ForumColumnWidth.Length == _tgMsgs.Columns.Count)
            {
                _tgMsgs.ColumnsWidth = Config.Instance.ForumColumnWidth;
            }

            _msgViewer = new MsgViewer(_serviceManager)
            {
                Dock = DockStyle.Fill
            };
            _bottomPanel.Controls.Add(_msgViewer);

            ApplicationManager.Instance.ForumNavigator.MessageNavigated += MessageNavigated;

            _btnResetFilter.Text = SR.Forum.ResetFilter;
        }