Click here to Skip to main content
15,915,172 members
Home / Discussions / C#
   

C#

 
GeneralRe: Asa Client Pin
Heath Stewart23-Dec-04 5:57
protectorHeath Stewart23-Dec-04 5:57 
GeneralDraw line between pictureboxes Pin
ninja260523-Dec-04 2:18
ninja260523-Dec-04 2:18 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart23-Dec-04 5:47
protectorHeath Stewart23-Dec-04 5:47 
GeneralRe: Draw line between pictureboxes Pin
ninja260523-Dec-04 18:37
ninja260523-Dec-04 18:37 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart23-Dec-04 19:24
protectorHeath Stewart23-Dec-04 19:24 
GeneralRe: Draw line between pictureboxes Pin
ninja260523-Dec-04 20:18
ninja260523-Dec-04 20:18 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart23-Dec-04 20:23
protectorHeath Stewart23-Dec-04 20:23 
GeneralRe: Draw line between pictureboxes Pin
ninja260524-Dec-04 0:33
ninja260524-Dec-04 0:33 
Hello Heath,
I have tried to implement what you told me to but when i scroll the panel i lose the images and the system becomes too slow. I am calling DisplayThumbnails1() on panel1_paint. Here is the code


using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;

namespace medappzDMS.folderList
{
///
/// Summary description for fmlinks.
///

public class fmlinks : System.Windows.Forms.Form
{
private CustomAutoScrollPanel.ScrollablePanel panel1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage thumbnails;
private System.Windows.Forms.TabPage actualsize;
private System.Windows.Forms.PictureBox[] pb;
private System.Windows.Forms.Label[] lbl;
//private System.ComponentModel.IContainer components;
//private System.Drawing.Image _image = null;
private int _margin = 50;
private bool m_MouseIsDown=false;
private bool m_IsDragDrop=true;
//private bool panelmousedown=false;
//private string[] arrfilename;
private string[] arrfileindex1;
private string[] arrfileindex2;

// private char[] charfileindex1;
private string[] filename;
private string[] filename1;
private string locallink=null;

private string linkfrom=null;

private int j=0;

private bool hascolor=false;
private System.Drawing.Image _image = null;
private string pbcolor;
private int x1=0,y1=0,x2=0,y2=0;
Rectangle SelectRect = new Rectangle();
Point ps=new Point();
private System.Windows.Forms.Label lblviewcurlinks;
private System.Windows.Forms.Label lblcurlinks;
Point pe=new Point();
private System.Windows.Forms.ToolTip toolTip1;
private System.ComponentModel.IContainer components;
private string startcoordinates=null;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.NumericUpDown numericUpDown5;
private System.Windows.Forms.NumericUpDown numericUpDown6;
private string endcoordinates=null;
//private Image[] newimage;
private int width=150;
private int height=120;
private bool imagedrawn=false;


private System.Drawing.Image Image
{
get { return _image; }
}

public fmlinks()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
string [] fileEntries = Directory.GetFiles(utils.imgfolderpath);
j=fileEntries.Length;
//arrfilename=new string[j];
arrfileindex1=new string[j];
arrfileindex2=new string[j];


//charfileindex1=new char[]{'#'};
filename=new string[j];
filename1=new string[j*3];
//newimage=new Image[j];

//
// TODO: Add any constructor code after InitializeComponent call
//
}

///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(fmlinks));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.thumbnails = new System.Windows.Forms.TabPage();
this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
this.lblviewcurlinks = new System.Windows.Forms.Label();
this.lblcurlinks = new System.Windows.Forms.Label();
this.panel1 = new CustomAutoScrollPanel.ScrollablePanel();
this.panel2 = new System.Windows.Forms.Panel();
this.actualsize = new System.Windows.Forms.TabPage();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.tabControl1.SuspendLayout();
this.thumbnails.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.thumbnails);
this.tabControl1.Controls.Add(this.actualsize);
this.tabControl1.Location = new System.Drawing.Point(8, 8);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(580, 520);
this.tabControl1.TabIndex = 0;
//
// thumbnails
//
this.thumbnails.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("thumbnails.BackgroundImage")));
this.thumbnails.Controls.Add(this.numericUpDown6);
this.thumbnails.Controls.Add(this.numericUpDown5);
this.thumbnails.Controls.Add(this.lblviewcurlinks);
this.thumbnails.Controls.Add(this.lblcurlinks);
this.thumbnails.Controls.Add(this.panel1);
this.thumbnails.Location = new System.Drawing.Point(4, 22);
this.thumbnails.Name = "thumbnails";
this.thumbnails.Size = new System.Drawing.Size(572, 494);
this.thumbnails.TabIndex = 0;
this.thumbnails.Text = "Thumbnails";
//
// numericUpDown6
//
this.numericUpDown6.Location = new System.Drawing.Point(352, 8);
this.numericUpDown6.Maximum = new System.Decimal(new int[] {
100000,
0,
0,
0});
this.numericUpDown6.Name = "numericUpDown6";
this.numericUpDown6.TabIndex = 4;
this.numericUpDown6.Visible = false;
this.numericUpDown6.ValueChanged += new System.EventHandler(this.numericUpDown6_ValueChanged);
//
// numericUpDown5
//
this.numericUpDown5.Location = new System.Drawing.Point(488, 8);
this.numericUpDown5.Maximum = new System.Decimal(new int[] {
100000,
0,
0,
0});
this.numericUpDown5.Name = "numericUpDown5";
this.numericUpDown5.TabIndex = 3;
this.numericUpDown5.Visible = false;
this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged);
//
// lblviewcurlinks
//
this.lblviewcurlinks.AutoSize = true;
this.lblviewcurlinks.Location = new System.Drawing.Point(192, 16);
this.lblviewcurlinks.Name = "lblviewcurlinks";
this.lblviewcurlinks.Size = new System.Drawing.Size(0, 16);
this.lblviewcurlinks.TabIndex = 2;
//
// lblcurlinks
//
this.lblcurlinks.Location = new System.Drawing.Point(48, 16);
this.lblcurlinks.Name = "lblcurlinks";
this.lblcurlinks.Size = new System.Drawing.Size(72, 23);
this.lblcurlinks.TabIndex = 1;
this.lblcurlinks.Text = "Current Link";
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.AutoScrollHorizontalMaximum = 100;
this.panel1.AutoScrollHorizontalMinimum = 0;
this.panel1.AutoScrollHPos = 0;
this.panel1.AutoScrollVerticalMaximum = 100;
this.panel1.AutoScrollVerticalMinimum = 0;
this.panel1.AutoScrollVPos = 0;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel1.Controls.Add(this.panel2);
this.panel1.EnableAutoScrollHorizontal = true;
this.panel1.EnableAutoScrollVertical = true;
this.panel1.Location = new System.Drawing.Point(8, 48);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(568, 440);
this.panel1.TabIndex = 0;
this.panel1.VisibleAutoScrollHorizontal = true;
this.panel1.VisibleAutoScrollVertical = true;
this.panel1.ScrollVertical += new System.Windows.Forms.ScrollEventHandler(this.panel1_ScrollVertical);
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint_1);
this.panel1.ScrollHorizontal += new System.Windows.Forms.ScrollEventHandler(this.panel1_ScrollHorizontal);
this.panel1.ScrollMouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel1_ScrollMouseWheel);
//
// panel2
//
this.panel2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel2.BackgroundImage")));
this.panel2.Location = new System.Drawing.Point(24, 16);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(700, 750);
this.panel2.TabIndex = 0;
this.panel2.Click += new System.EventHandler(this.panel2_Click);
this.panel2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp);
this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
this.panel2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove);
this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown);
//
// actualsize
//
this.actualsize.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("actualsize.BackgroundImage")));
this.actualsize.Location = new System.Drawing.Point(4, 22);
this.actualsize.Name = "actualsize";
this.actualsize.Size = new System.Drawing.Size(572, 494);
this.actualsize.TabIndex = 1;
this.actualsize.Text = "Actual Size";
//
// fmlinks
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(592, 542);
this.Controls.Add(this.tabControl1);
this.Name = "fmlinks";
this.Load += new System.EventHandler(this.fmlinks_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.fmlinks_Paint);
this.tabControl1.ResumeLayout(false);
this.thumbnails.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

private void fmlinks_Load(object sender, System.EventArgs e)
{
//DisplayThumbnails1();

}









private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{

DisplayThumbnails1();

}

private void panel1_ScrollHorizontal(object sender, System.Windows.Forms.ScrollEventArgs e)
{
//this.label2.Text = "horizontal scroll :: type: " + e.Type.ToString();// + " :: pos: " + e.NewValue;
this.numericUpDown5.Value = e.NewValue;
// this.panel1.AutoScrollHPos =e.NewValue;
}

private void panel1_ScrollVertical(object sender, System.Windows.Forms.ScrollEventArgs e)
{
//this.label2.Text = "vertical scroll :: type: " + e.Type.ToString();
this.numericUpDown6.Value = e.NewValue;
//this.panel1.AutoScrollVPos = e.NewValue;
}
private void panel1_ScrollMouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
//this.label4.Text = e.Delta.ToString();
//this.numericUpDown6.Value = this.panel1.AutoScrollVPos;
//this.panel1.AutoScrollVPos = e.NewValue;

}

private void panel2_Click(object sender, System.EventArgs e)
{
this.panel1.Focus();
}

private void numericUpDown5_ValueChanged(object sender, System.EventArgs e)
{
this.panel1.AutoScrollHPos = System.Convert.ToInt32( this.numericUpDown5.Value );
}

private void numericUpDown6_ValueChanged(object sender, System.EventArgs e)
{
this.panel1.AutoScrollVPos = System.Convert.ToInt32( this.numericUpDown6.Value );
}




private void DisplayThumbnails1()
{

Panel thisform = (Panel)panel2 ;
Graphics g = thisform.CreateGraphics();
string [] fileEntries = Directory.GetFiles(utils.imgfolderpath);

int j=fileEntries.Length;
for(int i=0; i
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart27-Dec-04 10:09
protectorHeath Stewart27-Dec-04 10:09 
GeneralRe: Draw line between pictureboxes Pin
ninja260529-Dec-04 0:38
ninja260529-Dec-04 0:38 
GeneralRe: Draw line between pictureboxes Pin
Heath Stewart29-Dec-04 5:28
protectorHeath Stewart29-Dec-04 5:28 
GeneralRe: Draw line between pictureboxes Pin
ninja260510-Jan-05 0:49
ninja260510-Jan-05 0:49 
GeneralI wish myself a flicker free form Pin
TyronX23-Dec-04 2:09
TyronX23-Dec-04 2:09 
GeneralRe: I wish myself a flicker free form Pin
Heath Stewart23-Dec-04 5:27
protectorHeath Stewart23-Dec-04 5:27 
GeneralRe: I wish myself a flicker free form Pin
TyronX23-Dec-04 6:47
TyronX23-Dec-04 6:47 
GeneralRe: I wish myself a flicker free form Pin
Heath Stewart23-Dec-04 9:31
protectorHeath Stewart23-Dec-04 9:31 
GeneralRe: I wish myself a flicker free form Pin
TyronX23-Dec-04 10:23
TyronX23-Dec-04 10:23 
GeneralConnection to access database with C#.net Pin
Robske23-Dec-04 1:41
Robske23-Dec-04 1:41 
GeneralRe: Connection to access database with C#.net Pin
leppie23-Dec-04 3:27
leppie23-Dec-04 3:27 
GeneralRe: Connection to access database with C#.net Pin
Robske23-Dec-04 4:25
Robske23-Dec-04 4:25 
GeneralRe: Connection to access database with C#.net Pin
leppie23-Dec-04 4:42
leppie23-Dec-04 4:42 
GeneralRe: Connection to access database with C#.net Pin
Robske23-Dec-04 8:06
Robske23-Dec-04 8:06 
GeneralRe: Connection to access database with C#.net Pin
Rob Graham23-Dec-04 8:56
Rob Graham23-Dec-04 8:56 
GeneralRe: Connection to access database with C#.net Pin
Robske25-Dec-04 1:23
Robske25-Dec-04 1:23 
GeneralRe: Connection to access database with C#.net Pin
Heath Stewart23-Dec-04 5:32
protectorHeath Stewart23-Dec-04 5:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.