|
Is there any way to create a TabControl that look better than the default control in VS.Net.
As an example, I'd love to be able to use an image as the actual tab, wich could give me the flexibility to create any color, shape and form on the tabs....
Please, if you have any tips on how to do this, let me know....
|
|
|
|
|
check out these guys. http://www.dotnetmagic.com/TabControl.html . just re-write what you want... its a bit of work to factor out the other two parts of their library, but its worth it. solid code... light documentation.
|
|
|
|
|
hi!
I have a problem:
here I read the data from the ArrayList into the ListView
with a checkBox (displayCarListView.CheckBoxes = true;
)public void ShowCar(ListView objectDisplayCarListView){ListView displayCarListView;displayCarListView = objectDisplayCarListView;foreach (Car car in carArrayList){MessageBox.Show(Convert.ToString(carArrayList.IndexOf(car)));int carIndex = carArrayList.IndexOf(car);ListViewItem newItem = newListViewItem(((Car)carArrayList[carIndex]).Manufacturer);newItem.SubItems.Add(((Car)carArrayList[carIndex]).Model );displayCarListView.Items.Add(newItem);}}
now I would take this data that was checked in the ListView and put it in
an other GUI with TextBoxes
(it should the index of the car in the ArrayList must transfer also to the
other GUI (but I don´t really know how! ))
I try it so: (but without the index....thats work 100% .... but I need the
Index of the car...)
public void ChangeCar(ListView objectDisplayCarListView){ListView displayCarListView;displayCarListView = objectDisplayCarListView;Car currentCar = new Car();if (displayCarListView.CheckedItems[0].Checked){ChangeCarNow currentChangeCarNow = new ChangeCarNow(this);currentChangeCarNow.manufactoreTextBox.Text =displayCarListView.CheckedItems[0].Text;currentChangeCarNow.modelTextBox.Text =displayCarListView.CheckedItems[0].SubItems[1].Text;//here the other GUI is show......with the datacurrentChangeCarNow.Show();}}
in the GUI currentChangeCarNow(ChangeCarNow) it should be change the data of the car.
the changes data of the car I must put back exactly in the same place
where I take it out.
that's why I need the index of the car
have someone an idea how i can do this?
big thx!!
Pawel
|
|
|
|
|
I have written a C# windows application. However, when the program is running, and I want to shut down windows, every program closes except my C# program; and windows does not shut down. It just waits. When I close my program manually, windows shuts down without a problem. The cause is that I have overriden the Closing event of the main form like this:
private void WindowsCloserForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
OpenDialog(false);
}
I wanted this behaviour however: closing the form should not end the program, but just hide it. (Via an icon in the system tray you can close the program)
If I do not override the Closing event, this problem does not occur. Can this be a bug in the framework, or am I forgetting something?
Thanks!
|
|
|
|
|
Windows is just doing what you asked it to
You need to override the WndProc of the form and catch the WM_QUIT message, one of the parameters tells you what is telling the form to close; if its the user then you should continue as you do; otherwise let the program shutdown. Look up in MSDN what the values you need for WM_QUIT and what lParam and wParam are.
Almost had me stumped on this one, then I remembered I tried doing the same in an MFC program and that was what I had to do
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 hate it when I find things they have changed. VB used to have a nice event called QueryUnload, that told you why the form was closing (your code, user pressed X, windows shutting down etc.) and allowed to decide what to do.
Why does Microsoft insist on doing things? Changing the way it works I dont mind, but removing functionality altogether? Makes me angry sometimes.
</rant>
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
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
|
|
|
|