|
My apologies. It is a datatable which is part of a dataset.
|
|
|
|
|
I dont understand your question
kanchoette wrote: ...bound to a checkbox control
If there is a checkbox then what ?
kanchoette wrote: ...set the boolean to false for all other rows.
other rows...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
|
Just a suggestion, the functionality you mentioned is more of a radiobutton kind. Generally, checkbox is used to enable multiple selection and it could be misleading to use it for the usecase.
As I already said, it's just a suggestion
|
|
|
|
|
I agree that a radio button would make more sense, but I have to use a checkbox to fit in with the rest of my project. Any thoughts on how to go about it please?
|
|
|
|
|
i suggested checkbox as i think that it will automatically be handled. since,if you group a checkbox, only one can be set and others are reset automatically.
Edit - Saying that, I do not know how it will behave in databinding
|
|
|
|
|
I want to read an image and display its content in PictureBox es.
The PictureBox es get added dynamcally to a Panel (or is there a better control to keep them all together?) dpending on the image size.
The PictureBox es all have a size of 32x32 pixels.
If you ever used an rpg maker, I'm trying to make some map maker wher you can see the source image on the left side, select a tile and then edit the map on the right side with it.
I have 2 problems, first and foremost I added a ScrollBar to the control and to the Controls property of the Panel .
Obviously nothing happens when you scroll, though you are supposed to be able to scroll up and down when the source image is too large to display at once.
How can I get the ScrollBar to make the Panel display a different part of the source image, whenever you scroll?
I thought of clearing the Controls property of the Panel and always just adding the visible PictureBoxes (they all are stored in an extra collection), determining which ones are visible by Panel and PictureBox size.
Though, this would need calculations and have to be pixel-exact, if possible I dould like to avoid this and use a more elegant way.
The second problem is that I have a for loop which is repeated once for image width/32 (8 times, I intend to have a fixed width of 256 pixels) and adds a PictureBox everytime (again, 8).
The problem is that 8.5 PictureBoxes are display in width, the half PictureBox seems to be downscaled version:
http://i43.tinypic.com/snhyjc.jpg[^]
|
|
|
|
|
Megidolaon wrote: I added a ScrollBar to the control and to the Controls property of the Panel.
You dont need to put ScrollBar control in panel, just set AutoScroll Property of panel to True
Megidolaon wrote: I thought of clearing the Controls property of the Panel and always just adding the visible PictureBoxes (they all are stored in an extra collection), determining which ones are visible by Panel and PictureBox size.Though, this would need calculations and have to be pixel-exact, if possible I dould like to avoid this and use a more elegant way.
Try FlowLayoutPanel
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Thanks, the FlowLayoutPanel is exactly what I need.
Though, the second problem is there, the PictueBox es have a weird layout and weird images, what confuses me the most is that most of the tme it seems to work, but some seem corrupted.
This is the original image (256 x 2000 pixel):
http://i43.tinypic.com/10qjng4.jpg[^]
This is what the PictureBox es look like(the black lines are the PictureBox es' FixedSingle Border):
http://i42.tinypic.com/1677e44.jpg[^]
The code I use to assign the images to the PictureBox es:
g.DrawImage(resource, new Rectangle(0, 0, 32, 32),
new Rectangle(32 * i, 32 * k, 32, 32), GraphicsUnit.Pixel); Where i is the counter for the height(0-7) and k is the counter for the height (0-63).
I have 2 nested for loops, the outer one for the width and the inner one for the height.
I store the PictureBox es in a Dictionary<point,picturebox>; . I already checked but I create a new Point for ever PictureBox and the coordinates are unique.
modified on Thursday, February 26, 2009 3:48 AM
|
|
|
|
|
you mean the half gray square is the problem ? if yes then I just noticed something that this is happening after every 8th boxes...in other words its happening at the end of patterned boxes. Its hard to findout problem without seeing code...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
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 PictureBox es.
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 .
|
|
|
|
|
well I really dont understand what you want actually but I'm sure you are making this very complicated. Why you are using Dictionary. You can use List<PictureBox>.
Megidolaon wrote:
Since you can't choose which part of an image is assign to a PictureBox
what that mean ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
So that I ensure I have only 1 PictureBox for each coordinate.
In a List I could end up having with 2 PictureBox es having the same coordiantes.
Xmen wrote: what that mean ?
When you assign the Image property of a PictureBox , you can only assign the whole image, in my case that would be the whole 256x2000 pixel source image.
What I want is to split that image into 32x32 pixel tiles and assign each of these tiles to a different PictureBox , so you can click on and select each separately.
Then you can paste the 32x32 tiles and build your map with them.
|
|
|
|
|
Megidolaon wrote: So that I ensure I have only 1 PictureBox for each coordinate.In a List I could end up having with 2 PictureBoxes having the same coordiantes.
That mean you are scaring to write a little more code that will validate. Its quite simple, if you dont want to put multiple pictureboxes at same point then you can just iterate through previous pictureboxes' location. BTW I dont think you will get same point again if you try to write a good code (No need for validation)
Megidolaon wrote: When you assign the Image property of a PictureBox, you can only assign the whole image, in my case that would be the whole 256x2000 pixel source image.What I want is to split that image into 32x32 pixel tiles and assign each of these tiles to a different PictureBox, so you can click on and select each separately.Then you can paste the 32x32 tiles and build your map with them.
2000 cant be divide by 32, your image must have 2048 height if you gonna tile of 32 x 32
OoO Well, once I wrote a code similar to this but I just used a single PictureBox.
What you need to do is use the MouseClick events of PictureBox. In MouseClick, grab the cursor position, round the position to least tile position and rip it from image.
eg
Cursor Position : 35, 126
Nearest Tile Position(by rounding) : 32, 96
If you are unable to write code to round, just give a bell
An advice, do not set Image in Image property, use BackgroundImage instead, therefore you can use BackgroundImageLayout and avoid lots of hassles.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
As for the PictureBox coordinates, I program by the motto "better save than sorry".
I try to avoid even theoretically impossible situations, like slightly wrong named files (since I'm the only one that names the files), even if such a situation should never happen, I know in the rare case it does (if I forgot the guidelines I made up or whatever), the program will still work fine.
The dictionary works god, I'll just leave it lie that.
Xmen wrote: 2000 cant be divide by 32, your image must have 2048 height if you gonna tile of 32 x 32
I use the Math.Ceiling() method to add enough PictureBox es to contain images that aren't dividable by 32 and the Image property of the PictureBox es at the edges should contain the last bit of the source image.
I want to keep the source image size a bit flexible.
Xmen wrote: Cursor Position : 35, 126
Nearest Tile Position(by rounding) : 32, 96
I already used the MouseDown event to determine which PictureBox was clicked on and changed its BorderStyle .
I laos determined whichPictureBox was last clicked on and changed its BorderStyle back to None , to highlight only the one you clicked on last.
Xmen wrote: An advice, do not set Image in Image property, use BackgroundImage instead, therefore you can use BackgroundImageLayout and avoid lots of hassles.
I used
pictureboxes[coordinate].BackgroundImageLayout = ImageLayout.Tile; and tried all available ImageLayout s, with an without my own code.
All PictureBox es were white and I had a weird smear effect where the the Borders of the PictureBox es smeared about an inch on the right side of the form, outside the FlowLayoutPanel.
I got it right now, I adjusted my loops and changed a bit, the PictureBox es were all over the place, with some not even being displayed (I found that out by numbering a few), but now everything is fine.
I even painted the last PictureBox es first with the BackColor of the form (through a Pen 's Brush property) and now it looks like only the source image is displayed.
|
|
|
|
|
Since you got it work, no further answers
if you wanna check mine one, here is the link[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Thanks a lot, you helped me a great deal.
I had a problem with the FlowLayoutPanel , which kept me from displaying the PictureBox es properly, the FlowLayoutPanel overrides the actual location and changes it according to FlowLayout .
I switched to a normal Panel .
I had a problem where even when setting the AutoScroll peroptery to true, it woudn't add any scrollbars, even if I had many more PictureBox es then could be displayed at once.
However, I copypasted a Panel from a codeproject article (seemingly the same as mine) and suddenly it worked.
Now my Panel doesn't change the location and adds scrollbars that allow you to scrll arund if the amount of PictureBox es is too large to display at once.
modified on Monday, March 2, 2009 6:07 AM
|
|
|
|
|
Megidolaon wrote: which kept me from displaying the PictureBoxes properly
is it public ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
It was private and so were the Panel , I used at first and the Panel , that I use now and which works.
|
|
|
|
|
Now that it works I have a new problem.
The MouseUp event for a PictureBox gets fired the moment I click on a PictureBox .
The problem is that I'd use it allow the user to select multiple tiles while the mouse button is held down and paste them onto the map tiles, again while the mouse button is held down.
If the MouseUp event gets fired without actually releasing the mouse button, this is not possible.
Is there any way around this?
|
|
|
|
|
Good day All
i have a Following Arraylist that carries the List of Arraylist Values of String type. I want to Disable a Cell that does not match with the Values in the Arraylist.
ArrayList arr = Disable_Grid();
foreach(arr in ultraGridCycles)
{
;
}
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
You have not supplied sufficient information.
Vuyiswa Maseko wrote: I want to Disable a Cell
What cell?
Vuyiswa Maseko wrote: does not match with the Values in the Arraylist.
There are many values in the array list. Are there many values in each cell?
Do you want to hide cells where the value of the cell is not contained within the ArrayList?
Finally, are you using .NET 1.x? If not, then why are you using an ArrayList.
|
|
|
|
|
Colin Angus Macka wrote:
What cell?
A Grid is made up of Columns and Rows. Like in in Excel we have Cells in a Gridview.
Colin Angus Macka wrote:
There are many values in the array list. Are there many values in each cell?
Yes, The Grid will be Populated with Values like
1234<br />
And in the Arraylist you might Find that there is 4. Now i want to Disable the cell that is carrying the values "123"
Colin Angus Macka wrote:
Do you want to hide cells where the value of the cell is not contained within the ArrayList?
Yes
Am Using .NET 2.0
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|
How about using a HashSet instead?
(No one uses Arraylist anymore anyway.)
|
|
|
|
|
That Wouldn't be a problem. I have changed from Arraylist but not to HashSet , am using 2.0 not 3.5
Thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|
|