or
Private blnMoving As Boolean = False
Private MouseDownX As Integer
Private MouseDownY As Integer
Private MovingRect As Rectangle
Private oldRect As Rectangle
Private blnClick As Boolean = False
Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
If e.Button = MouseButtons.Left Then
blnMoving = True
MouseDownX = e.X
MouseDownY = e.Y
MovingRect = New Rectangle(Button1.Location, Button1.Size)
End If
End Sub
Private Sub Button1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseUp
If e.Button = MouseButtons.Left And Not blnClick Then
Button1.Location = Me.PointToClient(New Point(MovingRect.X, MovingRect.Y))
Me.Refresh()
oldRect = oldRect.Empty
blnMoving = False
Else
blnClick = False
blnMoving = False
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
blnClick = True
End Sub
Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
If blnMoving Then
If Not oldRect.IsEmpty Then
ControlPaint.DrawReversibleFrame(MovingRect, Me.BackColor, FrameStyle.Thick)
Button1.Refresh()
End If
Dim temp As Point = Me.PointToScreen(New Point(Button1.Location.X + (e.X - MouseDownX), Button1.Location.Y + (e.Y - MouseDownY)))
MovingRect.X = temp.X
MovingRect.Y = temp.Y
If Me.ClientRectangle.Contains(Me.RectangleToClient(MovingRect)) Then
oldRect = MovingRect
Else
MovingRect = oldRect
End If
ControlPaint.DrawReversibleFrame(MovingRect, SystemColors.Control, FrameStyle.Thick)
End If
End Sub
but my need is form main form if i click button it open one floating form and it contains controls,and form that folating form i need to click the control and drag and drop in main form.And also capture and save the location in form ,if i close application and open again i need to fix button in last time saved x and y axis location, so where i capture the x axis and y axis ? is it possible to capture x axis and y axis in sql server ?,and if i open again is possible to retrive data from sql server and give to controls ?



linePrice = new DataTable();linePrice.Columns.Add("Price", typeof(float));linePrice.Columns.Add("Date", typeof(DateTime));LineSeries lineSeria = new LineSeries();
radChartView1.Series.Add(lineSeria);
lineSeria.ShowLabels = true;lineSeria.LabelFormat = "{0:C}";lineSeria.ValueMember = "Price";lineSeria.CategoryMember = "Date";lineSeria.DataSource = linePrice;DateTimeCategoricalAxis categoricalAxis = new DateTimeCategoricalAxis();categoricalAxis.DateTimeComponent = DateTimeComponent.Day;categoricalAxis.MajorTickInterval = 1;categoricalAxis.PlotMode = AxisPlotMode.BetweenTicks;categoricalAxis.LabelFormat = "{0:dd}.{0:MM}.{0:yyyy}";lineSeria.HorizontalAxis = categoricalAxis;


Private Function GetDummyList() As BindingList(Of RateShockData) Dim l As New BindingList(Of RateShockData) l.Add(New RateShockData("+300", "-13.9")) l.Add(New RateShockData("+200", "-9")) l.Add(New RateShockData("+100", "-3.9")) l.Add(New RateShockData("even", "0")) l.Add(New RateShockData("-100", "-.2")) l.Add(New RateShockData("-200", "1")) l.Add(New RateShockData("-300", "2.2")) Return l End Function Private Function BuildChart() Dim c1 As New RadChartView Dim bs As New BarSeries bs.Name = "Market % Change" bs.ValueMember = "MVPctChange" bs.CategoryMember = "BPChange" bs.DataSource = GetDummyList() c1.Series.Clear() c1.Series.Add(bs) Dim bitM As New Bitmap(c1.Width, c1.Height) c1.DrawToBitmap(bitM, c1.Bounds) Dim imageFileName As String = Guid.NewGuid.ToString + ".jpg" bitM.Save(imageFileName, Drawing.Imaging.ImageFormat.Jpeg) End Function Private Sub RadButton2_Click(sender As Object, e As EventArgs) Handles RadButton2.Click BuildChart() End SubPublic Class RateShockData Property BPChange As String Property MVPctChange As String Public Sub New(bpc As String, mvpc As String) BPChange = bpc MVPctChange = mvpc End SubEnd Classc1.Area.View.Palette = KnownPalette.Grayscale