ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2015-05-05 04:49:33

asparatu
Member
Registered: 2014-08-20
Posts: 196

Radio Buttons Question

Hello Jing,
  I want to know, if have a radio button in different cells will it still act the same as it was in the same cell? Why i am asking is because of layout reason. I have as label boxes now i want to have in spreadsheet format. Also, another things is can change the way the radio button looks like because i change the way it looks with an image.

Update:
I see from the documentation you create a radiogroup and make that radio button part of the radiogroup and it will function as one selection even though it is in different cells?

Shane

Last edited by asparatu (2015-05-05 04:54:56)

Offline

#2 2015-05-08 23:31:28

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Radio Buttons Question

Yes a RadioGroup can make all radio cells in the group toggling other else. What is your problem?

Offline

#3 2015-05-09 01:31:26

asparatu
Member
Registered: 2014-08-20
Posts: 196

Re: Radio Buttons Question

Hello Jing,
   What i wanted to know is can I change the way the radio paint event to show different button image? After i posted it seen you could put the radio button in different cells, per your example you had them in one cell.. that was real question was, but i need know if can do this with the radio bottons. That is code i have radio control now. what i am trying to is get rid of all my label boxes and textboxes on the form and replace them with your spreadsheet grid.

shane

do something like this:

  Private Sub radLinear_Paint(sender As Object, e As PaintEventArgs) Handles radLinear.Paint
        RadioChange(sender, e)
    End Sub
      Private Sub RadioChange(sender As Object, e As PaintEventArgs)
        If DirectCast(sender, RadioButton).Checked Then
            e.Graphics.DrawImageUnscaled((My.Resources.TranspartSelectedRadioButton), 0, 0)
        Else
            e.Graphics.DrawImageUnscaled((My.Resources.TranspartUnselectedRadioButton), 0, 0)
        End If
    End Sub

Offline

#4 2015-05-10 10:28:43

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Radio Buttons Question

To do owner drawing by overriding the OnPaint method, there is an example code that contains a class derived from the RadioButtonCell class.

VB.NET:

Class ImageRadioButtonCell
  Inherits RadioButtonCell

  Public Overrides Sub OnPaint(dc As RGDrawingContext)
    If MyBase.ButtonState = Windows.Forms.ButtonState.Checked Then
      dc.Graphics.DrawImageUnscaled(My.Resources.apple, MyBase.Bounds.Location)
    Else
      dc.Graphics.DrawImageUnscaled(My.Resources.banana, MyBase.Bounds.Location)
    End If
  End Sub

End Class

The following code adds the customize radio button cells onto worksheet:

Dim rg As New RadioButtonGroup
sheet("B1") = New Object() {New ImageRadioButtonCell With {.RadioGroup = rg}, "Radio 1"}
sheet("B2") = New Object() {New ImageRadioButtonCell With {.RadioGroup = rg}, "Radio 2"}
sheet("B3") = New Object() {New ImageRadioButtonCell With {.RadioGroup = rg}, "Radio 3"}

Hope this helps.

Offline

#5 2015-05-11 01:26:25

asparatu
Member
Registered: 2014-08-20
Posts: 196

Re: Radio Buttons Question

Hello Jing,
  That does help.. I did not think you could inherit radiobuttoncell object from the control.
Thank you,
Shane

Offline

Board footer

Powered by FluxBB