Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

see_seA

@see_seA
About
Posts
14
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Glass on MDI container
    S see_seA

    See here[^] for the answer.

    C# docker help question

  • Aero glass extened on an mdi parent
    S see_seA

    Anyone ever tried to get additional areas of glass on an mdi form?

    Windows Forms docker tutorial question

  • Aero glass extened on an mdi parent
    S see_seA

    I have managed to make use of the DwmExtendFrameIntoClientArea in Vista/7 to extend the glass effect into a form. However I cannot get this to happen on a form which is set as an mdi container. The glass portion just doesn't draw any more - it appears white. Note I'm not talking about the children inside the mdi parent, but on the actual main form itself. Does anyone have any suggestions on how to get this working?

    Windows Forms docker tutorial question

  • Glass on MDI container
    S see_seA

    I can very easily extend the glass area of a normal form by calling the DwmExtendFrameIntoClientArea method. However I now have a requirement in which I need an MDI container/parent to have glass extended into the form. If the IsMdiContainer property is set to true, the part that is meant to be glass is white. Anybody have any experience with this issue?

    C# docker help question

  • Firefox-like Download listbox
    S see_seA

    Has any one created a Listbox type control similar to the one that is found in the Firefox Download screen? Or something similar? I'd really appreciate the help!

    C# help question

  • Packet issues
    S see_seA

    Hmmm. I increased the buffer size from 1024 to 4096 and everything seems to work perfectly now.

    C# com data-structures

  • Packet issues
    S see_seA

    Packets are lost due to this under high load. I'm out of ideas.

    C# com data-structures

  • Packet issues
    S see_seA

    Problem seems to be here. Not sure I understand why...

                if (nameLen > 0)
                    strName = Encoding.UTF8.GetString(data, 12, nameLen);
                else
                    strName = null;
    
    C# com data-structures

  • Packet issues
    S see_seA

    As far as I can tell, I get the error after executing the following commands: In the OnAccept method..

                byte\[\] bufData = new byte\[1024\];
                clientSocket.BeginReceive(bufData, 0, bufData.Length, SocketFlags.None, new AsyncCallback(OnReceive),
                                          new object\[\] {clientSocket, bufData});
    

    In the OnReceive method..

    Socket clientSocket = null;
    Data msgReceived = null;
    byte[] bufData = new byte[1024];
    bool bypass = false;
    ClientInfo cInfo = null;

            try
            {
                bool blInvalidClient = false;
    
                try
                {
                    object\[\] oData = (object\[\]) ar.AsyncState;
                    clientSocket = (Socket) oData\[0\];
                    bufData = (byte\[\]) oData\[1\];
                    clientSocket.EndReceive(ar);
    
                    //Console.WriteLine(clientList.Count);
                }
                catch (SocketException)
                {
                    blInvalidClient = true;
                }
    
                if (!blInvalidClient)
                {
                    //Transform the array of bytes received from the user into an
                    //intelligent form of object Data
                    msgReceived = Packet.PacketReceived(bufData);
    

    ...

    The Packet.PacketReceived method returns new Data(bufData). I've added traces in that constructor and there is something incorrect happening. All clients that communicate use the same Data class to convert the info into a byte[] so it's not as if I'm sending an arb string of bytes to the socket. But the weird thing is that this only ever happens when I sent lots of packets to the socket at once.

    C# com data-structures

  • Transparency On Parent Form .
    S see_seA

    Forms do weird things when you make them transparent from my experiences.

    C# question

  • Packet issues
    S see_seA

    I've highly modified the code found here http://www.codeproject.com/KB/IP/ChatAsynchTCPSockets.aspx. When creating a packet, I give the following class the info it needs onto which is converts it into a byte[] and visa versa which can then be sent and received by a socket respectively.

    public class Data
    {
        //Default constructor
        public Command cmdCommand; //Command type (login, logout, send message, etcetera)
        public string strMessage; //Message text
        public string strName; //Name by which the client logs into the room
    
        public Data()
        {
            cmdCommand = Command.Null;
            strMessage = null;
            strName = null;
        }
    
        //Converts the bytes into an object of type Data
        public Data(byte\[\] data)
        {
            //The first four bytes are for the Command
            cmdCommand = (Command)BitConverter.ToInt32(data, 0);
    
            //The next four store the length of the name
            int nameLen = BitConverter.ToInt32(data, 4);
    
            //The next four store the length of the message
            int msgLen = BitConverter.ToInt32(data, 8);
    
            //This check makes sure that strName has been passed in the array of bytes
            if (nameLen > 0)
                strName = Encoding.UTF8.GetString(data, 12, nameLen);
            else
                strName = null;
    
            //This checks for a null message field
            if (msgLen > 0)
                strMessage = Encoding.UTF8.GetString(data, 12 + nameLen, msgLen);
            else
                strMessage = null;
        }
    
        //Converts the Data structure into an array of bytes
        public byte\[\] ToByte()
        {
            List result = new List();
    
            //First four are for the Command
            result.AddRange(BitConverter.GetBytes((int)cmdCommand));
    
            //Add the length of the name
            if (strName != null)
                result.AddRange(BitConverter.GetBytes(strName.Length));
            else
                result.AddRange(BitConverter.GetBytes(0));
    
            //Length of the message
            if (strMessage != null)
                result.AddRange(BitConverter.GetBytes(Encoding.UTF8.GetByteCount(strMessage)));
            else
                result.AddRange(BitConverter.GetBytes(0));
    
            //Add the name
            if (strName !=
    
    C# com data-structures

  • Splash Screen Form
    S see_seA

    I've tried that. My problem is making the form's background disappear. I cannot get rid of the grey square (default form background color). So to do that I override the paintbackground method but that then draws black wherever the transparency is meant to be. Whether double buffered or not. It definitely draws black in the transparency when changing Opacity :/

    C# graphics business tutorial

  • Ctrl+S Implemention
    S see_seA
       private void form\_KeyDown(object sender, KeyEventArgs e)
        {
            // shortcuts
            if (e.Control && e.KeyCode == Keys.S)
                // do action
    
    C#

  • Splash Screen Form
    S see_seA

    I'm trying to make a splash screen with the following requirements: 1) Must fade in and fade out (issues) 2) Fades in before main program form is open and fades out once it is (done this) 3) Displays an image which is not squash and has transparency (issues) So I've looked on the net and I'm still struggling with some aspects if anyone can assist. Fading the form is trivial (by setting the Opacity), however getting a form to be transparent (to work with the pictures transparency) and then fading that in and out is a mess. I have tried numerous methods, such as overriding OnPaintBackground, changing the style of a form to allow a transparent background and a few other things. The problems I hit are: - When fading the transparent form, by changing the Opacity the transparent bits turn black - When the splash screen first shows it paints properly, but when the main form is finally loaded the transparent bits of the splash screen still show what was there before the form loaded (i.e. not repainting or something). At the moment some of the code I have looks like this:

        protected override void OnPaint(PaintEventArgs e)
        {
            // Do nothing here!
        }
    
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            Console.WriteLine("paintBackground");
            Graphics gfx = e.Graphics;
            gfx.DrawImage(global::DesktopLiveDotNet.Properties.Resources.splash\_screen, new Rectangle(0, 0, Width, Height));
        }
    

    But when it starts to fade the transparency turns black:

        private void timer1\_Tick(object sender, EventArgs e)
        {
            Opacity = fOpacity / 100;
            
            Application.DoEvents();
            fOpacity -= StepVal;
    
            if (fOpacity <= 0)
            {
                timer1.Stop();
                Close();
            }
        }
    

    Not quite sure how to proceed and any ideas would be great! :)

    C# graphics business tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups