473,785 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The control appereance in a Graphics or Bitmap object.

Have I posted the message to wrong newsgroup?

Or

Does the question is so much strage?

Would someone please kindly direct me to a true newsgroup or resource?

Best Regards
Hamed
"Hamed" <ha***@raymehr. comwrote in message
news:u0******** ******@TK2MSFTN GP04.phx.gbl...
>Is it possible to get a control (e.g. a checkbox) and make a Graphics
object or a Bitmap object of current face of the control?

The control may be hidden under some other forms or its Visible property
may
be set to false. I need to make a Bitmap or Graphics object that holds the
appearance of the control.
Regards
Hamed
"Hamed" <ha***@raymehr. comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
>Hello
I want to implement Sparse property for a ColumnStyle so I need above
functionalit y.

Regards



Aug 14 '06
15 1852
I know VB as well as C#. But the VB code does not show how to make a Bitmap
object from current face of a Control such as a TrackBar, CheckBox, etc.
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:OP******** ******@TK2MSFTN GP05.phx.gbl...
Hamed,

As I said it is not my code, but a quick look in it shows me this. (I have
made two conversions to C# to show how easy it is to read VB as C# the
rest is almost adding some (), {} and the ; and removing the end clauses.

Dim bm As Bitmap
In C# this is
Bitmap bm;

If TypeOf objData Is String Then
Dim fs As New FileStream(objD ata.ToString,
FileMode.Open)
in C# this is
FileStream fs = new FileStream(objD ataToString, FileMode.Open);

bm = CType(Bitmap.Fr omStream(fs), Bitmap)
fs.Close()
Else
Try
bm = ConvertToBitmap (DirectCast(obj Data, Byte()),
78)
Catch
bm = ConvertToBitmap (DirectCast(obj Data, Byte()),
0)
End Try
End If
Dim h As Integer
Dim s As Double

Here is an image converted to a bitmap, so in my idea should using a
bitmap direct not change this code very much. However as I said in other
words already, bitmaps are not my favorite sport.

Cor

"Cor Ligthert [MVP]" <no************ @planet.nlschre ef in bericht
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>Hamed,

Maybe you can find on this page some stuff that can help you. (It is VB
but that is for most people easily to translate in C# stuff, as far as I
could see is there in the code no part of the VB extensions on the
framework used).

http://www.vb-tips.com/dbpages.aspx?...2-d85153e86736

And you were right, you missed the most propitiate newsgroup for this
question.

Microsoft.publ ic.dotnet.frame work.adonet
and the special datagrid newsgroups, but those are mainly inactive.

As I wrote this is not my stuff, Ken is active in the VB newsgroups and
forums, as you ask it there as well, will your question than of course be
answered as well in VB code.

I hope this helps,

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:%2******* ***********@TK2 MSFTNGP05.phx.g bl...
>>>I want to inherit my ColumnStyle from
System.Windo ws.Forms.DataGr idColumnStyle

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2****** ************@TK 2MSFTNGP02.phx. gbl...
Hamed,

It becomes more clear, only there are AFAIK 5 types of Grid's in
dotNet, which one is the one you want to inherit? Not that I know it,
but I know active people in this newsgroup who have done a lot with
this kind of stuff.

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:ue***** *********@TK2MS FTNGP06.phx.gbl ...
Cor
>
I am partially new in using newsgroups. sorry if this bothered you or
any other here. I just wanted to know if I am sending the question to
a wrong place or not. this is the case.
>
Anyway, I try to describe the problem in both threads further:
>
I am developing a ColumnStyle that holds a custom control ( a button
or a numeric up down or something else )
>
I want to make a property that if set to true (I name it Sparse
property) all cells of the grid is painted by the face of that
control. Since we should implement the Paint method, I want to be able
to paint the face of my custom control in the grid.
>
Now what is the solution for the above problem?
>
Regards
>
>
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uI**** ************@TK 2MSFTNGP04.phx. gbl...
>Hamed,
>>
>If you don't get an answer than has repeatly asking why that is no
>result. You see that in these newsgroups many people try to help as
>much as possible. The reason should therefore be in your own
>question .
>>
>There is a chance that nobody (at least for that message me) don't
>understa nd what you are asking.
>>
>Better is than to rephrase your message again in the same thread.
>>
>As well do people avoid persons who don't give any reaction on
>replies, because often people place a question and don't pay any
>attentio n than anymore to the given answers and the work that has
>done by that..
>>
>This kind of messages you write now is without sence and not liked in
>newsgroups , what can give the result that you get not any answer
>anymore.
>>
>I hope this gives some help,
>>
>Cor
>>
>>
>>
>"Hamed" <ha***@raymehr. comschreef in bericht
>news:u5*** ***********@TK2 MSFTNGP03.phx.g bl...
>>Have I posted the message to wrong newsgroup?
>>>
>>Or
>>>
>>Does the question is so much strage?
>>>
>>Would someone please kindly direct me to a true newsgroup or
>>resourc e?
>>>
>>Best Regards
>>Hamed
>>>
>>>
>>"Hamed" <ha***@raymehr. comwrote in message
>>news:u0** ************@TK 2MSFTNGP04.phx. gbl...
>>>>Is it possible to get a control (e.g. a checkbox) and make a
>>>>Graphic s
>>>>objec t or a Bitmap object of current face of the control?
>>>>
>>>The control may be hidden under some other forms or its Visible
>>>proper ty may
>>>be set to false. I need to make a Bitmap or Graphics object that
>>>holds the
>>>appearan ce of the control.
>>>>
>>>>
>>>Regard s
>>>Hamed
>>>>
>>>>
>>>"Hamed " <ha***@raymehr. comwrote in message
>>>news:%2* *************** @TK2MSFTNGP02.p hx.gbl...
>>>>Hello
>>>>>
>>>>>
>>>>I want to implement Sparse property for a ColumnStyle so I need
>>>>above
>>>>functio nality.
>>>>>
>>>>Regar ds
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>




Aug 15 '06 #11
Hamed,

It seems that at least I have the idea where you are after.

Some of what you probably want to use is deep in Win32.
What you call the face is something I call the shape.

Although you can do a lot but doing that very deep is in my idea absolute
not a question for a newsgroup.

This is a simple sample to change the shape of a form.

http://www.vb-tips.com/dbpages.aspx?...8-a2eda88e06ee
Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:uk******** ******@TK2MSFTN GP05.phx.gbl...
>I know VB as well as C#. But the VB code does not show how to make a Bitmap
object from current face of a Control such as a TrackBar, CheckBox, etc.
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:OP******** ******@TK2MSFTN GP05.phx.gbl...
>Hamed,

As I said it is not my code, but a quick look in it shows me this. (I
have made two conversions to C# to show how easy it is to read VB as C#
the rest is almost adding some (), {} and the ; and removing the end
clauses.

Dim bm As Bitmap
In C# this is
Bitmap bm;

If TypeOf objData Is String Then
Dim fs As New FileStream(objD ata.ToString,
FileMode.Ope n)
in C# this is
FileStream fs = new FileStream(objD ataToString, FileMode.Open);

bm = CType(Bitmap.Fr omStream(fs), Bitmap)
fs.Close()
Else
Try
bm = ConvertToBitmap (DirectCast(obj Data, Byte()),
78)
Catch
bm = ConvertToBitmap (DirectCast(obj Data, Byte()),
0)
End Try
End If
Dim h As Integer
Dim s As Double

Here is an image converted to a bitmap, so in my idea should using a
bitmap direct not change this code very much. However as I said in other
words already, bitmaps are not my favorite sport.

Cor

"Cor Ligthert [MVP]" <no************ @planet.nlschre ef in bericht
news:%2******* *********@TK2MS FTNGP06.phx.gbl ...
>>Hamed,

Maybe you can find on this page some stuff that can help you. (It is VB
but that is for most people easily to translate in C# stuff, as far as I
could see is there in the code no part of the VB extensions on the
framework used).

http://www.vb-tips.com/dbpages.aspx?...2-d85153e86736

And you were right, you missed the most propitiate newsgroup for this
question.

Microsoft.pub lic.dotnet.fram ework.adonet
and the special datagrid newsgroups, but those are mainly inactive.

As I wrote this is not my stuff, Ken is active in the VB newsgroups and
forums, as you ask it there as well, will your question than of course
be answered as well in VB code.

I hope this helps,

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:%2****** ************@TK 2MSFTNGP05.phx. gbl...
I want to inherit my ColumnStyle from
System.Wind ows.Forms.DataG ridColumnStyle

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2***** *************@T K2MSFTNGP02.phx .gbl...
Hamed,
>
It becomes more clear, only there are AFAIK 5 types of Grid's in
dotNet, which one is the one you want to inherit? Not that I know it,
but I know active people in this newsgroup who have done a lot with
this kind of stuff.
>
Cor
>
"Hamed" <ha***@raymehr. comschreef in bericht
news:ue**** **********@TK2M SFTNGP06.phx.gb l...
>Cor
>>
>I am partially new in using newsgroups. sorry if this bothered you or
>any other here. I just wanted to know if I am sending the question to
>a wrong place or not. this is the case.
>>
>Anyway, I try to describe the problem in both threads further:
>>
>I am developing a ColumnStyle that holds a custom control ( a button
>or a numeric up down or something else )
>>
>I want to make a property that if set to true (I name it Sparse
>property ) all cells of the grid is painted by the face of that
>control. Since we should implement the Paint method, I want to be
>able to paint the face of my custom control in the grid.
>>
>Now what is the solution for the above problem?
>>
>Regards
>>
>>
>"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
>news:uI*** *************@T K2MSFTNGP04.phx .gbl...
>>Hamed,
>>>
>>If you don't get an answer than has repeatly asking why that is no
>>result. You see that in these newsgroups many people try to help as
>>much as possible. The reason should therefore be in your own
>>questio n.
>>>
>>There is a chance that nobody (at least for that message me) don't
>>understan d what you are asking.
>>>
>>Better is than to rephrase your message again in the same thread.
>>>
>>As well do people avoid persons who don't give any reaction on
>>replies , because often people place a question and don't pay any
>>attenti on than anymore to the given answers and the work that has
>>done by that..
>>>
>>This kind of messages you write now is without sence and not liked
>>in newsgroups, what can give the result that you get not any answer
>>anymore .
>>>
>>I hope this gives some help,
>>>
>>Cor
>>>
>>>
>>>
>>"Hamed" <ha***@raymehr. comschreef in bericht
>>news:u5** ************@TK 2MSFTNGP03.phx. gbl...
>>>Have I posted the message to wrong newsgroup?
>>>>
>>>Or
>>>>
>>>Does the question is so much strage?
>>>>
>>>Would someone please kindly direct me to a true newsgroup or
>>>resource ?
>>>>
>>>Best Regards
>>>Hamed
>>>>
>>>>
>>>"Hamed " <ha***@raymehr. comwrote in message
>>>news:u0* *************@T K2MSFTNGP04.phx .gbl...
>>>>>Is it possible to get a control (e.g. a checkbox) and make a
>>>>>Graphi cs
>>>>>obje ct or a Bitmap object of current face of the control?
>>>>>
>>>>The control may be hidden under some other forms or its Visible
>>>>propert y may
>>>>be set to false. I need to make a Bitmap or Graphics object that
>>>>holds the
>>>>appeara nce of the control.
>>>>>
>>>>>
>>>>Regar ds
>>>>Hamed
>>>>>
>>>>>
>>>>"Hame d" <ha***@raymehr. comwrote in message
>>>>news:%2 *************** *@TK2MSFTNGP02. phx.gbl...
>>>>>Hell o
>>>>>>
>>>>>>
>>>>>I want to implement Sparse property for a ColumnStyle so I need
>>>>>abov e
>>>>>functi onality.
>>>>>>
>>>>>Regard s
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>




Aug 15 '06 #12
Hamed,

This is what i use to create a bitmap from a control:

Private Function _renderImageFro mControl(ByVal control As
System.Windows. Forms.Control) As System.Drawing. Bitmap

' Get this form's Graphics object.
Dim me_gr As System.Drawing. Graphics = control.CreateG raphics()
' Me._axFramerCon trol.CreateGrap hics

' Make a Bitmap to hold the image.
Dim bm As New System.Drawing. Bitmap(control. ClientSize.Widt h,
control.ClientS ize.Height)
Dim bm_gr As System.Drawing. Graphics =
System.Drawing. Graphics.FromIm age(bm)
Dim bm_hdc As IntPtr = bm_gr.GetHdc

' Get the form's hDC. We must do this after
' creating the new Bitmap, which uses me_gr.
Dim me_hdc As IntPtr = me_gr.GetHdc

' BitBlt the form's image onto the Bitmap.
BitBlt(bm_hdc, 0, 0, control.ClientS ize.Width,
control.ClientS ize.Height, me_hdc, 0, 0, SRCCOPY)

me_gr.ReleaseHd c(me_hdc)
bm_gr.ReleaseHd c(bm_hdc)

' Return the result.
Return bm

End Function

Hope this helps.

Cheers,
Rob

Hamed wrote:
Cor

I need simply a sparse property that I want to make in my inherited
DataGridColumnS tyle class

What you mentioned is a DataGrid ColumnStyle that shows images. The code the
I need is to make the bitmap from the control.

Suppose I have a hidden TrackBar that I want to show in the column of the
DataGrid. I want to make a Bitmap object from the TrackBar (that is hidden)
and paint the Bitmap in each cell.
How can I make a Bitmap object from the appereance of the control?
Regards

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
Hamed,

Maybe you can find on this page some stuff that can help you. (It is VB
but that is for most people easily to translate in C# stuff, as far as I
could see is there in the code no part of the VB extensions on the
framework used).

http://www.vb-tips.com/dbpages.aspx?...2-d85153e86736

And you were right, you missed the most propitiate newsgroup for this
question.

Microsoft.publi c.dotnet.framew ork.adonet
and the special datagrid newsgroups, but those are mainly inactive.

As I wrote this is not my stuff, Ken is active in the VB newsgroups and
forums, as you ask it there as well, will your question than of course be
answered as well in VB code.

I hope this helps,

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
>I want to inherit my ColumnStyle from
System.Windows .Forms.DataGrid ColumnStyle

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** **********@TK2M SFTNGP02.phx.gb l...
Hamed,

It becomes more clear, only there are AFAIK 5 types of Grid's in dotNet,
which one is the one you want to inherit? Not that I know it, but I know
active people in this newsgroup who have done a lot with this kind of
stuff.

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:ue******* *******@TK2MSFT NGP06.phx.gbl.. .
Cor

I am partially new in using newsgroups. sorry if this bothered you or
any other here. I just wanted to know if I am sending the question to a
wrong place or not. this is the case.

Anyway, I try to describe the problem in both threads further:

I am developing a ColumnStyle that holds a custom control ( a button or
a numeric up down or something else )

I want to make a property that if set to true (I name it Sparse
property) all cells of the grid is painted by the face of that control.
Since we should implement the Paint method, I want to be able to paint
the face of my custom control in the grid.

Now what is the solution for the above problem?

Regards
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uI****** **********@TK2M SFTNGP04.phx.gb l...
Hamed,

If you don't get an answer than has repeatly asking why that is no
result. You see that in these newsgroups many people try to help as
much as possible. The reason should therefore be in your own question.

There is a chance that nobody (at least for that message me) don't
understand what you are asking.

Better is than to rephrase your message again in the same thread.

As well do people avoid persons who don't give any reaction on
replies, because often people place a question and don't pay any
attention than anymore to the given answers and the work that has done
by that..

This kind of messages you write now is without sence and not liked in
newsgroups , what can give the result that you get not any answer
anymore.

I hope this gives some help,

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:u5***** *********@TK2MS FTNGP03.phx.gbl ...
Have I posted the message to wrong newsgroup?
>
Or
>
Does the question is so much strage?
>
Would someone please kindly direct me to a true newsgroup or
resource?
>
Best Regards
Hamed
>
>
"Hamed" <ha***@raymehr. comwrote in message
news:u0**** **********@TK2M SFTNGP04.phx.gb l...
>>Is it possible to get a control (e.g. a checkbox) and make a
>>Graphic s
>>object or a Bitmap object of current face of the control?
>>
>The control may be hidden under some other forms or its Visible
>property may
>be set to false. I need to make a Bitmap or Graphics object that
>holds the
>appearan ce of the control.
>>
>>
>Regards
>Hamed
>>
>>
>"Hamed" <ha***@raymehr. comwrote in message
>news:%2*** *************@T K2MSFTNGP02.phx .gbl...
>>Hello
>>>
>>>
>>I want to implement Sparse property for a ColumnStyle so I need
>>above
>>functiona lity.
>>>
>>Regards
>>>
>>>
>>
>>
>>
>>
>
>



Aug 15 '06 #13
Thanks Rob.

As I should import it to C#, do you know how can I call BitBlt function in
C#?
"Rob Panosh" <ro********@asd software.comwro te in message
news:11******** *************@h 48g2000cwc.goog legroups.com...
Hamed,

This is what i use to create a bitmap from a control:

Private Function _renderImageFro mControl(ByVal control As
System.Windows. Forms.Control) As System.Drawing. Bitmap

' Get this form's Graphics object.
Dim me_gr As System.Drawing. Graphics = control.CreateG raphics()
' Me._axFramerCon trol.CreateGrap hics

' Make a Bitmap to hold the image.
Dim bm As New System.Drawing. Bitmap(control. ClientSize.Widt h,
control.ClientS ize.Height)
Dim bm_gr As System.Drawing. Graphics =
System.Drawing. Graphics.FromIm age(bm)
Dim bm_hdc As IntPtr = bm_gr.GetHdc

' Get the form's hDC. We must do this after
' creating the new Bitmap, which uses me_gr.
Dim me_hdc As IntPtr = me_gr.GetHdc

' BitBlt the form's image onto the Bitmap.
BitBlt(bm_hdc, 0, 0, control.ClientS ize.Width,
control.ClientS ize.Height, me_hdc, 0, 0, SRCCOPY)

me_gr.ReleaseHd c(me_hdc)
bm_gr.ReleaseHd c(bm_hdc)

' Return the result.
Return bm

End Function

Hope this helps.

Cheers,
Rob

Hamed wrote:
>Cor

I need simply a sparse property that I want to make in my inherited
DataGridColumn Style class

What you mentioned is a DataGrid ColumnStyle that shows images. The code
the
I need is to make the bitmap from the control.

Suppose I have a hidden TrackBar that I want to show in the column of the
DataGrid. I want to make a Bitmap object from the TrackBar (that is
hidden)
and paint the Bitmap in each cell.
How can I make a Bitmap object from the appereance of the control?
Regards

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******* *********@TK2MS FTNGP06.phx.gbl ...
Hamed,

Maybe you can find on this page some stuff that can help you. (It is VB
but that is for most people easily to translate in C# stuff, as far as
I
could see is there in the code no part of the VB extensions on the
framework used).

http://www.vb-tips.com/dbpages.aspx?...2-d85153e86736

And you were right, you missed the most propitiate newsgroup for this
question.

Microsoft.publi c.dotnet.framew ork.adonet
and the special datagrid newsgroups, but those are mainly inactive.

As I wrote this is not my stuff, Ken is active in the VB newsgroups and
forums, as you ask it there as well, will your question than of course
be
answered as well in VB code.

I hope this helps,

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
I want to inherit my ColumnStyle from
System.Window s.Forms.DataGri dColumnStyle

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******* ***********@TK2 MSFTNGP02.phx.g bl...
Hamed,

It becomes more clear, only there are AFAIK 5 types of Grid's in
dotNet,
which one is the one you want to inherit? Not that I know it, but I
know
active people in this newsgroup who have done a lot with this kind of
stuff.

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:ue****** ********@TK2MSF TNGP06.phx.gbl. ..
Cor

I am partially new in using newsgroups. sorry if this bothered you
or
any other here. I just wanted to know if I am sending the question
to a
wrong place or not. this is the case.

Anyway, I try to describe the problem in both threads further:

I am developing a ColumnStyle that holds a custom control ( a button
or
a numeric up down or something else )

I want to make a property that if set to true (I name it Sparse
property) all cells of the grid is painted by the face of that
control.
Since we should implement the Paint method, I want to be able to
paint
the face of my custom control in the grid.

Now what is the solution for the above problem?

Regards
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uI***** ***********@TK2 MSFTNGP04.phx.g bl...
Hamed,
>
If you don't get an answer than has repeatly asking why that is no
result. You see that in these newsgroups many people try to help as
much as possible. The reason should therefore be in your own
question.
>
There is a chance that nobody (at least for that message me) don't
understan d what you are asking.
>
Better is than to rephrase your message again in the same thread.
>
As well do people avoid persons who don't give any reaction on
replies, because often people place a question and don't pay any
attention than anymore to the given answers and the work that has
done
by that..
>
This kind of messages you write now is without sence and not liked
in
newsgroup s, what can give the result that you get not any answer
anymore.
>
I hope this gives some help,
>
Cor
>
>
>
"Hamed" <ha***@raymehr. comschreef in bericht
news:u5**** **********@TK2M SFTNGP03.phx.gb l...
>Have I posted the message to wrong newsgroup?
>>
>Or
>>
>Does the question is so much strage?
>>
>Would someone please kindly direct me to a true newsgroup or
>resource ?
>>
>Best Regards
>Hamed
>>
>>
>"Hamed" <ha***@raymehr. comwrote in message
>news:u0*** ***********@TK2 MSFTNGP04.phx.g bl...
>>>Is it possible to get a control (e.g. a checkbox) and make a
>>>Graphi cs
>>>object or a Bitmap object of current face of the control?
>>>
>>The control may be hidden under some other forms or its Visible
>>propert y may
>>be set to false. I need to make a Bitmap or Graphics object that
>>holds the
>>appearanc e of the control.
>>>
>>>
>>Regards
>>Hamed
>>>
>>>
>>"Hamed" <ha***@raymehr. comwrote in message
>>news:%2** **************@ TK2MSFTNGP02.ph x.gbl...
>>>Hello
>>>>
>>>>
>>>I want to implement Sparse property for a ColumnStyle so I need
>>>above
>>>function ality.
>>>>
>>>Regard s
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>
>




Aug 16 '06 #14
I tried to use it in VB.NET but it seems somehow you should define BitBlt
function in VB.NET too.

"Rob Panosh" <ro********@asd software.comwro te in message
news:11******** *************@h 48g2000cwc.goog legroups.com...
Hamed,

This is what i use to create a bitmap from a control:

Private Function _renderImageFro mControl(ByVal control As
System.Windows. Forms.Control) As System.Drawing. Bitmap

' Get this form's Graphics object.
Dim me_gr As System.Drawing. Graphics = control.CreateG raphics()
' Me._axFramerCon trol.CreateGrap hics

' Make a Bitmap to hold the image.
Dim bm As New System.Drawing. Bitmap(control. ClientSize.Widt h,
control.ClientS ize.Height)
Dim bm_gr As System.Drawing. Graphics =
System.Drawing. Graphics.FromIm age(bm)
Dim bm_hdc As IntPtr = bm_gr.GetHdc

' Get the form's hDC. We must do this after
' creating the new Bitmap, which uses me_gr.
Dim me_hdc As IntPtr = me_gr.GetHdc

' BitBlt the form's image onto the Bitmap.
BitBlt(bm_hdc, 0, 0, control.ClientS ize.Width,
control.ClientS ize.Height, me_hdc, 0, 0, SRCCOPY)

me_gr.ReleaseHd c(me_hdc)
bm_gr.ReleaseHd c(bm_hdc)

' Return the result.
Return bm

End Function

Hope this helps.

Cheers,
Rob

Hamed wrote:
>Cor

I need simply a sparse property that I want to make in my inherited
DataGridColumn Style class

What you mentioned is a DataGrid ColumnStyle that shows images. The code
the
I need is to make the bitmap from the control.

Suppose I have a hidden TrackBar that I want to show in the column of the
DataGrid. I want to make a Bitmap object from the TrackBar (that is
hidden)
and paint the Bitmap in each cell.
How can I make a Bitmap object from the appereance of the control?
Regards

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******* *********@TK2MS FTNGP06.phx.gbl ...
Hamed,

Maybe you can find on this page some stuff that can help you. (It is VB
but that is for most people easily to translate in C# stuff, as far as
I
could see is there in the code no part of the VB extensions on the
framework used).

http://www.vb-tips.com/dbpages.aspx?...2-d85153e86736

And you were right, you missed the most propitiate newsgroup for this
question.

Microsoft.publi c.dotnet.framew ork.adonet
and the special datagrid newsgroups, but those are mainly inactive.

As I wrote this is not my stuff, Ken is active in the VB newsgroups and
forums, as you ask it there as well, will your question than of course
be
answered as well in VB code.

I hope this helps,

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
I want to inherit my ColumnStyle from
System.Window s.Forms.DataGri dColumnStyle

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******* ***********@TK2 MSFTNGP02.phx.g bl...
Hamed,

It becomes more clear, only there are AFAIK 5 types of Grid's in
dotNet,
which one is the one you want to inherit? Not that I know it, but I
know
active people in this newsgroup who have done a lot with this kind of
stuff.

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:ue****** ********@TK2MSF TNGP06.phx.gbl. ..
Cor

I am partially new in using newsgroups. sorry if this bothered you
or
any other here. I just wanted to know if I am sending the question
to a
wrong place or not. this is the case.

Anyway, I try to describe the problem in both threads further:

I am developing a ColumnStyle that holds a custom control ( a button
or
a numeric up down or something else )

I want to make a property that if set to true (I name it Sparse
property) all cells of the grid is painted by the face of that
control.
Since we should implement the Paint method, I want to be able to
paint
the face of my custom control in the grid.

Now what is the solution for the above problem?

Regards
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uI***** ***********@TK2 MSFTNGP04.phx.g bl...
Hamed,
>
If you don't get an answer than has repeatly asking why that is no
result. You see that in these newsgroups many people try to help as
much as possible. The reason should therefore be in your own
question.
>
There is a chance that nobody (at least for that message me) don't
understan d what you are asking.
>
Better is than to rephrase your message again in the same thread.
>
As well do people avoid persons who don't give any reaction on
replies, because often people place a question and don't pay any
attention than anymore to the given answers and the work that has
done
by that..
>
This kind of messages you write now is without sence and not liked
in
newsgroup s, what can give the result that you get not any answer
anymore.
>
I hope this gives some help,
>
Cor
>
>
>
"Hamed" <ha***@raymehr. comschreef in bericht
news:u5**** **********@TK2M SFTNGP03.phx.gb l...
>Have I posted the message to wrong newsgroup?
>>
>Or
>>
>Does the question is so much strage?
>>
>Would someone please kindly direct me to a true newsgroup or
>resource ?
>>
>Best Regards
>Hamed
>>
>>
>"Hamed" <ha***@raymehr. comwrote in message
>news:u0*** ***********@TK2 MSFTNGP04.phx.g bl...
>>>Is it possible to get a control (e.g. a checkbox) and make a
>>>Graphi cs
>>>object or a Bitmap object of current face of the control?
>>>
>>The control may be hidden under some other forms or its Visible
>>propert y may
>>be set to false. I need to make a Bitmap or Graphics object that
>>holds the
>>appearanc e of the control.
>>>
>>>
>>Regards
>>Hamed
>>>
>>>
>>"Hamed" <ha***@raymehr. comwrote in message
>>news:%2** **************@ TK2MSFTNGP02.ph x.gbl...
>>>Hello
>>>>
>>>>
>>>I want to implement Sparse property for a ColumnStyle so I need
>>>above
>>>function ality.
>>>>
>>>Regard s
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>
>




Aug 16 '06 #15
Hamed,

Sorry forgot to include this code:

Private Declare Auto Function BitBlt Lib "gdi32.dll" (ByVal hdcDest
As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal
nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr,
ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As
System.Int32) As Boolean
Private Const SRCCOPY As Integer = &HCC0020
Cheers,
Rob

Hamed wrote:
I tried to use it in VB.NET but it seems somehow you should define BitBlt
function in VB.NET too.

"Rob Panosh" <ro********@asd software.comwro te in message
news:11******** *************@h 48g2000cwc.goog legroups.com...
Hamed,

This is what i use to create a bitmap from a control:

Private Function _renderImageFro mControl(ByVal control As
System.Windows. Forms.Control) As System.Drawing. Bitmap

' Get this form's Graphics object.
Dim me_gr As System.Drawing. Graphics = control.CreateG raphics()
' Me._axFramerCon trol.CreateGrap hics

' Make a Bitmap to hold the image.
Dim bm As New System.Drawing. Bitmap(control. ClientSize.Widt h,
control.ClientS ize.Height)
Dim bm_gr As System.Drawing. Graphics =
System.Drawing. Graphics.FromIm age(bm)
Dim bm_hdc As IntPtr = bm_gr.GetHdc

' Get the form's hDC. We must do this after
' creating the new Bitmap, which uses me_gr.
Dim me_hdc As IntPtr = me_gr.GetHdc

' BitBlt the form's image onto the Bitmap.
BitBlt(bm_hdc, 0, 0, control.ClientS ize.Width,
control.ClientS ize.Height, me_hdc, 0, 0, SRCCOPY)

me_gr.ReleaseHd c(me_hdc)
bm_gr.ReleaseHd c(bm_hdc)

' Return the result.
Return bm

End Function

Hope this helps.

Cheers,
Rob

Hamed wrote:
Cor

I need simply a sparse property that I want to make in my inherited
DataGridColumnS tyle class

What you mentioned is a DataGrid ColumnStyle that shows images. The code
the
I need is to make the bitmap from the control.

Suppose I have a hidden TrackBar that I want to show in the column of the
DataGrid. I want to make a Bitmap object from the TrackBar (that is
hidden)
and paint the Bitmap in each cell.
How can I make a Bitmap object from the appereance of the control?
Regards

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
Hamed,

Maybe you can find on this page some stuff that can help you. (It is VB
but that is for most people easily to translate in C# stuff, as far as
I
could see is there in the code no part of the VB extensions on the
framework used).

http://www.vb-tips.com/dbpages.aspx?...2-d85153e86736

And you were right, you missed the most propitiate newsgroup for this
question.

Microsoft.publi c.dotnet.framew ork.adonet
and the special datagrid newsgroups, but those are mainly inactive.

As I wrote this is not my stuff, Ken is active in the VB newsgroups and
forums, as you ask it there as well, will your question than of course
be
answered as well in VB code.

I hope this helps,

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
I want to inherit my ColumnStyle from
System.Windows .Forms.DataGrid ColumnStyle

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** **********@TK2M SFTNGP02.phx.gb l...
Hamed,

It becomes more clear, only there are AFAIK 5 types of Grid's in
dotNet,
which one is the one you want to inherit? Not that I know it, but I
know
active people in this newsgroup who have done a lot with this kind of
stuff.

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:ue******* *******@TK2MSFT NGP06.phx.gbl.. .
Cor

I am partially new in using newsgroups. sorry if this bothered you
or
any other here. I just wanted to know if I am sending the question
to a
wrong place or not. this is the case.

Anyway, I try to describe the problem in both threads further:

I am developing a ColumnStyle that holds a custom control ( a button
or
a numeric up down or something else )

I want to make a property that if set to true (I name it Sparse
property) all cells of the grid is painted by the face of that
control.
Since we should implement the Paint method, I want to be able to
paint
the face of my custom control in the grid.

Now what is the solution for the above problem?

Regards
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uI****** **********@TK2M SFTNGP04.phx.gb l...
Hamed,

If you don't get an answer than has repeatly asking why that is no
result. You see that in these newsgroups many people try to help as
much as possible. The reason should therefore be in your own
question.

There is a chance that nobody (at least for that message me) don't
understand what you are asking.

Better is than to rephrase your message again in the same thread.

As well do people avoid persons who don't give any reaction on
replies, because often people place a question and don't pay any
attention than anymore to the given answers and the work that has
done
by that..

This kind of messages you write now is without sence and not liked
in
newsgroups , what can give the result that you get not any answer
anymore.

I hope this gives some help,

Cor

"Hamed" <ha***@raymehr. comschreef in bericht
news:u5***** *********@TK2MS FTNGP03.phx.gbl ...
Have I posted the message to wrong newsgroup?
>
Or
>
Does the question is so much strage?
>
Would someone please kindly direct me to a true newsgroup or
resource?
>
Best Regards
Hamed
>
>
"Hamed" <ha***@raymehr. comwrote in message
news:u0**** **********@TK2M SFTNGP04.phx.gb l...
>>Is it possible to get a control (e.g. a checkbox) and make a
>>Graphic s
>>object or a Bitmap object of current face of the control?
>>
>The control may be hidden under some other forms or its Visible
>property may
>be set to false. I need to make a Bitmap or Graphics object that
>holds the
>appearan ce of the control.
>>
>>
>Regards
>Hamed
>>
>>
>"Hamed" <ha***@raymehr. comwrote in message
>news:%2*** *************@T K2MSFTNGP02.phx .gbl...
>>Hello
>>>
>>>
>>I want to implement Sparse property for a ColumnStyle so I need
>>above
>>functiona lity.
>>>
>>Regards
>>>
>>>
>>
>>
>>
>>
>
>


Aug 16 '06 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
6200
by: Sagaert Johan | last post by:
I have made a custom control that draws a rectangle when the mouse is down, and does nothing when the mouse is up. I set/reset a flag in MouseDown/Mouse up and use this to do the drawing in the OnPaint . The recangle draws correct when i press the mouse, but when i release the mouse the background is not restored What should i do in the Onpaint to make sure the background (the form) is restored correctly ? This problem already keeps...
9
7383
by: Kevin | last post by:
I would like to print the panel control. The panel controls contains images and lables. If i can capture as image i can use it for other purposes like Zooming etcc.. Any body have any idea ,,, ?
7
2024
by: Dennis | last post by:
I am trying to implement drawing on a bitmap and using bitblt to transfer it to the control graphics object in the paint event. It seems to draw on the bitmap ok but doesn't get transferred to the control graphics object in the paint event. Any help would be appreciated. Here is my code: public class as mycontrol Private Declare Auto Function BitBlt Lib "GDI32.DLL" (ByVal hdcDest As IntPtr, ByVal nxDest As Integer, ByVal nyDest As...
15
1377
by: Hamed | last post by:
Have I posted the message to wrong newsgroup? Or Does the question is so much strage? Would someone please kindly direct me to a true newsgroup or resource? Best Regards Hamed
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10341
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.