|
I use this code to create DataGrid at runtime but when I call this function nothing appeare on the form.
DataGrid filtergrid=new DataGrid();
filtergrid.Top=300;
filtergrid.Height=100;
filtergrid.Width=280;
filtergrid.Left=0;
filtergrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
filtergrid.Visible=true;
filtergrid.Show();
filtergrid.DataSource= myDataView.Table;
What I miss here?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
You need to add the control to its parent's Controls collection.
In WinForms and ASP.NET this.Controls.Add( filtergrid ); assuming this is the form or page class that the grid will be added to.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
I need to use ActiveX Document in my application. But I want to use C#. Can I do that?
Thank in advance.
8-)
|
|
|
|
|
Yes, you should be able to.
I assume an ActiveX Document is just a COM object with some standard interfaces implemented.
You can use COM interop to expose your C# class as a COM object, however clients will need the .NET framework installed in order to use your "COM" object.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Hi,
why does this code produce a rectangle 6x6 (seen by zooming on a screen capture) ?
Pen pen = new Pen(Color.FromArgb(255,0,0),1);
pen.Alignment = PenAlignment.Inset; // Same with center
graphics.DrawRectangle(pen,10,10,5,5);
It gives :
******
*====*
*====*
*====*
*====*
******
(* means a red pixel, = means a background pixel)
If I give a width of 2, then the red rectangle is correctly drawn in a 5x5 pixels rectangle.
Thanks
Nicolas
|
|
|
|
|
Charles Petzold pointed this out in his Programming Microsoft Windows with C# book so I assume it is a known issue.
I don't think anything will be done about it though because to change it would break a lot of code at the source level (side by side versioning protects already built binaries but alas, it doesn't protect source level breaking).
I'm not sure why a pen with width of 2 would change that, unless the alignment is what is causing it.
BTW if you want a red pen of width 1 you could just use Pen pen = Pens.Red;
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Thanks a lot for the useful information.
I find incredible that such a bug exists and it won't be corrected.
Nicolas
|
|
|
|
|
I want to type cast the text in text box to integer?
Another guestion is that how to set text box tht the user can only type numbers
into it?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Mazdak wrote:
I want to type cast the text in text box to integer?
Int32.Parse(myString); if it throws an exception the string wasn't an integer
Mazdak wrote:
Another guestion is that how to set text box tht the user can only type numbers
into it?
Quick solution is to look for and use the masked edit C# control here on CP; secondary solution is to take the code it uses (the Key* events) and handle those the same way.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
Thank you friend
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I want to create a Report using GDI+ and Drawing with C#, fot that part i'm ok but How can I print this report and how make a printpreview of it ???
Please give me the answer if you have if
Thanks
BLaZiNiX
|
|
|
|
|
Use PrintPreviewcontrol in form edoitor.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Yes that I know, bu what I don't know it's how print a Window Form, check what I want to do :
Create a Window Form to add a rapport I will make using Graphics. I want to make a Print Preview of this and also I want To PRINT the FORM(al the graphics I created) ??
Thanks
BLaZiNiX
|
|
|
|
|
ok,I have very very simple example of print and print preview application.You can send me your email to send it for you.Maybe it helps you. Of course it helps you if you have never use printing in your C# apllications.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
jonathan.pouliot@tecksys.com
Thanks a lot boss
BlaZiNiX
|
|
|
|
|
I have a problem.
I have a Mouse-down handler for a list box.
The problem is that the list box's selected item wont change till my handler has exited.
Lets say the list box contains two items
----------
|apple |
|orange | <- selected
----------
Now if I click on apple and do a :-
MessageBox.Show(listbox.SelectedItem.ToString())
I still get orange. Next time I click I get apple.
What happens is that my handler gets called and only afterwards does the real handler gets called which changes the selected item index.
Now how do call the default handler
something like calling the base class handler
Regards
Nish
Oh, I don't know why she's
leaving, or where she's gonna go
I guess she's got her reasons but I just don't wanna know
'Cos for 24 years I've been living next door to Alice
24 years just waitin' for a chance
To tell her how I feel and maybe get a second glance
Now I gotta get used to not living next door to Alice
|
|
|
|
|
Why are you using MouseDown? Why not just use click? The problem with MouseDown is that a "click" hasnt happened until the mouse has been released, ie, MouseUp.
To illustrate, if you hold your mouse down on a list box and move the mouse up and down, the selection will change. Thus lifting the mousebutton "locks in" the item that is selected.
Having said all of that, there may in fact be a way, i havent tried :p
--
David Wengier
TAC ad gone wrong: "Don't fool yourself, you're a bloody idiot."
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
I need to use MouseDown as I am doing some drag/drop stuff
Nish
Oh, I don't know why she's
leaving, or where she's gonna go
I guess she's got her reasons but I just don't wanna know
'Cos for 24 years I've been living next door to Alice
24 years just waitin' for a chance
To tell her how I feel and maybe get a second glance
Now I gotta get used to not living next door to Alice
|
|
|
|
|
You could always just use a simple hit-test to find out the item under the cursor. Assuming all of the items are the same height (ie, not OwnerDrawVariable) you could use :
private void listBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
int iItem = (e.Y / listBox1.ItemHeight) + listBox1.TopIndex;
if (iItem > listBox1.Items.Count - 1)
{
lblCount.Text = "none";
}
else
{
lblCount.Text = listBox1.Items[iItem].ToString();
}
}
--
David Wengier
TAC ad gone wrong: "Don't fool yourself, you're a bloody idiot."
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Thanks David
But James Johnson suggested another solution to me :-
IndexFromPoint
Nish
Oh, I don't know why she's
leaving, or where she's gonna go
I guess she's got her reasons but I just don't wanna know
'Cos for 24 years I've been living next door to Alice
24 years just waitin' for a chance
To tell her how I feel and maybe get a second glance
Now I gotta get used to not living next door to Alice
|
|
|
|
|
Nish [BusterBoy] wrote:
IndexFromPoint
ROFL... that exists? Thats about my luck these days
--
David Wengier
TAC ad gone wrong: "Don't fool yourself, you're a bloody idiot."
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
David Wengier wrote:
ROFL... that exists? Thats about my luck these days
Nish
Oh, I don't know why she's
leaving, or where she's gonna go
I guess she's got her reasons but I just don't wanna know
'Cos for 24 years I've been living next door to Alice
24 years just waitin' for a chance
To tell her how I feel and maybe get a second glance
Now I gotta get used to not living next door to Alice
|
|
|
|
|
When I unhandled error thrown,it shown me error message,Is there any document to tell me how to fix this error?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
You can lookup what the exception is and what threw it to track down the offending code.
If you don't have the documentation locally it is available online @ MSDN.
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
How do you implement control arrays in C#?
|
|
|
|