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
C

codemunkeh

@codemunkeh
About
Posts
228
Topics
16
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Well someone had to do it
    C codemunkeh

    If I didn't have a sense of humour I would be cross with you about now.


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge career

  • small, slow memory leak
    C codemunkeh

    "small and slow" are definitely annoying. Sometimes the big ones can be fun, though. I have a side-project which consists of many parts. They all centre around this GDI based display (like a custom powerpoint) and originally I planned to draw to a buffer (Bitmap) from a separate thread and the display would read from that buffer. For performance, there were two buffers and they swapped. Unfortunately I forgot about the whole de-allocation thing and on a 1024x768 display it leaked memory at 50MB/s.


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge performance help

  • swap two values withou using temp. storage
    C codemunkeh

    int x = 450;
    int y = 45;
    Console.WriteLine("X = " + y);
    Console.WriteLine("Y = " + x);

    If you ask me, this fulfils the spec. Edit: oh and this works with strings, numbers, pointers (well maybe not if it's C#), or any datatype at all really.


    Ninja (the Nerd)
    Confused? You will be...

    C / C++ / MFC help

  • Old Monitor
    C codemunkeh

    So, you're walking through the forest with a canoe on your back - but when the wheels fall off: how many pancakes does it take to shingle a doghouse? (Blue because icecream has no bones)


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge

  • World's fastest train
    C codemunkeh

    d@nish wrote:

    There has been some privatization introduced and that will help for sure.

    Isn't that what they said about the UK...


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge question announcement

  • See through phone
    C codemunkeh

    It's so people can read the caller ID while you're on the phone to stop them asking "who's that calling you?"


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge com question discussion

  • Kids these days...
    C codemunkeh

    I use C# in vs08, F7 is my build key and F5 builds automatically anyway. What was that about platform-dependent algorithms?


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge help question c++ database debugging

  • Kids these days...
    C codemunkeh

    F5 Fix Repeat


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge help question c++ database debugging

  • Whats the programmer's slang for when you say "damn"?
    C codemunkeh

    Ian Shlasko wrote:

    That I just held down shift and mashed the number row on my keyboard

    Isn't that how they create regular expressions?


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge asp-net csharp sysadmin question learning

  • var
    C codemunkeh

    UnstableClassInDevelopment.UnStableType.UnderlyingValue obj = new UnstableClassInDevelopment.UnStableType.UnderlyingValue();

    Now, if that underlying value changes type; everything breaks. With var, you don't have to do any search/replace and it works with any reasonable change. Yes, stupid example but I don't even use the thing.


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge csharp com help tutorial

  • var
    C codemunkeh

    Why not just make all your own custom types 7 characters long; and build wrappers around the base classes to make them 7 characters long too?

    QString bork = string.Empty
    QQFloat FHeight = 12.0F

    Really, what I normally do is group the declarations at the top of a class inside a #region Declarations then shrink it when not needed.


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge csharp com help tutorial

  • Programming's Foul Language
    C codemunkeh

    I could've sworn it didn't have it when I used it in .NET 2, odd.. And I meant VB when I said num *= 2. I was trying to highlight my gripe with my last (apparently inaccurate) experience of VB, how it lacks in things I like using. Sorry if that wasn't clear. Edit: definitely my bad. I had somehow confused *= with ++. I tried writing some VB about 5 minutes ago and automatically put ; at the end of every line. :doh:


    Ninja (the Nerd)
    Confused? You will be...

    modified on Wednesday, August 19, 2009 6:23 AM

    The Lounge tutorial question

  • Programming's Foul Language
    C codemunkeh

    You so could write it like that in VB. But it would be tantamount to num *= 2 err I mean num = num * 2 Curses to VB and it's lack of shorthand arithmetic operators!


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge tutorial question

  • Shake Logic.
    C codemunkeh

    Nope, I get it. After many re-reads... :P What's timer1's Interval set to? You could try to determine if the location has changed since the last Tick event. If it hasn't, the drag is over and it should just tidy up/do nothing. I'd try just now, however that sleep I hoped for is beckoning.


    Ninja (the Nerd)
    Confused? You will be...

    C# css help

  • Dissable left click (Only on a trackBar)
    C codemunkeh

    Add an event for MouseDown or MouseUp... You can check against the .Button property of the MouseEventArgs if it's the middle that was pressed. Also: You could use a MouseMove, and compare against the buttons there. So you could drag it around.


    Ninja (the Nerd)
    Confused? You will be...

    C#

  • Shake Logic.
    C codemunkeh

    OK sorry for the previous ludicrous suggestion. I once had a borderless window, and to handle the movement, I had added a button which, when dragged, would take the window with it. I know you're trying to reduce clicks but this could work. MouseDown: - set "moving" to true - store mouse-coords in "lastLoc" - store window position to "startPos" - start a timer MouseMove: - if moving, - move window by delta (current location - lastLoc) - update lastLoc MouseUp: - set "moving" to false - stop the timer - compare startPos with current position, etc.


    Ninja (the Nerd)
    Confused? You will be...

    C# css help

  • Shake Logic.
    C codemunkeh

    ResizeStart will only fire when the user starts to drag the edges (or you use the keyboard "shortcut" of alt+space, s, and arrow keys) and ResizeEnd fires when the user lets go. How to determine whether it was a shake or not, I would judge if the average velocity was, um... If the user was moving it one way then the other then...no, ehh On reflection it might be wiser to simply check if the window is within, say, 20 pixels of it's start location. ResizeStart: note the position, start the timer. ResizeEnd: stop the timer, compare the position, execute the function. Edit. In fact, just ignore this. It's late, I've been coding for several hours. I failed to notice that resize != move. I'll just get my coat and leave...


    Ninja (the Nerd)
    Confused? You will be...

    C# css help

  • Some people have too much time
    C codemunkeh

    Silly! IE6 couldn't rotate half the page at an arbitrary angle.


    Ninja (the Nerd)
    Confused? You will be...

    The Lounge question com help

  • Shake Logic.
    C codemunkeh

    Any notes on the velocity or vigorousness with which the window would get shaken? As for the checking if it was shaken, you may want to check if the window is within X pixels of it's original location. ResizeStart and ResizeEnd should work good.


    Ninja (the Nerd)
    Confused? You will be...

    C# css help

  • Not a horror, but still ugly
    C codemunkeh

    Just wrote this 5 minutes ago... Got a panel that displays a bunch of thumbnails of images. You can highlight these by mousing over them. In the MouseMove event for the panel, I had this... queueHighlight determinines which slide is currently highlighted. queueOffset determines the start position of what is visible. slideHovered is calculated from MouseEventArgs.X based on the thumbnail width.

    if ((slideHovered + queueOffset) != queueHighlight)
    {
    if (queueHighlight != (slideHovered + queueOffset))
    {
    queueHighlight = (ushort)(slideHovered + queueOffset);
    forceRender(HymnMgrTarget.QueueList); // Redraw the panel
    }
    else
    {
    queueHighlight = (ushort)(slideHovered + queueOffset);
    }
    }

    I added the outer block when I first wrote the method. When tweaking it just then, I managed to add the inner if block, and only when I ran it and noticed that nothing had changed, did I realise my error. this.Edit(reason:="oops");


    Ninja (the Nerd)
    Confused? You will be...

    The Weird and The Wonderful question help
  • Login

  • Don't have an account? Register

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