이건 라이센스가 있는 상용컴포넌트를 사용했을 때의 기록이 남아서입니다.
이 라이센스 부분을 모조리 삭제하시면 해결됩니다.
\Properties 밑에 "licenses.licx"에 들어있는 정보를 모조리 삭제합니다.
and then... 빌드합니다. ^^
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, _ X As Single, Y As Single) If Button And vbRightButton Then ' User right-clicked the list box. PopupMenu mnuListPopup End If End Sub |
Private Sub FG_MouseUp(Button As Integer, Shift As Integer, _ X As Single, Y As Single) If Button And vbRightButton Then ' 과목명 셀을 클릭할 때만 팝업 메뉴를 표시한다. If (FG.MouseRow = 1) And (FG.MouseCol > 1) And (FG.MouseCol < FG.Cols - 2) Then ' 선택한 느낌이 들도록.... FG.Col = FG.MouseCol FG.Row = FG.MouseRow + 1 FG.RowSel = FG.Rows - 1 FG.ColSel = FG.MouseCol ' 팝업 메뉴 표시함. PopupMenu mnuGridPopup End If End If End Sub |
Private Sub mnuInsertColumn_Click() With FG ' insert column Dim str As String str = InputBox("과목명을 입력하세요") If str <> "" Then .Cols = .Cols + 1 ' add column .ColPosition(.Cols - 1) = .Col ' move into place .Cell(flexcpText, 1, .Col) = str .Cell(flexcpAlignment, 1, .Col) = flexAlignCenterCenter .Cell(flexcpText, 0, .Col) = "과목" End If End With End Sub |
Private Sub mnuRemoveColumn_Click() With FG ' delete column .ColPosition(.Col) = .Cols - 1 ' move to right .Cols = .Cols - 1 ' delete column ' 칼럼이 삭제됐으므로 계산을 다시 수행한다. Dim nTotal As Integer Dim dAverage As Single For i = 2 To .Rows - 1 nTotal = .Aggregate(flexSTSum, i, 2, i, .Cols - 3) dAverage = .Aggregate(flexSTAverage, i, 2, i, .Cols - 3) .Cell(flexcpText, i, .Cols - 2) = CStr(nTotal) .Cell(flexcpText, i, .Cols - 1) = Format(dAverage, "#,##.0") Next End With End Sub |
.net Window form에서 컨트롤을 드래그 드롭하는 예제를 보면서 DragEnter와 DragDrop이벤트를 발췌해서 소개한다.
/// <summary>
/// The DragEnter event of the target control fires when the mouse enters
/// a target control during a drag operation, and is used to determine if a drop
/// will be allowed over this control. This generally involves checking the type
/// of data being dragged, the type of effects allowed (copy, move, etc.),
/// and potentially the type and/or the specific instance of the source control that
/// initiated the drag operation.
///
/// This event will fire only if the AllowDrop property of the target control has
/// been set to true.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">A DragEventArgs that contains the event data.</param>
private void listBox1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
// Display some information about the DragDrop information in the
// richTextBox1 control to show some of the information available.
richTextBox1.Text = "Source Control: " + sourceControl.Name +
"\r\nSource Control Type: " + sourceControl.GetType().Name +
"\r\nAllowed Effect: " + e.AllowedEffect +
"\r\nMouse Button: " + mouseButton.ToString() + "\r\n" +
"\r\nAvailable Formats:\r\n";// Data may be available in more than one format, so loop through
// all available formats and display them in richTextBox1.
foreach (string availableFormat in e.Data.GetFormats(true))
{
richTextBox1.Text += "\t" + availableFormat + "\r\n";
}// This control will use any dropped data to add items to the listbox.
// Therefore, only data in a text format will be allowed. Setting the
// autoConvert parameter to true specifies that any data that can be
// converted to a text format is also acceptable.
if (e.Data.GetDataPresent(DataFormats.Text, true))
{
// Some controls in this sample allow both Copy and Move effects.
// If a Move effect is allowed, this implementation assumes a Move
// effect unless the CTRL key was pressed, in which case a Copy
// effect is assumed. This follows standard DragDrop conventions.
if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move && (e.KeyState & ctrlKey) != ctrlKey)
{
// Show the standard Move icon.
e.Effect = DragDropEffects.Move;
}
else
{
// Show the standard Copy icon.
e.Effect = DragDropEffects.Copy;
}
}
}/// <summary>
/// The DragDrop event of the target control fires when a drop actually occurs over
/// the target control. This is where the data being dragged is actually processed.
///
/// This event will fire only if the AllowDrop property of the target control has
/// been set to true.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">A DragEventArgs that contains the event data.</param>
private void listBox1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{// Store the data as a string so that it can be accessed from the
// mnuCopy and mnuMove click events.
sourceData = e.Data.GetData(DataFormats.Text, true).ToString();// If the right mouse button was used, provide a context menu to allow
// the user to select a DragDrop effect. The mouseButton is recorded in the
// MouseDown event of the source control.
if (mouseButton == MouseButtons.Right)
{
// Show a context menu, asking which operation to perform.
// The ProcessData() call is then made in the click event
// of the mnuCopy and mnuMove menu items. Show only those
// menu items that correspond to an allowed effect.
mnuCopy.Visible = ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy);
mnuMove.Visible = ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move);
contextMenu1.Show(listBox1, new Point(20,20));
}
else
{
// Set the deleteSource member field based on the Effect.
// The Effect is preset in the DragEnter event handler.
deleteSource = (e.Effect == DragDropEffects.Move);// The processing of the data is done in a separate call, since
// this is also called from the click event of the contextMenu1 items.
ProcessData();}
}
제곱근을 구하기 위해서는 다음과 같은 공식을 만족합니다.
x = root(a) 라면
x^2 = a 입니다.
따라서 x = a/x가 됩니다.
이에 의해서
임의의 x에 의해서 a의 제곱근 값은
x < root(a) < a/x 거나
a/x < root(a) <x 의 범위에 있게 됩니다.
따라서 a와 a/x의 평균값을 구하는
(a+b)/2 공식을 이용해 x = (x + a/x)/2 의 식을 이용하면
대부분의 수는 10번을 돌기 이전에 루트 값을 구할 수 있습니다.
간단하게 아래 C#으로 코딩해본 소스입니다.
using System;
using System.Collections.Generic;
using System.Text;namespace Sqrt
{
class SqrtMain
{
static double Sqrt(double aa, double xx)
{
try
{
for (int i = 0; i < 10; i++)
Console.WriteLine(xx = (xx + aa / xx) / 2);
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
return xx;
}static void Main(string[] args)
{
Console.WriteLine(Sqrt(2341, 3));
}
}
}