Click here to Skip to main content
15,888,162 members
Home / Discussions / C#
   

C#

 
AnswerRe: Looping though Dataset Pin
ABitSmart25-Feb-09 3:35
ABitSmart25-Feb-09 3:35 
GeneralRe: Looping though Dataset Pin
kanchoette25-Feb-09 3:44
kanchoette25-Feb-09 3:44 
GeneralRe: Looping though Dataset Pin
ABitSmart25-Feb-09 4:10
ABitSmart25-Feb-09 4:10 
QuestionHow to add a ScrollBar where there is none? Pin
Megidolaon25-Feb-09 3:12
Megidolaon25-Feb-09 3:12 
AnswerRe: How to add a ScrollBar where there is none? Pin
Xmen Real 25-Feb-09 3:19
professional Xmen Real 25-Feb-09 3:19 
GeneralRe: How to add a ScrollBar where there is none? [modified] Pin
Megidolaon25-Feb-09 21:23
Megidolaon25-Feb-09 21:23 
GeneralRe: How to add a ScrollBar where there is none? Pin
Xmen Real 25-Feb-09 23:01
professional Xmen Real 25-Feb-09 23:01 
GeneralRe: How to add a ScrollBar where there is none? Pin
Megidolaon25-Feb-09 23:41
Megidolaon25-Feb-09 23:41 
ok, this is the code:
for (int i = 0; i <= width; i++)
            {
                for (int k = 0; k <= height; k++)
                {
                    if (i == 7 && k == 15)
                    {
                        this.Text = this.Text;
                    }
                    g = Graphics.FromImage(memory);

                    coordinate = new Point(i, k);
                    pictureboxes.Add(coordinate, new PictureBox());
                    pictureboxes[coordinate].Height = 32;
                    pictureboxes[coordinate].Width = 32;
                    pictureboxes[coordinate].Visible = true;
                    pictureboxes[coordinate].Anchor = AnchorStyles.Left | AnchorStyles.Top;
                    pictureboxes[coordinate].BorderStyle = BorderStyle.FixedSingle;
                    pictureboxes[coordinate].Margin = new Padding(0);

                    pictureboxes[coordinate].Location = new Point(32 * i, 32 * k);

                    pictureboxes[coordinate].MouseDown += new MouseEventHandler(OnLeftDown);
                    pictureboxes[coordinate].MouseDown += new MouseEventHandler(OnRightClick);

                    g.DrawImage(resource, new Rectangle(0, 0, 32, 32), 
                        new Rectangle(32 * i, 32 * k, 32, 32), GraphicsUnit.Pixel);
                    
                    pictureboxes[coordinate].Image = new Bitmap(memory, new Size(32, 32));

                    FLP_Resource.Controls.Add(pictureboxes[coordinate]);
                }

FLP_Resource is the FlowLayoutPanel and pictureboxes is a dictionary[Point, PictureBox] in which I store the PictureBoxes.

Since you can't choose which part of an image is assign to a PictureBox, but can only assign the whole image, I used a Graphics object to draw a certain part of the source image on a memory Bitmap (which I will later resize and use for double buffering).
I first get the desired part of the source image and then assign it to a PictureBox.
GeneralRe: How to add a ScrollBar where there is none? Pin
Xmen Real 25-Feb-09 23:47
professional Xmen Real 25-Feb-09 23:47 
GeneralRe: How to add a ScrollBar where there is none? Pin
Megidolaon26-Feb-09 2:02
Megidolaon26-Feb-09 2:02 
GeneralRe: How to add a ScrollBar where there is none? Pin
Xmen Real 26-Feb-09 2:49
professional Xmen Real 26-Feb-09 2:49 
GeneralRe: How to add a ScrollBar where there is none? [modified] Pin
Megidolaon26-Feb-09 20:49
Megidolaon26-Feb-09 20:49 
GeneralRe: How to add a ScrollBar where there is none? Pin
Xmen Real 27-Feb-09 1:37
professional Xmen Real 27-Feb-09 1:37 
GeneralRe: How to add a ScrollBar where there is none? [modified] Pin
Megidolaon1-Mar-09 20:30
Megidolaon1-Mar-09 20:30 
GeneralRe: How to add a ScrollBar where there is none? Pin
Xmen Real 2-Mar-09 5:55
professional Xmen Real 2-Mar-09 5:55 
GeneralRe: How to add a ScrollBar where there is none? Pin
Megidolaon2-Mar-09 20:24
Megidolaon2-Mar-09 20:24 
AnswerRe: How to add a ScrollBar where there is none? Pin
Megidolaon6-Mar-09 1:11
Megidolaon6-Mar-09 1:11 
QuestionHow to Loop through this Arraylist Pin
Vimalsoft(Pty) Ltd25-Feb-09 3:03
professionalVimalsoft(Pty) Ltd25-Feb-09 3:03 
AnswerRe: How to Loop through this Arraylist Pin
Colin Angus Mackay25-Feb-09 3:14
Colin Angus Mackay25-Feb-09 3:14 
GeneralRe: How to Loop through this Arraylist Pin
Vimalsoft(Pty) Ltd25-Feb-09 3:29
professionalVimalsoft(Pty) Ltd25-Feb-09 3:29 
AnswerRe: How to Loop through this Arraylist Pin
PIEBALDconsult25-Feb-09 3:54
mvePIEBALDconsult25-Feb-09 3:54 
GeneralRe: How to Loop through this Arraylist Pin
Vimalsoft(Pty) Ltd25-Feb-09 4:05
professionalVimalsoft(Pty) Ltd25-Feb-09 4:05 
GeneralRe: How to Loop through this Arraylist Pin
PIEBALDconsult25-Feb-09 6:51
mvePIEBALDconsult25-Feb-09 6:51 
QuestionChallenge manipulating combobox selectedvalue and selectedvaluechanged Pin
highjo25-Feb-09 2:44
highjo25-Feb-09 2:44 
AnswerRe: Challenge manipulating combobox selectedvalue and selectedvaluechanged Pin
Cracked-Down25-Feb-09 3:00
Cracked-Down25-Feb-09 3:00 

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.