|
Why should it be a bug? It's doing what it should. The client area is correct. You just need to account for the DockPadding on your control which derives from ScrollableControl (Panel , UserControl , et. al.).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
We have a fairly large project which is a WinForm project.
After working on this project after awhile we began to hit a nasty situation where Intellisense lost it's intelligence, code lost its' color coding, and the Intellisense popup boxes did not display the objects namespace. At its worse, Intellisense, automatic formatting, and all color-coding completely failed. It left us with having to code blindly and hoping the code would compile correctly.
The bigger bugger of it all is that it seemed to happen eratically after working in the IDE for hours-on-end doing continuous change/build/debug cycles with no regular, re-creatable scenarios. We usually had to reboot to try and fix it.
Last week we finally nailed the bugger, reproed it on an un-managed machine and on an MS-built machine which led to the discovery of the cause. Talk about oblique:
If you are building a WinForm application
AND you are adding third party controls
AND the third party controls update the license.licx file
There is a known bug that VS will randomly append an additional
blank line to the end of the file. When this happens, it will
lead to Intellisense going brain dead!!! This will not be fixed
until Widbey.
Workaround: open your license file and delete the extra line.
___________________
Forgoing antagonism and separation, one enters into the harmonious oneness of all things. Lao Tzu
|
|
|
|
|
Interesting. I've had that problem many times in the past, too. Fortunately, we don't often prompt changes to third-party controls (they're pretty much set in place now), but I usually just restarted the IDE and called it good. It is interesting to know "why" (well, the cause anyway) it happened.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
It was a bugger to locate. We pretty much determined that if you add third party controls and this bug occurs, it could be quite a while before you encounter the problem. But all you need to do is add a new form to the existing project (even if it only uses built-in controls) and you are screwed and tattooed.
___________________
Forgoing antagonism and separation, one enters into the harmonious oneness of all things. Lao Tzu
|
|
|
|
|
You should have searched Google Groups because we had the exact same problem this summer and we spent quite some time to figure it out (nobody else figured it out before us according to the newsgroups)...
We decided to post the solution there "for the record"... Next time, spare yourself some sweat and http://groups.google.com
|
|
|
|
|
Yes, well, we were working with onsite Microsoft people. I had mission critical apps to work on and left all of the problem resolution to them. And while I use Google extensively for all types of searches, I usually do not do any searching of Google Groups.
___________________
Forgoing antagonism and separation, one enters into the harmonious oneness of all things. Lao Tzu
|
|
|
|
|
Google Groups is your friend! I search it more often than the web when I have problems!
|
|
|
|
|
Hi,
I’m new to C# and the .NET world. Can anyone tell me how to create a master project populated with sub projects? Ideally I’d like to have my master project depend upon a couple sub projects (like a common library, user info, and database info). How can I create this structure in .NET? Once this structure is created, how do I add project dependencies?
If anyone can show me an example of this that would be great.
Thanks
|
|
|
|
|
If we're talking VS.NET, you should create a Solution to hold all these Projects. If you don't have a Solution open when you create a new project, VS.NET will create one for you.
When you select File > New > Project, the New Project dialog has a pair of radio buttons Add to Solution and Close Solution. Select Add to Solution to keep this project as part of the whole solution. If you have a project you want to add to an existing solution, choose File > Add Project > Existing Project.
To set up dependencies, use the Projects tab of the Add Reference dialog, rather than the .NET tab.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
To add to what Mike said, the reason you use Project references is because it automatically sets up build dependencies and uses the latest version of the dependent assemblies.
Also, in larger, multi-project solutions, DO NOT use automatic versioning (i.e., set AssemblyVersionAttribute so that it doesn't use an asterisk (*)). You can quickly loose control with versions being different, especially when multiple developers are working on the solution.
In .NET, version numbers matter. If you binding against assembly A, version 1.0.0.0, then when assembly B (has a dependency on A) loads, assembly A, version 1.0.0.0 better be there. You can use the .config file and the <assemblyBinding> section to redirect these versions or use a publisher policy (a specially named assembly that goes into the GAC), which is primarily for upgrading your application (so long as backward compatibility is maintained). You certainly don't want to have to worry about this when developing.
If you want to use automatic versioning, expect problems. You can get around them, however. Lets say that each developer has an application test directory (or even a shared one). Using the assembly A as a dependency of assembly B example (lets say B is a .exe), you could use a .config in the same directory as B.exe like this:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="A" publicKeyToken="0123456789abcdef"
culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535"
newVersion="1.0.1556.500"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> This will redirect the assembly binding from whatever version it is to version 1.0.1556.500, so make sure you update those config files when you drop a new version of assembly A in the app directory.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want add KeyUp event to columnStyle
How can I do that pls ?
thanx ..
|
|
|
|
|
columnStyle? Are you talking about the DataGridColumnStyle?
The DGColumnStyle class does not handle keyboard events since it never actually gets the input focus. These are handled by the DataGrid itself. What were you looking to do with KeyUp?
RageInTheMachine9532
|
|
|
|
|
thanx
yes I m talking about DataGridColumnStyle
this code is usefull to add KeyDown event
DataGridTextBoxColumn _datagridtextBox = (DataGridTextBoxColumn) CorpEc.TableStyles[0].GridColumnStyles[0];
_datagridtextBox.TextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(ID_KeyDown);
but I don't know why it doesn't work for kewUp
thanx
|
|
|
|
|
Hey
I have made an client that takes contact with the servern and verifie the user name and password, after this its loging in to the game.
I want to have an animation during contacting server on the front login form, tu it will not load in the gif animation?
I got one button ("LOGIN") this button is makeing a new connection
connection = new Connection(this,txtLoggInName.Text,txtLoggInPass.Text,txtLoggInIp.Text,txtLoggInPort.Text,b.Text);
in the connection contructer it uses this code
public Connection(Client newClient,string name,string pass,string ip,string port,string query)
{
try
{
client = newClient;
if(name==string.Empty)throw new System.FormatException("Username not supplied");
if(pass==string.Empty)throw new System.FormatException("Password not supplied");
name = username(name);
string strHost = string.Empty;
IPHostEntry IPHost = Dns.GetHostByName(strHost);
IPAddress[] IPAdr = IPHost.AddressList;
socket = new TcpClient(ip,Int32.Parse(port));
user = new Transfer.User(name,IPAdr[0].ToString());
password = new Transfer.Password(pass);
switch(query.ToLower())
{
case "login":
request = new Transfer.Database(Transfer.Database.Request.LOGIN);
break;
case "new player":
request = new Transfer.Database(Transfer.Database.Request.CREATE);
break;
}
running = true;
}
catch...........................
I have tried to load the gif picture, first of al in the login button that makes a new connection later on.
But it will not load it, the same is if i load in text to a label it will not load the text, i must just .refresh(); on the control then it draws the picture and set the text in the label. But it will not animate the Gif animation, it only shows the first pictur.
I have tried to start a high priority thread that shows picture after picture in a loop with .refresh() after every picture but this will not paint a singel frame even. this thread i starts in the begining of the login button and then starts before creating the new connection.
I have also tired to load in the gif animation before i hit the login button, and then the animation is playd as i shold, but as soon as i hit the login the animation stops.
Is there any way to fix this problem? it simes like the connection takes al the programs power.
//Snowman
|
|
|
|
|
It seems you're trying to set the image (or the text in a Label ) in a separate thread. You can't do this. You must set any properties that would change the UI in the thread in which the particular UI element was created. See Control.InvokeRequired and Control.Invoke for how to do this. You basically create a delegate to set the text or image or whatever and have the control invoke that delegate in its UI thread.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yes but if we dont use threads at al, and just use the buttons funktion.
If we press the button we first of al load the gif animation in to the label och picturebox, then we goes on to creat the new connection.
And if i do this the Gif animation will not run at all, it will not even be loaded though it is set first in the button funktion and the connection creation is not until later in the button funktion.
If i whant it to load i have to use contrl.refresh(); and then it loads it, but jus the first frame int the gif.
//Snowman
|
|
|
|
|
Create your connection asynchronously. I'm not sure if the PictureBox animates a GIF in the same UI thread, but if it does it will most likely be lower in priority than the main execution of your code.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I am having trouble using OR in an If loop. I have
if (cboCeaseType.SelectedValue.ToString () == "2") or (cboCeaseType.SelectedValue.ToString () == "5" ){
do something
} else {
do something else
}
It doesn't like this. How do I have an OR in an If loop? What should the above be?
Cheers
Ian
|
|
|
|
|
You need to enclose the whole in brackets and the OR operator in C# is ||
(If you're curious the AND operator is &&)
Your code should look like this:
if ((cboCeaseType.SelectedValue.ToString () == "2") ||(cboCeaseType.SelectedValue.ToString () == "5" ))
I've underlined the changes.
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
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
Brillint, thanks for your quick responce. Saved me hours!
Ian
|
|
|
|
|
Also, you only need one set of brackets:
<br />
if (<br />
cboCeaseType.SelectedValue.ToString() == "2" || <br />
cboCeaseType.SelectedValue.ToString() == "5")<br />
The extra brackets are unnecessary (but won't do any harm).
|
|
|
|
|
*slap on the wrist*
It's about readability, my good man! Seperating those two conditionals with their own set of parens makes it clearer what is being compared.
Jeremy Kimball
Moderation is for monks. -Lazarus Long
And this, too, shall pass away...
|
|
|
|
|
Hi,
I would like to generate rtf code of the picture/image programatically without using richtext box or clip board.
To be more specific I want to create .rtf file of image/pictures ?
Need help in above regard......
Thanx in advance..
Regards,
Jay
|
|
|
|
|
In the RTF specification, pictures can be encoded using hexidecimal or binary encoding. If you use binary (hexidecimal is more common), do not use CR/LF pairs to break lines (as is usual with binary files).
Getting the hexidecimal value of bytes isn't hard. Just loop through the bytes and output base16 char sequences:
Image img = new Bitmap("myimage.bmp");
MemoryStream ms = new MemoryStream();
img.Save(ms);
ms.Seek(0, SeekOrigin.Begin);
StringBuilder sb = new StringBuilder(ms.Length * 2);
byte[] buffer = new byte[4096];
int read = ms.Read(buffer, 0, buffer.Length);
while (read != 0)
{
for (int i=0; i<read; i++) sb.AppendFormat("{0:x2}", buffer[i]);
read = ms.Read(buffer, 0, buffer.Length);
}
string hex = sb.ToString(); It's not exactly the most efficient, but you should get the idea.
There are several sections require to embed a pictures in RTF. Read more about embedding pictures in the RTF specification at http://msdn.microsoft.com/library/en-us/dnrtfspec/html/rtfspec_16.asp?FRAME=true#rtfspec_24[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Steward,
Thanks a lot for the solution.
I have modified the code since there was some compilation error as below
<br />
string strfileName = "PicInHex.rtf";<br />
FileStream MyStream = new FileStream("c:\\" + strfileName, FileMode.Create);<br />
System.IO.StreamWriter MyWriter =<br />
new System.IO.StreamWrite(MyStream,System.Text.Encoding.Default);<br />
<br />
Image img = new Bitmap("myimage.bmp");<br />
MemoryStream ms = new MemoryStream();<br />
img.Save(ms,System.Drawing.Imaging.ImageFormat.Bmp);<br />
ms.Seek(0, SeekOrigin.Begin);<br />
StringBuilder sb = new StringBuilder(Convert.ToInt32(ms.Length * 2));<br />
byte[] buffer = new byte[4096];<br />
int read = ms.Read(buffer, 0, buffer.Length);<br />
while (read != 0){ <br />
for (int i=0; i<<read; i++)<br />
sb.AppendFormat("{0:x2}", buffer[i]); <br />
read = ms.Read(buffer, 0, buffer.Length);<br />
}<br />
string hex = sb.ToString();<br />
MyWriter.Write(hex);<br />
<br />
MyWriter.Close();<br />
MyStream.Close();<br />
I want to get the hex code of the image using the above code then prefix and suffix image rtf syntax in it to get rtf code file
when I try to open the "PicInHex.rtf" (created after executing the above code)using notepad to view the hex code. the NotePad application crashes.
Will you please commnet whether
1. can I open and view the code using notepad (the bmp is of A4 size)
2. Am I correct in approaching the solution?
Let me thank you once again for your co-operation and solution.
Regards,
Jay.
|
|
|
|
|