|
I looked at StringFormat but it didn't solve the problem. I could clip the string but I would rather the tab label width increase to allow for the whole string.
When I let the tab control draw itself, the tab label width is automatically set to an approproate width so that it can contain the entire label.
Is there any way for me to change the tab label size myself?
I use e.Bounds from the System.Windows.Forms.DrawItemEventArgs arg to the DrawItem function but for some reason the width is not large enough.
Does anyone have an idea as to how the tab control draws itself to allow for the whole string to be seen so that I can use similar code in my DrawItem method?
Any suggestions?
-Flack
|
|
|
|
|
The TabControl encapsulates the Tab common control, so you can P/Invoke SendMessage to send the TCM_SETITEMSIZE (0x1329) to the control (use its Handle property, which is the HWND for the control).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I would like to override the default .NET OpenFileDialog to add a text box and label, and then be able to retrieve the entered value via the properties of the overriden dialog.
Is this even possible, if so can anybody point me in the direction of any docs that could help me achieve this effect.
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Inheriate from the OpenFileDialog, and alter the visuall aperance of the windows by resizing the window and adding your controls.
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Yeah - that doesn't work. OpenFileDialog uses the OPENFILENAME struct (documented in the Platform SDK). This can accept a dialog template as a field (requires a mask). Extending this simply won't work. Any experience with native Win32 programming would tell you that, as well as knowing that most everything Windows Forms merely encapsulates native functionality, like the GetOpenFileName API that the OpenFileDialog uses. See the IL using ildasm.exe for that class and you'll see.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Forget what he told you - it won't work. The OpenFileDialog class uses the GetOpenFileName native API, which uses a OPENFILENAME struct. This can accept a dialog template, but this is a native resource and not reproducable (not without direct memory manipulation, which would require an unsafe context and experience with dialog templates) using purely managed code.
I recommend using a mixed-mode Managed C++ assembly in order to create the dialog template using the visual designer (not a Windows form - an "old school" dialog).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'am sorry for missleading you then.
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hello everyone,
how do I save and print a graphic created by GDI+, using C#?
I just want to save and print the graphic not including the form where graphic was drawn.
Thank!!!
|
|
|
|
|
This is how you save something. Lets just say the class UI is the user control that you want to save. Printing is a bit more complicated. I gotta go now, but if I come back and nobody has answered I will show you.
public class UI:System.Windows.Forms.UserControl<br />
{<br />
public void UI_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
} <br />
public event PaintEventHandler paint = new PaintEventHandler(UI_Paint);<br />
public void Save()<br />
{<br />
<br />
Bitmap b = new Bitmap(this.Width,this.Height,this.CreateGraphics());<br />
PaintEventArgs pe = new PaintEventArgs(Graphics.FromImage(b),this.ClientRectangle);<br />
paint(this,pe);<br />
b.Save("filename",System.Drawing.Imaging.ImageFormat.Jpeg);<br />
}<br />
}<br />
}
You can save it to any format you want, there are quite a few you can pull from ImageFormat.
|
|
|
|
|
I'm trying to upload very large files to an image datatype in SQL Server 2000 using a c# app. The necessary code is below:
FileStream fsFile = new FileStream(chkLstFiles.Items[x].ToString(), FileMode.Open, FileAccess.Read); <br />
Byte[] fileData = new Byte[fsFile.Length]; <br />
fsFile.Read(fileData, 0, fileData.Length);
The code works fine for 'small' files (Under 40mb), but after that it fails. The error returned is, "Insufficient system resources exist to complete the requested service." It is choking on the fsFile.Read line. If I split that out to individual lines like:
fsFile.Read(fileData, 0, 10000000); <br />
fsFile.Read(fileData, 10000001, 20000000); <br />
...
It will continue until it passes into the 40-50million reads. (That's where I get the 'Under 40mb' limit above)
Ideas, thoughts or tips? Thanks in advance!
|
|
|
|
|
No databases has been designed for this. File systems has been design for this. Save a link to the location in the record and save the file where it belongs.
|
|
|
|
|
leppie wrote:
No databases has been designed for this
Oracle can accept file this large. A database vendor I used to program systems for actually had a scheme where they'd sit their database file (multi-gigabyte) inside an oracle database and access their own datastores through the oracle database. I never tried it, but they claimed that if you tweaked Oracle just right you would get faster access to the data sitting in their datastore files, and the client's DBAs would only need to worry about backing up one database.
If you were wondering why not just use Oracle directly the answer was that one of this database vendors specialities was the concept of "long transactions" - A short transaction is one that is complete in a fraction of a second, or maybe a few minutes at the very most (SQL Server and Oracle are very good at those). A long transaction is one that can take potentially years to complete.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
When I am using Microsoft Web Browser, I want to take the data that sending by "Microsoft Web Browser". But, when I trigger the BeforeNavigate2 event successfully. I can't get the post data or headers.
private void axWebBrowser1_BeforeNavigate2(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
{
MessageBox.Show(e.postData.ToString());
}
It doesn't work. Is any body know the reason or how to solve this problem.
Thanks
|
|
|
|
|
I would like to pass a public integer variable from a C#.Net Win Form to another C#.Net Win Form within the same project. I use the get{}; set{}; acessor or a global struct (is this available in C#? Maybe only available in C++).
I am thinking that maybe I should pass by reference instead of pass by value.
There is so much difference between SDK Compiler code, and Visual Studio Win Form code, I am really kind of lost right at the moment.
|
|
|
|
|
Please don't take my response the wrong way, I am trying to help by finding out what you are trying to achieve, however your initial posting is somewhat vague.
kd7gim wrote:
I would like to pass a public integer variable from a C#.Net Win Form to another C#.Net Win Form within the same project
First off. It is really really bad practice to declare member variables in a class as public (You also mention C++ and it is bad practice there too - Remember that just because a programming language allows you to do something doesn't mean that it is a good idea to do it.). You are right to want to use the get/set property accessors.
kd7gim wrote:
am thinking that maybe I should pass by reference instead of pass by value
You don't explain why you'd want to do that, so I am going to assume that since you only mention passing from one class to another (but you didn't mention passing it back again) that this is grasping at straws. Passing by reference is somewhat similar to passing a pointer in C++.
kd7gim wrote:
There is so much difference between SDK Compiler code, and Visual Studio Win Form code
Is there?
You haven't mentioned anything about your design so I really don't know how these two classes are interacting (or supposed to interact). There are countless ways to pass an integer value from one class to another. For example, a constructor could be create that take the integer value, a setter property in the second class could accept the integer from a method in the first class, a getter in the first class could reveal the value to a method in the second class, a method call to the second class could accept the integer, the second class could have an event handler where the integer is part of the event arguments, etc. etc. etc.
Anyway, I hope you can post back with more detail as it will help greatly with finding a solution.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
I have a C# application I have already written, and I am adding a MDI Graph page. The graph page is already written, and the parent document is a C# Data Base Management System. So I do a search in the DBMS. load data onto a stack, then pass these values to my Graph page, and draw the graph.
It looks pretty slick, all I have to do is pass the data to the Graph page.
|
|
|
|
|
kd7gim wrote:
I have a C# application I have already written, and I am adding a MDI Graph page.
Okay, sounds reasonable.
kd7gim wrote:
The graph page is already written, and the parent document is a C# Data Base Management System
Document? Did you ever program with MFC? WinForms applications don't have anything equivalent to the MFC's Document/View implementation of the MVC (Model/View/Controller) pattern, so you generally have to roll your own.
kd7gim wrote:
load data onto a stack
A stack? Do you mean a System.Collections.Stack[^] object? If so, why?
If not, then remember that all object except for intrisnsic objects and other value types (like Point, DateTime, etc.) are created on the heap in C#.
In your original post, you asked about passing an integer between two classes (specifically Form classes). Now that I know one is an MDI Parent Form and one is an MDI Child Form I can show you at least one possible example:
In the parent MDI form you will have some method that needs to send data to the child MDI form. So some piece of code like:
MyGraphFormInstance.MyDataValue = someDataValue;
In the child MDI form you will have a corresponding piece of code ready to receive this data, something like:
public int MyData
{
get
{
}
set
{
}
}
Or you may like to implement the above getter as a method and send multiple items of data at the same time, or have some return value sent back to indicate some change in state. It depends on what you need to do.
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
I have worked with the get{}; set{}; passing from private to public on both ends, and using a sender and receiver. I have also worked with global structs. I believe there is a major hole in .Net Version 7. This is also what Mueller, ".Net Framework Solutions, In Search of the Lost Win32 API" claims.
It upsets me to think that I should pay a minimum of $549.00 for an upgrade so that I can get what should have been in Ver 7 in the first place. I think passing public variables has been addressed in Net 2003, as they now advertise their "Global Assembly Cache." Going that far, they are sure to have covered the more basic ground.
I am going to play with pointers, after that I am going to create another external file prototype. I will give it a .ini, or .ocx suffix, and then I will open, and read that file form my second Win Form. This provides me with the job security that a programmer so richly deserves.
|
|
|
|
|
I am at a loss as to understand what you are trying to achieve and even what you are saying.
kd7gim wrote:
I think passing public variables has been addressed in Net 2003
What do you mean by this? It certainly isn't what I think you mean because the context of the rest of your email doesn't support my interpretation of your words.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
Can one modify the icon shown in the setup wizard easily? is there a property somewhere for this that I'm missing?
--Tony Archer
"I can build it good, fast and cheap. Pick any two."
|
|
|
|
|
The one at the top? Yes. You can change this in VS.NET by opening the User Interface view with your installer project selected. Click on the form and you'll see a BannerBitmap property in the PropertyGrid. You can change it here, but it has to either be a file installed with the product, or there's a nifty little trick where you can put a bitmap in the File System Editor but mark the file as excluded (this gets compiled into the Binary table of the MSI package anyway - so a destination bitmap isn't necessary).
The problem is that you need to do this for each form. If you download and install the Windows Installer SDK (part of the Platform SDK, which is currently the Feb. 2003 edition), you can install the Orca utility. Load your compiled MSI into Orca, go to the Binary table, the double-click the second column for the DefBannerBitmap record (that's the key name). Just import a different bitmap of proportional size. This replaces the bitmap for every dialog in one shot.
If you need a better installer, I recommend either one from Wise Solutions[^] or InstallShield[^]. I have a lot of experience with both (having a been a beta-tester for Windows Installer since before 1.0) and I prefer Wise for extensibility (if you know how to modify the tables, which InstallShield added support for not until 4.0) and for cost.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you. Modifying the form's graphic will do fine for my purposes. Just didn't want it to look too crappy
--Tony Archer
"I can build it good, fast and cheap. Pick any two."
|
|
|
|
|
Hello. I've asked this in many places but nobody could help me. Let's try again.
I need to pass a custom object that has a collection (I don't mind which if it's a problem: I like the ArrayList) to a web service.
The class is defined in a DLL and the clients are Pocket PCs (Remoting can't be used).
My problems are because I have to use a modified version of my class to use with the web service. This class only exposes the properties. The main problem is that I don't find a good idea to make the List public, but then it's not accesible as the class only shows properties.
The original class can't be casted to that new class. The only thing that could save me is that I could wrap my class in any other object that can easily travel through the web service. XML or something.
Can you please help me?
|
|
|
|
|
What classes are you talking about? The client-side proxy for the web service? Some other class? And who says you can't expose your ArrayList as a public property? Take this for example:
private ArrayList list;
public IList MyList
{
get { return this.list; }
} You need to be a little more specific about your architecture. It's no wonder you can't get any help elsewhere. Remember - we don't know anything about your implementation, the what little "details" you give does not help one bit.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you for your answer. I'll try to be more specific.
I have a main class that is declared in a DLL. There are clients (Pocket PCs) that fill these objects and send them to a web service. The web service has to store these objects (in a Hashtable for instance) temporarily because the clients will access the objects later.
The problems:
- The web service has some web methods that receive and return my objects, but the proxy creates a ligth class with only the properties (not the methods). This class is incompatible with my original class, so I have to use this new class in my clients to use the web methods. The first problem with this is that the clients can't use the DLL; instead they'll use the modified class.
- I did some tests and it works with basic classes (with basic types as strings as attributes) but my original class has an ArrayList. In the modified class, the ArrayList is converted to Object[] and worst, I have to expose directly the ArrayList (well, the Object[]), instead of using methods, so the clients are more complex and I can't change the structure without modifying the clients.
My question:
- Is there any way to wrap the original class and send all to the web service(any kind of XML structure), so I can work in the clients with the original objects and send them directly to the web service?
If not, is my design wrong? I can't use Remoting as Compact Framework does not support it.
Regards,
Diego F.
|
|
|
|