public Bitmap GetImage(oSlide s, int suiHeight)
        {
            int suiWidth = (int)(s.Rap * (float)suiHeight + 0.5f);

            Bitmap   img = new Bitmap(suiWidth, suiHeight);
            Graphics g   = Graphics.FromImage(img);

            g.Clear(s.BackColor);


            foreach (oSlideControl sc in s.listControl)
            {
                if (sc.TheType == scType.Label)
                {
                    scLabel l = (scLabel)sc;

                    int uix      = (int)(l.Left * (float)suiWidth + 0.5f);
                    int uiy      = (int)(l.Top * (float)suiHeight + 0.5f);
                    int uiwidth  = (int)(l.Width * (float)suiWidth + 0.5f);
                    int uiheight = (int)(l.Height * (float)suiHeight + 0.5f);

                    //test
                    g.DrawRectangle(Pens.Blue, uix, uiy, uiwidth - 1, uiheight - 1);
                }
            }


            //end
            g.Dispose();
            return(img);
        }
Пример #2
0
        private void buttonNewSlide_Click(object sender, EventArgs e)
        {
            oSlide news = new oSlide();

            news.Rap = 2f;
            this.TheProject.AddSlide(news);
            //this.TheProject.listSlide.Add(news);
            //this.SlideViewer.RefreshImage();
        }
        public void RemoveSlide(oSlide oldSlide)
        {
            int lastcount = this.listSlide.Count;

            this.listSlide.Remove(oldSlide);
            if (this.listSlide.Count != lastcount)
            {
                this.Raise_SlideRemoved();
            }
        }
Пример #4
0
        private void voidnew()
        {
            InitializeComponent();
            this.EditorSplitContainer.SplitterWidth = 8;

            //cree un project vierge de base
            this.TheProject = new oPowerPointProject();
            //ajoute une slide par default
            oSlide slide1 = new oSlide();

            this.TheProject.listSlide.Add(slide1);



            //cree le edit context
            this.TheEContext = new oEditContext(this.TheProject);



            this.SlideViewer        = new uioProjectSlideListView(this.TheProject, this.TheEContext);
            this.SlideViewer.Parent = this.MainSplitContainer.Panel1;

            this.TheSelectPanel          = new uioEditerObjectSelectPanel(this.TheProject, this.TheEContext);
            this.TheSelectPanel.Parent   = this.EditorSplitContainer.Panel1;
            this.TheSelectPanel.Location = new Point(1, 1);
            this.TheSelectPanel.Width    = this.EditorSplitContainer.Panel1.Width - this.TheSelectPanel.Left - 10;
            this.TheSelectPanel.Anchor   = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;

            this.TheSlideEditer           = new uioProjectSlideEditer(this.TheProject, this.TheEContext);
            this.TheSlideEditer.Parent    = this.EditorSplitContainer.Panel1;
            this.TheSlideEditer.Top       = this.TheSelectPanel.Top + this.TheSelectPanel.Height + 2;
            this.TheSlideEditer.Left      = 0;
            this.TheSlideEditer.Width     = this.EditorSplitContainer.Panel1.Width - this.TheSlideEditer.Left - 2;
            this.TheSlideEditer.Height    = this.EditorSplitContainer.Panel1.Height - this.TheSlideEditer.Top - 2;
            this.TheSlideEditer.Anchor    = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
            this.TheSlideEditer.BackColor = Color.DimGray;
        }
        //cette function retourne une image de moindre qualité de la slide.
        public Bitmap GetThumbnailImage(oSlide s, int suiHeight)
        {
            int suiWidth = (int)(s.Rap * (float)suiHeight + 0.5f);

            Bitmap   img = new Bitmap(suiWidth, suiHeight);
            Graphics g   = Graphics.FromImage(img);

            g.Clear(s.BackColor);


            foreach (oSlideControl sc in s.listControl)
            {
                if (sc.TheType == scType.Label)
                {
                    scLabel l = (scLabel)sc;

                    int uix      = (int)(l.Left * (float)suiWidth + 0.5f);
                    int uiy      = (int)(l.Top * (float)suiHeight + 0.5f);
                    int uiwidth  = (int)(l.Width * (float)suiWidth + 0.5f);
                    int uiheight = (int)(l.Height * (float)suiHeight + 0.5f);

                    //une zone de texte ne remplit pas tout son rectangle, alors il fait la moyenne des couleur de l'arriere plan avec celle du texte
                    Color bc        = s.BackColor;
                    Color fc        = l.ForeColor;
                    Color FillColor = Color.FromArgb((bc.R + fc.R) / 2, (bc.G + fc.G) / 2, (bc.B + fc.B) / 2);

                    //remplit la zone
                    g.FillRectangle(new SolidBrush(FillColor), uix, uiy, uiwidth - 1, uiheight - 1);
                }
            }


            //end
            g.Dispose();
            return(img);
        }
        public List <oSlide> listSlide = new List <oSlide>();       //contien toute les slide du project

        public void AddSlide(oSlide newSlide)
        {
            this.listSlide.Add(newSlide);
            this.Raise_SlideAdded();
        }
Пример #7
0
        private void ImageBox_MouseDown(object sender, MouseEventArgs e)
        {
            Rectangle mrec  = this.MouseRec;
            Rectangle vmrec = this.vMouseRec;

            if (e.Button == MouseButtons.Left)
            {
                this.isMouseLeftDown = true;

                //si la sourie est sur un button
                if (this.IsMouseOnAnyControl())
                {
                    this.Button_ExecMouseDown();
                }                 //addbutton qui cree une nouvelle slide
                else if (this.recAddButton.IntersectsWith(vmrec))
                {
                    oSlide news = new oSlide();
                    this.TheProject.AddSlide(news);
                }
                else
                {
                    //check si le click est fait dans la zone de la scroll bar
                    if (mrec.X < this.Width - this.uiScrollZoneWidth)
                    {
                        //Program.wdebug("Click On Thumb");
                        int mouseindex = this.GetIndexOfMouse();
                        if (mouseindex != -1)
                        {
                            this.TheEContext.SetEditingSlide(mouseindex);
                        }
                    }
                    else
                    {
                        if (this.recScrollBarRec.IntersectsWith(this.MouseRec))
                        {
                            int my    = this.MousePos.Y;
                            int delta = my - this.recScrollBarRec.Y - 1;
                            this.AutoScrollMouseBarDelta = delta;
                        }
                        else
                        {
                            this.AutoScrollMouseBarDelta = this.recScrollBarRec.Height / 2;
                        }
                        this.Exec_MouseClickScroll();
                        this.StartAutoScroll(ScrollDir.mouse);
                    }
                }
            }
            if (e.Button == MouseButtons.Right)
            {
                int mouseindex = this.GetIndexOfMouse();
                if (mouseindex != -1)
                {
                    string optDelete = "Supprimer";

                    string optMoveUp   = "Move up";
                    string optMoveDown = "Move down";
                    string optMoveTo   = "Move to ...";


                    oRightClick2 rc = new oRightClick2();
                    if (this.TheProject.listSlide.Count > 1)
                    {
                        rc.AddSeparator();
                        rc.AddChoice(optDelete);
                    }
                    rc.AddSeparator();

                    if (mouseindex > 0)
                    {
                        rc.AddChoice(optMoveUp);
                    }
                    if (mouseindex < this.TheProject.listSlide.Count - 1)
                    {
                        rc.AddChoice(optMoveDown);
                    }
                    if (this.TheProject.listSlide.Count > 3)
                    {
                        rc.AddChoice(optMoveTo);
                    }


                    ////execution du choix
                    string rep = rc.GetChoice();
                }
            }
            this.RefreshImage();
        }