Example #1
0
 public Scrollbar()
 {
     BackColor = com.convertColour(com.Config.GetConfig("Colors", "ButtonFace").Setting);
     if (themeLocation == "")
     {
         themeLocation = com.toSystemPath(com.Config.GetConfig("Windows", "ThemeLocation").Setting);
     }
     themeConfig         = new ConfigHelper(themeLocation + "Config.ini");
     Orientation         = ScrollOrientation.HorizontalScroll;
     downArr             = com.prepareImage(themeLocation + themeConfig.GetConfig("Scroll", "downArrow").Setting);
     upArr               = com.prepareImage(themeLocation + themeConfig.GetConfig("Scroll", "upArrow").Setting);
     bar.Stuck           = true;
     bar.MouseDown      += Scrollbar_MouseDown;
     bar.MouseUp        += Scrollbar_MouseDown;
     bar.MouseMove      += Scrollbar_MouseMove;
     downArrow.Click    += LargeChanger;
     downArrow.Tag       = 1;
     upArrow.Click      += LargeChanger;
     upArrow.Tag         = -1;
     this.DoubleBuffered = true;
     this.Controls.Add(bar);
     this.Controls.Add(downArrow);
     this.Controls.Add(upArrow);
     Invalidate();
     Debug.WriteLine(Height);
 }
 private void RefreshImage(String source)
 {
     if (System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime)
     {
         return;
     }
     if (wallMode == ImageLayout.Tile)
     {
         base.BackgroundImage      = com.prepareImage((Bitmap)Wallpaper, true);//base.BackColor
         base.BackgroundImageTiled = true;
     }
     else
     {
         Console.WriteLine(wallMode + source);
         base.BackgroundImageTiled = false;
         base.BackgroundImage      = updateBackground(ref pat, ref wall, wallMode, base.Size, BackColor);
     }
 }
 private void themeRefresh()
 {
     if (foc)
     {
         programtopbar.BackColor = com.convertColour(com.Config.GetConfig("Colors", "ActiveTitle").Setting);
     }
     else
     {
         programtopbar.BackColor = com.convertColour(com.Config.GetConfig("Colors", "InactiveTitle").Setting);
     }
     minimizebutton.Image              = com.prepareImage(themeLocation + themeConfig.GetConfig("ControlButtons", "MinUp").Setting);
     minimizebutton.BackColor          = com.convertColour(com.Config.GetConfig("Colors", "ButtonFace").Setting);
     maximizebutton.Image              = com.prepareImage(themeLocation + themeConfig.GetConfig("ControlButtons", "MaxSmUp").Setting);//
     maximizebutton.BackColor          = com.convertColour(com.Config.GetConfig("Colors", "ButtonFace").Setting);
     closebutton.Image                 = com.prepareImage(themeLocation + themeConfig.GetConfig("ControlButtons", "CloseUp").Setting);
     closebutton.BackColor             = com.convertColour(com.Config.GetConfig("Colors", "ButtonFace").Setting);
     lefts.BackgroundImage             = com.prepareImage(themeLocation + themeConfig.GetConfig("Borders", "left").Setting);
     rights.BackgroundImage            = com.prepareImage(themeLocation + themeConfig.GetConfig("Borders", "right").Setting);
     bottoms.BackgroundImage           = com.prepareImage(themeLocation + themeConfig.GetConfig("Borders", "bottom").Setting);
     bottomrightcorner.BackgroundImage = com.prepareImage(themeLocation + themeConfig.GetConfig("Borders", "bottomRight").Setting);
     bottomleftcorner.BackgroundImage  = com.prepareImage(themeLocation + themeConfig.GetConfig("Borders", "bottomLeft").Setting);
     topleftcorner.BackgroundImage     = com.prepareImage(themeLocation + themeConfig.GetConfig("Borders", "topLeft").Setting);
     toprightcorner.BackgroundImage    = com.prepareImage(themeLocation + themeConfig.GetConfig("Borders", "topRight").Setting);
 }
        private void mybase_DrawItem(object sender, DrawListViewItemEventArgs e)        //http://vb-helper.com/howto_net_owner_draw_listview.html
        {
            try
            {
                //  e.DrawText();// = false;
                // Draw Details view items in the DrawSubItem event handler.
                //      if (e.Item.ListView.View == View.Details) return;

                // Get the ListView item and the ServerStatus object.
                //      ListViewItem item = e.Item;

                // Clear.
                //e.DrawBackground();
                if (e.State == ListViewItemStates.Selected)
                {
                    ItemColour(e.ItemIndex, SelectedTextColor, SelectedColor);
                }
                else
                {
                    ItemColour(e.ItemIndex, ForeColor, BackColor);
                }
                StringFormat sf = new StringFormat();
                sf.Alignment     = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Center;
                sf.FormatFlags   = StringFormatFlags.DirectionRightToLeft;

                // Draw a status indicator.
                //        e.Graphics.SmoothingMode =
                //            System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                Rectangle rect = new Rectangle(e.Bounds.Left + 1, e.Bounds.Top + 1, e.Bounds.Height - 2, e.Bounds.Height - 2);
                //        using (SolidBrush br =
                //            new SolidBrush(ForeColor))
                //        {
                //            e.Graphics.FillEllipse(br, rect);
                //        }
                //        e.Graphics.DrawEllipse(Pens.Black, rect);
                int left = rect.Right + 2;
                //
                Bitmap img = new Bitmap(1, 1);
                if (SmallImageList.Images.Get(e.Item.ImageIndex) != null)
                {
                    img = new Bitmap(SmallImageList.Images.Get(e.Item.ImageIndex), ImageSize);
                }
                //         // See how much we must scale it.
                //         float scale;
                //  Console.WriteLine(e.Bounds.Height + ","+ ImageSize.Height);
                float scale = 1F;// ImageSize.Height;//e.Bounds.Height;// / (float)ImageSize.Height;//img.Height;

                // Scale and position the image.
                e.Graphics.ScaleTransform(scale, scale);
                e.Graphics.TranslateTransform(left, left + (e.ItemIndex * ((LargeImageListSize.Height + 30) * scale)), System.Drawing.Drawing2D.MatrixOrder.Append);  //+ (e.Bounds.Height - img.Height * scale) /1
                                                                                                                                                                      //
                                                                                                                                                                      //         // Draw the image.
                e.Graphics.DrawImage(com.prepareImage(img, true), 0, 0);
                SizeF     sizTxt = e.Graphics.MeasureString(e.Item.Text, e.Item.Font, e.Bounds.Width, sf);
                Rectangle txtRec = new Rectangle(new Point(0, img.Height), new Size((int)sizTxt.Width, (int)sizTxt.Height));//TextRenderer.MeasureText(e.Item.Text, e.Item.Font, new Size(img.Width, img.Height)));

                e.Graphics.FillRectangle(new SolidBrush(e.Item.BackColor), txtRec);
                e.Graphics.DrawString(e.Item.Text, e.Item.Font, new SolidBrush(e.Item.ForeColor), txtRec, sf);
                // Draw the focus rectangle if appropriate.
                e.Graphics.ResetTransform();
                //  e.DrawFocusRectangle();
            }catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }