|
Just to keep this simple...
I want to draw a circle in my about box that writes over all the text, bitmaps, etc.
So, I override OnPaint and do a ...
e.Graphics.DrawEllipse( Pens.Black, 0, 0, 500, 500 );
... but the circle is more of a background graphic and the text gets written over it. I've also overrode the OnPaint method to get the same results.
Sure I can set transparency on text, but I want this circle to overwrite anything in it's way... toolbars, status bars, etc.
Any thoughts??!
|
|
|
|
|
I am creating a very simple console application to read a portion of the registry into a class object called TrxRegistry under a TrxRegistry namespace. The registry access is working with no problems using hardcoded strings. I've now added a resource file called TrxRegistry.resx where I've associated the names of the registry values with descriptive names. The program compiles with no errors, but when I run it, I'm getting a resource exception.
I create a Resource Manager:
ResourceManager rm = new ResourceManager("TrxRegistry",this.GetType().Assembly);
and then access it by opening the registry key (which is defined in the resource file):
RegistryKey key = Registry.LocalMachine.OpenSubKey(rm.GetString("TRXKEY"));
I get this exception:
Could not find any resources appropriate for the specified culture (or the neutral Culture) in the given assembly. Make sure "TrxRegistry.resources" was correctly embedded or linked into assembly "TrxRegistry".
baseName: TrxRegistry locationInfo: <null> resource file name: TrxRegistry.resources assembly: TrxRegistry, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The Build Action property for the TrxRegistry.resx resource file is set to Embedded Resource.
I didn't think I had to do anything for an embedded resource file. I thought you only had to use a command line assembly program for multiple language DLLs.
Does anyone have an idea what might be wrong?
Thanks in advance!
Derek
|
|
|
|
|
Instead of calling the constructor where you pass in the root namespace (which I think is telling it to look for culture specific resources) what happens if you call the constructor that gets its information from a type (ala Windows Forms) new ResourceManager(typeof(TrxRegistry));
Just a shot in the dark
James
Simplicity Rules!
|
|
|
|
|
I just tried your solution and it works! I figured out that I wasn't including the namespace when creating the Resource Manager:
Before:
ResourceManager rm = new ResourceManager("TrxRegistry",this.GetType().Assembly);
After:
ResourceManager rm = new ResourceManager("TrxRegistry.TrxRegistry",this.GetType().Assembly);
I like your code much better - no strings and less typing!
Thanks!
Derek
|
|
|
|
|
Cool
I think your method will need to be used if you want to use culture-specific resources; if you want .NET to automagically load them for you anyway.
James
Simplicity Rules!
|
|
|
|
|
How can I create form inside second ? I dont see anything such Create(HWND hParent)
In MFC e.g.:
CDialog dlg;
dlg.Create(IDC_DIALOG1,this);
dlg.ShowWindow();
I think programing using MFC or/and API is more logical than C#.
Wiizi
|
|
|
|
|
|
no, only create form inside second. e.g. you have treectrl and when you select item -> show form with setting ....
Wiizi
|
|
|
|
|
Will this work
In the event handler for the tree control
public /* some tree event handler*/
{
Form2 form2 = new form2();
form2.Show(); // or form2.ShowDialog() - for modeless
}
Form2 is the class you created for the second form? I might be missing something here so let me know.
|
|
|
|
|
ok...and how can i dock it into parent form ?
Wiizi
|
|
|
|
|
Ahh, so you want to dock it in the parent sort of like the netscape preferences dialog. If that's the case take a look at the following on CP
http://www.codeproject.com/cs/miscctrl/propertytree.asp
I think this is probably what your looking for. If not, let me know.
|
|
|
|
|
dlg.Parent = this;
or
this.Controls.Add(dlg);
James
Simplicity Rules!
|
|
|
|
|
I believe you will find that both of these solutions will throw an exception when the child is a Form derived object, or more specifically any top level control.
|
|
|
|
|
Yes ... it throw
Wiizi
|
|
|
|
|
See this post for the fix. If you don't want the user to be able to move the window, then set the FormBorderStyle to FormBorderStyle.None;
James
Simplicity Rules!
|
|
|
|
|
Oops, forgot you had to do this first
dlg.TopLevel = false;
James
Simplicity Rules!
|
|
|
|
|
I like...
|
|
|
|
|
I create a class now I want to access to my form from this class.So how can I access to the main form in C#?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
um... you could try...
ApplicationContext.MainForm
|
|
|
|
|
Thanks Andy,I'll check it.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
I have this program in which I'm adding TraceSwitches to various subsystems. I got it working fine in one subsystem - so I went ahead and added it to other subsystems. When I try to enable with other switched using my config file - the original switch now throws an XML exception (at the first call to WriteLineIf(), not when newing the TraceSwitch ).
Here are my config files:
The one that works:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="FirstSwitch" value="4" />
</switches>
</system.diagnostics>
</configuration>
The one that blows up:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="FirstSwitch" value="4" />
<add name="SecondSwitch" value="4" />
<add name="ThirdSwitch" value="4" />
</switches>
</system.diagnostics>
</configuration>
Any ideas what's wrong with the syntax or how to enable multiple switches with a config file?
Thanks
Dale Thompson
|
|
|
|
|
Hi All,
I am trying to view some Reports online through my Internet site.
I am using C# on a Windows 2000 server running IIS5.
I have looked around the internet and found some examples but they are not working. I have the following at the moment.
<cr:CrystalReportViewer
id=CrystalReportViewer1
style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 6px"
runat="server"
ReportSource='<%# "C:\Inetpub\wwwroot\Outbreak\Reports\test.rpt" %>'
Height="1133px"
Width="1030px">
</cr:CrystalReportViewer>
In design view I cn now see my report, but when I compile and view my page I get
CS1009: Unrecognized escape sequence
????
Can someone let me know where I am going wrong and how to sort this out.
Thanks,
Gavin
|
|
|
|
|
it's the back slashes in your ReportSource string.
why do you have it as a server side string???
change it to:
ReportSource='C:\Inetpub\wwwroot\Outbreak\Reports\test.rpt'
|
|
|
|
|
It was set as a server side string because that is how the Crystal Report Viewer set it itself.
What I did was I dragged the CrystalReportViewer off the toolbox and dropped it onto my form.
I then selected it and in the properties window click on the ... next to databindings.
I then went into the ReportSource and put in the exact Source and clicked ok and it did the rest ...
I changed it as you suggested and am now getting the following error.
Cannot create an object of type 'System.Object' from its string representation 'C:\Inetpub\wwwroot\Outbreak\Reports\test.rpt' for the 'ReportSource' property
I'm sure this is meant to be a lot simpler than it has turned out to be?
Thanks for the help
|
|
|
|
|
ok, so try this:
ReportSource='<%# "C:\\Inetpub\\wwwroot\\Outbreak\\Reports\\test.rpt" %>'
or:
ReportSource='<%# @"C:\Inetpub\wwwroot\Outbreak\Reports\test.rpt" %>'
|
|
|
|