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
  1. Home
  2. General Programming
  3. C#
  4. How to define a bitmap at varible

How to define a bitmap at varible

Scheduled Pinned Locked Moved C#
questioncsharpc++graphicstutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ronenb
    wrote on last edited by
    #1

    hi All, I would like to define at c# a bitmap in a struct Define spesific bit to be use I don't know how to do it at c++ i should define it as typedef struct { unsigned long m_opcode :2; unsigned long m_id :3; unsigned long m_src :4; unsigned long m_address :3; unsigned long m_timer :18; unsigned long m_reserved :1; } WiMAXBlock1HeaderT; how can i define it at C#? thanks ronen

    L L H 3 Replies Last reply
    0
    • R Ronenb

      hi All, I would like to define at c# a bitmap in a struct Define spesific bit to be use I don't know how to do it at c++ i should define it as typedef struct { unsigned long m_opcode :2; unsigned long m_id :3; unsigned long m_src :4; unsigned long m_address :3; unsigned long m_timer :18; unsigned long m_reserved :1; } WiMAXBlock1HeaderT; how can i define it at C#? thanks ronen

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, those are bit fields, not a bitmap. And C# doesn't offer any help at all for doing such things. You could define a struct with public properties that contain code to perform all the bit operations (AND, OR, SHIFT). :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      1 Reply Last reply
      0
      • R Ronenb

        hi All, I would like to define at c# a bitmap in a struct Define spesific bit to be use I don't know how to do it at c++ i should define it as typedef struct { unsigned long m_opcode :2; unsigned long m_id :3; unsigned long m_src :4; unsigned long m_address :3; unsigned long m_timer :18; unsigned long m_reserved :1; } WiMAXBlock1HeaderT; how can i define it at C#? thanks ronen

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        This struct is equal unsigned long variable which is similar to ulong .NET type.But you should define your own logic to extract the members from the variable.This stuff should help.

        Life is a stage and we are all actors!

        1 Reply Last reply
        0
        • R Ronenb

          hi All, I would like to define at c# a bitmap in a struct Define spesific bit to be use I don't know how to do it at c++ i should define it as typedef struct { unsigned long m_opcode :2; unsigned long m_id :3; unsigned long m_src :4; unsigned long m_address :3; unsigned long m_timer :18; unsigned long m_reserved :1; } WiMAXBlock1HeaderT; how can i define it at C#? thanks ronen

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #4

          This looks a little like a BitArray. You might take a look at the documentation MSDN[^], and see if it suits.

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

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