|
Why when I deriving my own TabControl I am loosing ability to drop other controls from the toolbox on my derived tab control in design mode. Same thing if derive may PropertyPage. In MFC I was able create several dialogs in design mode than dynamicaly connect them to the PropertySheet. How to do somthing similar in C#.
Thanks
Alex.
|
|
|
|
|
Alex_Y wrote:
Why when I deriving my own TabControl I am loosing ability to drop other controls from the toolbox on my derived tab control in design mode.
Hmmm. I thought the only thing you can do with a TabControl is add TabPages. Then you can drop controls onto the TabPage.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
What if want to derive my own Pages? My question is true if deriving TabControl and/or Pages after that I can only manualy create/locate controls on the pages. Because may be I missing something. Why design mode can't handle derived classes. I could understand when control is simple like editbox on which I don't need to drop anything, but in TabControl main purpose is to hold other controls.
Thanks,
Alex.
|
|
|
|
|
Alex_Y wrote:
What if want to derive my own Pages?
Ah, ok. Then, you'd have to implement in your derived class the class and property attributes that are required to support the designer. However, I suspect you'll still run into problems because I don't know how you can tell the designer to add your tab pages and not the TabPage class. I guess that's a question for someone who knows the designer really well.
Still, it seems that if you make your MyTabPage class designer compliant and add it to the toolbox, you should be able to drop them onto the TabControl.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Also I noticed anything you drop on MyTab it became not a member of MyTab it always became a member of form which hold's MyTab.
Other issue if I create MyTab and manualy add MyPage after that in form design you can't drop on that page it is locked, but if you add another page which is not MyPage type it is no problem to drop on that default type page.
While I play with all that experiments designer was always trying to analyze content of MyTab and recreate all content one more time in the Form class. So as result I got instead of two pages which I had in MyTab but four two from Form + two from MyTab.
Thanks.
Alex
|
|
|
|
|
Hi... i am a student and i am currently working on an Address book in C#. The address book is supposed to create a fancy business card and then save it to a JPG file. The business card is created in the program within a panel with a background picture and transparent textboxes. I would like to make an option for the user to let them save the business card to a JPG file. is that possible? As mylecturers couldn`t help me about this.
Thanks
|
|
|
|
|
You mean you want to take a screenshot and not have to generate the picture yourself? Either are possible. To take a screenshot of a particular client region of a control (or even the whole control), you need to P/Invoke bitblt from gdi.dll and related functions. Read Image Capture[^] for more information, or search[^] for "bitblt" or "screenshot" here on Code Project in the appropriate categories (like "C#" and ".NET").
In .NET 2.0, a new method[^] - Control.DrawToBitmap - has been added which will make this easier (by encapsulating the functionality from above).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I would like a place holder class btween my Screen Form and Windows Form. So, I create MyBaseForm class that inherits from System.Windows.Forms.Form. Then I create MYScreenForm class that inherits from MyBaseForm. However, at design time, I am not able to see the MyScreenForm. It gives the following error:
Request for the permission to type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeytoken=.... failed.
Thus, I am not able todesign my screen visually.
Note that I can place any controls programmatically and the code compiles and runs.
Appreciate any explanations / help
|
|
|
|
|
From where is your code running? A FileIOPermission is a code access security permission class that is granted, by default, to all code run from your machine. If your code is running from the intranet or Internet, it is granted even fewer permissions.
For a good overview of Code Access Security in .NET, read Understanding .NET Code Access Security[^] here on Code Project.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
The application is not even running!
This error occurs at design time in the Visual Studio. Both classes -- MyBaseForm and MyScreenForm -- are in the same project. In the Solution explorer I click on the MyScreenForm (which inherits from MyBaseForm) to view it in design mode in order to add some controls. Instead of showing the form, this error appears.
Thanks
|
|
|
|
|
But the code is running, actually. Notice that when you try to create an inheritted form VS.NET will complain if the assembly that contains the would-be parent form is not compiled yet?
If your target location for the assembly is on a network share, for example - even if the drive is mapped - you will most like get a SecurityException because the FileIOPermission isn't granted, by default, to anything but FullTrust code which is only given, by default, to the "My Computer" zone.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks Heath,
When I wrote "It is not even running" I meant I did not even execute. Yes, it is running.
The problem I am referring to occurs at design time - not at run time. Since I am not executing the code, I thought the IO error should not have occured. However, VS IDE probably is trying to execute the MyBaseForm code so as to display the form in design mode. So, this morning I changed the security to FullTrust - for the module that contains MyBaseForm. However, when tried to view MyScreenForm in design mode, it still did not work.
Request help.
Thanks once again.
Snnn
|
|
|
|
|
Again, the code is actually executing in design mode and serializes to a source file. Depending on what yo'ure trying to do an when, Code Access Security can prevent an application from running (it verifies that an application has the necessary minimal permission set) or from performing a certain action while running (if you demand a certain permission).
Please read that CAS article I posted in my previous reply.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks Heath for your reply.
I have gone through the CAS article you had suggested. It is very informative. However, I have to still go through it a couple of times before I can digest.
The impression I got is that CAS is for stopping unauthorized user to execute the code. However, the problem I have been facing is at design time. For the problem to be easily understood, I have created a small project. I am attaching a zip file of the project. This project successfully compiles. You can execute the same. But to observe the current problem, do the following:
Open the solution in VS 2003. This contains a Test project. This contains three forms - FrmMain, CSIBaseForm, FrmUser. FrmUser inhertis from CSIBaseForm which in turn inherits from System.Windows.Forms.Form. I double click on the FrmUser form to view it in design mode. It does not show.
Could you tell me what the problem is and what I should do to overcome it?
There does not seem to be a way of attaching the zip file here. I shall send it directly to your e-mail address.
Thanks.
|
|
|
|
|
I wish to find a general method for retriving fan's properties such as speed as well as CPU temperature, how could I go about doing it?
I tried to use win32_fan but it doesn't give me back anything.
|
|
|
|
|
Please post some sample code for how you used Win32_Fan. It's also possible that your drivers don't expose data correctly for the WMI class to view. You need to be sure your motherboard drivers are installed correctly and that they even expose the data you want. If they don't, there may be no practical way of getting it, short of knowing the details specs for the fan and writing assembler to get such information.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
This is the coding I used... I work fine for other properties such as processor though.
ManagementObjectSearcher Fan = new ManagementObjectSearcher("Select * from Win32_Fan");
foreach(ManagementObject item in Fan.Get())
{
Text.WriteLine("<activecooling> {0} ",item.GetPropertyValue("ActiveCooling"));
Text.WriteLine("<description> {0} ",item.GetPropertyValue("Description"));
Text.WriteLine("<deviceid> {0} ",item.GetPropertyValue("DeviceID"));
Text.WriteLine("<name> {0} ",item.GetPropertyValue("Name"));
Text.WriteLine("<status> {0} ",item.GetPropertyValue("Status"));
Text.WriteLine("<variablespeed> {0} ",item.GetPropertyValue("VariableSpeed"));
Text.WriteLine("");
}
|
|
|
|
|
When you step through (debug) your code, do you get any results with Fan.Get() ? If not, then the problem is as I suspect: information about your CPU fan is not available.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I didn't get anything... I had tried with some other freeware program too but it didn't come up, perhaps it is like you said that the information is not available, however I had tried with several other computer and it didn't come up.... should I do programming on bios level or something like that?
Thank yah,
|
|
|
|
|
That may not help. The fan itself just may not provide any sort of metrics. I recommend you crack open the case, remove the fan carefully if necessary, and get any information off of it you can - like make, model, etc. See if you can find any hardware specs for it on the manufacturer's site before you start with low-level programming that 1) can be complicated, and 2) really isn't a job for .NET at this point. Sure, you could P/Invoke lots of APIs and define lots of structs and enums for interop, but 1) it would be specific to your fan (otherwise the Win32_Fan WMI class would probably give you what you need), and 2) may not work anyway because the fan itself doesn't provide metrics.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank a lot for your help...
Too bad that I am using a laptop and doesn't want to mess around with cracking it too much, I am really bad at assemble things back.
Thank you,
|
|
|
|
|
Ah, if it's a laptop I wouldn't recommend it. Most desktops are easy to open, often times with just the click of a button. Sorry.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have a simple Win Forms app that has a data grid on it. I have an access database with a Date/Time field in it that have values like 10/21/2004 10:32 PM. When the data is displayed in thr grid it comes out with just the date. I have tried adding a table style with the format specifier as {0:f} and {0:F} at design time and runtime with no change. I have done this same thing with SQL as the backend and have not had this problem. Has anyone else encountered this?
|
|
|
|
|
The DataGridTextBoxColumn.Format property takes a format specifier without the curly braces and without the indexer, so that you'd specify just "f" or "F". Read the documentation[^] for the property for more information.
If that doesn't work, make sure that the DataGridTableStyle.MappingName matches the DataTable
(or class name if binding against an array of types...just FYI) whether your set DataGrid.DataSource to a DataSet or a DataTable . It is far more robust, BTW, to bind a DataSet and set the DataGrid.DataMember to the table name.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks for the info. Changing the format specifier to just f do not fix it, but your suggestion for the mapping name did the trick. Thanks!
|
|
|
|