|
Have you looked into MSDN[^]?
Sets the application-wide default for the UseCompatibleTextRendering property defined on certain controls.
|
|
|
|
|
I've create a form with some panel with an image as background, some textbox and label.
If load it all the controlls i just mentioned appear for a second black (during the painting event) then get the right aspect, panels show their picture, textbox and label their normal shape.
Why i get this? Programs like MSN that uses customized controls doesn't show them black.
(the problem i get also for normal controls)
I've tried yet using Backbuffer true.
|
|
|
|
|
Sasuko wrote: If load it all the controlls i just mentioned appear for a second black (during the painting event)
The painting event of what? Are you handling the painting event of the Panel control yourself? Are you using a large image (in bytes) for the background of the Panel control?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
they appear so during whatever pain event, on loading, if i resize the control and i hide for a little the control then i show it back, right in this moment the control is drawed again and i show its part in back...
If i run the program i want to see it all end drawed. Is it possible?
|
|
|
|
|
You didn't answer any of my questions.
But, what I think might be happening is your background image is being painted before your controls. Since your controls are drawn AFTER the background, the background is being drawn around the controls, leaving the black area for them to paint themselves into.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have an old c#.net project, the first version of .net, that I converted to c# 2005. I would like to change the controls to xp style. They appear as xp controls in the editor but when I build it they are the old style. Thank you for any help.
Mike Deming
|
|
|
|
|
u have just to create a .manifest file ad place it in the same directory of application.
Serch google for indication how to create a file like this (you have just to copy and past the code and change a little)
Name the manifest with the same name of the application associated:
myprogram.exe.manifest
Regards
|
|
|
|
|
Use the Application.EnableVisualStyles() before calling the Application.Run() in your main function. Dont forget to set the flat style to your controls like buttons,group boxes and so.
|
|
|
|
|
Hi,
Is there any way to hide the blinking cursor?
Thanks!
Mel
|
|
|
|
|
Cursor.Hide() (See this[^])
If you are wnating to do this inside a textbox say (or any control), you can set its Cursor property in Winforms to "None".
Koushik Biswas
-- modified at 18:38 Friday 13th January, 2006
|
|
|
|
|
Ummmm...no, that hides the mouse pointer, not the blinking insertion point, what he called the "cursor".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
IIRC, no there isn't. The insertion point can't be hidden on a control that can receive keystrokes.
I could be wrong though...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
<br />
[DllImport("user32.dll")]<br />
static extern bool HideCaret(IntPtr hWnd);<br />
Hides the caret temporarily.
Remember to include:
using System.Runtime.InteropServices;
Example:
<br />
HideCaret(richTextBox1.Handle);<br />
Hope this helps
|
|
|
|
|
Ahhh! I thought there might be something I was forgetting!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
I would like to make the images concaternated and display it.
For example, I would like to put COUP images together and display them together. I can display the first image but am not able to display the second images.
How can I concaternate two images and display them together in c#?
Here is my tables:
Data table
Transactionid documenttype frontimage offset frontimage size
1934318415 CHECK 1 11264
1934318415 COUP 18433 27648
1934318415 COUP 57345 39936
The front/rear offset tell you where the image data in image table begins and the front/rear length tell you how many bytes from the offset to extract to get the image out of the Image table..
Image table
Transaction ID, Image
1934318415 <binary>
Here is the code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Data.SqlClient;
using System.IO;
using System.Drawing.Imaging;
using System.Collections.Generic;
public partial class GetImage : System.Web.UI.Page
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
_GetMultipleImages();
}
public void _GetMultipleImages ()
{
string TransactionId;
string sql;
byte[] imageBytes = null;
TransactionId = (string)this.Request.QueryString["TransactionId"];
if (TransactionId == null) return;
TransactionId = int.Parse(TransactionId).ToString();
sql = "Select Image from Image where TransactionId=" + TransactionId;
ConnectionStringSettings cnSetting =
ConfigurationManager.ConnectionStrings["AppConnectionString6"];
using (SqlConnection cn = new SqlConnection(cnSetting.ConnectionString))
{
using (SqlCommand cmd = new SqlCommand(sql, cn))
{
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader())
{
if (dr.HasRows)
{
dr.Read();
imageBytes = (byte[])dr["Image"];
}
}
}
}
if (imageBytes == null || imageBytes.Length == 0) return;
List<byte> imgBytes = new List<byte>();
using (SqlConnection cn = new SqlConnection(cnSetting.ConnectionString))
{
sql= "select FrontImageOffset, FrontImageSize,Rearimageoffset, RearImageSize from Image a join Data b on a.transactionid = b.transactionid where documenttype = 'CHECK' and b.TransactionId=" + TransactionId;
using (SqlCommand cmd = new SqlCommand(sql, cn))
{
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader())
{
if (dr.HasRows)
{
if (dr.Read())
{
long imagebytesLen = imageBytes.Length;
MemoryStream ImageStream = new MemoryStream(imageBytes);
do
{
int frontoffset = Convert.ToInt32(dr["FrontImageOffset"]) - 1;
int frontlength = Convert.ToInt32(dr["FrontImageSize"]);
int rearlength = Convert.ToInt32(dr["RearImageSize"]);
if (imagebytesLen >= (frontlength + rearlength))
{
byte[] newimage = new byte[frontlength + rearlength];
ImageStream.Seek(frontoffset, SeekOrigin.Begin);
ImageStream.Read(newimage, 0, newimage.Length);
imgBytes.AddRange(newimage);
}
} while (dr.NextResult());
ImageStream.Close();
}
}
dr.Close();
}
}
}
if (imgBytes.Count > 0)
{
Bitmap bmp = new Bitmap(new MemoryStream(imgBytes.ToArray()));
Response.ContentType = "Image/gif";
bmp.Save(Response.OutputStream, ImageFormat.Gif);
Response.End();
}
}
}
|
|
|
|
|
I want to create a multiplayer boardgame which allows players to either connect to a central server and join a game, or to host their own game and have their computer act as a private server. Security is also a high priorty for me, since I plan on creating a points system which leads to prizes, etc, so I don't want anyone to be able to cheat. So my question is: is C# the right language for this?
I've done most of my programming in C++ and Java in the past. Most of my applications have been computational or console apps, so I've never really gotten into GUI design (though I've done some basic swing and a little mfc). Likewise, I've never done anything at all with regards to network programming and setting up client/server applications.
I'm new to C# (all I know right now is from the FAQ on this forum), and it seems like what I want to use, but I'm not sure. Would you recommend it over say C++ and/or Java?
|
|
|
|
|
Dear .Net provide a hell lot easire classes for network programming and the graphics related work u want to do + you cant use Crypto Classes to encrypt ur messages to send and receive from the peers.
Dotn worry. Just Go Ahead.
Cheers,
Best Regards,
Rizwan
|
|
|
|
|
dotnetdev83 wrote: Dear .Net provide a hell lot easire classes for network programming and the graphics related work u want to do + you cant use Crypto Classes to encrypt ur messages to send and receive from the peers.
Yes, .NET provides fairly easy networking and graphics classes. But, easier than what?
What do you mean "you can't use crypto classes"? Why not? I don't have a problem with the crypto classes, unless going to or from the Compact .NET Framework because it has only a subset, so you have to work with the crypto classes available in the Compact .NET Framework if you are going to use that. Otherwise it has a good selection of classes that you can use to block encrypt or encrypt a stream.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Sorry Boss It was a typing mistake . I wanted to write you CAN use Crypto Classes. Sorry Again.
Best Regards,
|
|
|
|
|
C#/java would be faster and easier to do the implementation in, but from a security perspective both have the same weakness. The distributed programs are compiled to an intermediate format rather than machine language which is much easier to reverse engineer. IF your design is poor that could result in an easier attack path for cheaters. Provided you validate *everything* on the server (all user input is bad until proven otherwise), and don't send the user any data they can't currently see (out of sight areas of the map, private details of opponents) this shouldn't be a major issue. You should do both of these even if you're using c++, if the prizes are good enough the same cheating can be done by packet sniffing and writing a custom cheat client.
C# is my langauge of choice, but it's always a good thing to know the limitations before you begin.
|
|
|
|
|
Thanks for the advice all, I think I'm going to go ahead and write it in C#.
|
|
|
|
|
Hello Gurus I'm facing a problem that is pissing me off for hours. I have a simple serializeable class named Message1. Here is the code for it.
[Serializable]<br> public class Message1<br> {<br> private string chatMessage;<br> private bool isPrivate;<br> private string sender;<br><br> public string ChatMessage<br> {<br> get<br> {<br> return chatMessage;<br> }<br> set<br> {<br> chatMessage = value;<br> }<br> }<br><br> public bool IsPrivate<br> {<br> get<br> {<br> return isPrivate;<br> }<br> set<br> {<br> isPrivate = value;<br> }<br> }<br><br> public string Sender<br> {<br> get<br> {<br> return sender;<br> }<br> set<br> {<br> sender = value;<br> }<br> }<br> <br> public Message1()<br> {<br> } And 1 TcpListener and 1 TcpClient. I want to encrypt the message field of Message1 Class and relay it on the network after serializing an object of Message1 using BinaryFormatter. It encrypts fine and serialization is also 100% ok. When i receive it on the server end and deserialize it and decrypt the message field. it gives me some wrong string. Code for Server:
<br>listener = new TcpListener(IPAddress.Any, 9000);<br> listener.Start();<br> client = listener.AcceptTcpClient();<br> dataStream = client.GetStream();<br> msg = new Message1();<br> formatter = new BinaryFormatter();<br> msg = (Message1)formatter.Deserialize(dataStream);<br> string str = Chiper.Decrypt(msg.ChatMessage);<br> MessageBox.Show("Message : " + str + " Private : " + msg.IsPrivate.ToString() + " Sender : " + msg.Sender);<br> listener.Stop();<br>
Code for the Client:
<br> msg = new Message1();<br> msg.Sender = "Rizwan Ahmed";<br> msg.ChatMessage = Chiper.Encrypt("Hello how are you?");<br> msg.IsPrivate = true;<br> client = new TcpClient();<br> client.Connect(IPAddress.Parse("192.168.0.28"), 9000);<br> formatter = new BinaryFormatter();<br> formatter.Serialize(client.GetStream(), msg);<br> System.Threading.Thread.Sleep(1000);<br> client.Close();<br>
Output: msg.ChatMessage : SGVsbG8gaG93IGFyZSB5b3U/AAAAAAAAAAAAAAAAAAA= Please help me solving this matter I'll be really thankful to you. THanks alot in advance.
All is well without encryption or decryptionbr>Hint:Encrypted sting on the receiving end is same as the client sends after encryption but when i decrypt on the receiving end "Hello how are you?" becomes "SGVsbG8gaG93IGFyZSB5b3U/AAAAAAAAAAAAAAAAAAA=". What goes wrong on the network Please Help me. God bless you.
Rizwan
-- modified at 15:33 Friday 13th January, 2006
|
|
|
|
|
What exactly is Chiper? Custom class? Are your sure it is doing the right thing?
You should check it with something like this:
string msg = "Hello world!";
if (!msg.Equals(Chiper.Decrypt(Chiper.Encrypt(msg))))
MessageBox.Show("Chiper is not working correctly.");
Encrypt and Decrypt also seem to be static. Is there any password or something like this which is probably different on client and server side?
|
|
|
|
|
Sir Thanks alot for your interest.
I have figured out the solution. Yes Chiper is my own class all is working well. I just mistakenly converted the decrypted bytes into Base64 string as i do after Chiper.Encrypt() replacing return Convert.ToBase64String() to return Encoding.ASCII.GetString() in Chiper.Decrypt() method. It's working fine now thanks alot again.
Yeh that'sll be my help if you tell me whats the difference between Base64 string and the string one we get from Encoding.ASCII.GetString()??? and why it is needed in in the Encryption classes? Why Encoding.ASCII looses the information?? Thanks alot again Sir.
Best Regards,
Rizwan Ahmed
|
|
|
|