שאלה בVsto בC# איך אפשר להוסיף תמיכה לתוסף שלי עבור דארק מוד
ככה אמור להיראות
וככה זה נראה בדארק מוד. (מה שמפריע בפרט זה שהלחצנים ליד תיבת החיפוש לא ניראים).
שאלה בVsto בC# איך אפשר להוסיף תמיכה לתוסף שלי עבור דארק מוד
ככה אמור להיראות
וככה זה נראה בדארק מוד. (מה שמפריע בפרט זה שהלחצנים ליד תיבת החיפוש לא ניראים).
שיחקתי עם זה קצת והוספתי לו תכונות snap פשוטות (לקצוות של הparentform ולקצוות של אחד לשני)
static class MyDictionary
{
public static List<SizeableUserControl> userControlCollection = new List<SizeableUserControl>();
}
class SizeableUserControl : UserControl
{
Form parentForm;
private const int grab = 16;
public SizeableUserControl(Form form)
{
parentForm = form;
MyDictionary.userControlCollection.Add(this);
this.ResizeRedraw = true;
InitializeComponent();
}
private void InitializeComponent()
{
this.SuspendLayout();
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Name = "SizeableUserControl";
this.Size = new System.Drawing.Size(100, 100);
Panel titleBar = new Panel();
titleBar.Dock = DockStyle.Top;
titleBar.BackColor = Color.White;
titleBar.Height = 20;
Controls.Add(titleBar);
titleBar.MouseDown += TitleBar_MouseDown;
titleBar.MouseMove += TitleBar_MouseMove;
titleBar.MouseUp += TitleBar_MouseUp;
// Minimize button
Button minimizeButton = new Button();
minimizeButton.Text = "─";
minimizeButton.TextAlign = ContentAlignment.MiddleCenter;
minimizeButton.Width = 20;
minimizeButton.Height = 20;
minimizeButton.Dock = DockStyle.Right;
minimizeButton.FlatStyle = FlatStyle.Flat;
minimizeButton.FlatAppearance.BorderSize = 0;
titleBar.Controls.Add(minimizeButton);
minimizeButton.Click += (sender, e) =>
{
if (minimizeButton.Text == "─")
{
minimizeButton.Text = "+";
this.Height = 20;
this.Width = 60;
}
else
{
minimizeButton.Text = "─";
this.Height = 100;
this.Width = 100;
}
};
// Maximize button
Button maximizeButton = new Button();
maximizeButton.Text = "⬜"; // Larger square Unicode character
maximizeButton.TextAlign = ContentAlignment.MiddleCenter;
maximizeButton.Width = 20;
maximizeButton.Height = 20;
maximizeButton.Dock = DockStyle.Right;
maximizeButton.FlatStyle = FlatStyle.Flat;
maximizeButton.FlatAppearance.BorderSize = 0;
// Store the original DockStyle
DockStyle originalDockStyle = DockStyle.None;
maximizeButton.Click += (sender, e) =>
{
if (this.Dock == DockStyle.None)
{
// Maximize the form
originalDockStyle = this.Dock;
this.Dock = DockStyle.Fill;
maximizeButton.Text = "❐"; // Change text to indicate restore
}
else
{
// Restore the original DockStyle
this.Dock = originalDockStyle;
maximizeButton.Text = "⬜"; // Change text to indicate maximize
}
};
titleBar.Controls.Add(maximizeButton);
// X button
Button xButton = new Button();
xButton.Text = "X";
xButton.Dock = DockStyle.Right;
xButton.Width = 20;
xButton.Height = 20;
xButton.FlatStyle = FlatStyle.Flat;
xButton.FlatAppearance.BorderSize = 0;
xButton.Click += (sender, e) => this.Dispose();
titleBar.Controls.Add(xButton);
this.ResumeLayout(false);
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
const int WM_NCHITTEST = 0x84;
const int HT_LEFT = 10;
const int HT_RIGHT = 11;
const int HT_TOP = 12;
const int HT_TOPLEFT = 13;
const int HT_TOPRIGHT = 14;
const int HT_BOTTOM = 15;
const int HT_BOTTOMLEFT = 16;
const int HT_BOTTOMRIGHT = 17;
if (m.Msg == WM_NCHITTEST)
{
var pos = this.PointToClient(new Point(m.LParam.ToInt32()));
if (pos.X <= grab && pos.Y <= grab)
m.Result = new IntPtr(HT_TOPLEFT);
else if (pos.X >= this.ClientSize.Width - grab && pos.Y <= grab)
m.Result = new IntPtr(HT_TOPRIGHT);
else if (pos.X <= grab && pos.Y >= this.ClientSize.Height - grab)
m.Result = new IntPtr(HT_BOTTOMLEFT);
else if (pos.X >= this.ClientSize.Width - grab && pos.Y >= this.ClientSize.Height - grab)
m.Result = new IntPtr(HT_BOTTOMRIGHT);
else if (pos.X <= grab)
m.Result = new IntPtr(HT_LEFT);
else if (pos.X >= this.ClientSize.Width - grab)
m.Result = new IntPtr(HT_RIGHT);
else if (pos.Y <= grab)
m.Result = new IntPtr(HT_TOP);
else if (pos.Y >= this.ClientSize.Height - grab)
m.Result = new IntPtr(HT_BOTTOM);
}
}
bool isMouseDown = false;
private Point mouseDownLocation;
private void TitleBar_MouseUp(object sender, MouseEventArgs e)
{
isMouseDown = false;
}
private void TitleBar_MouseMove(object sender, MouseEventArgs e)
{
if (isMouseDown)
{
// Check proximity on all sides (adjust the threshold as needed)
int proximityThreshold = 10;
// Calculate the new position of the control based on the mouse movement
int newX = this.Left - mouseDownLocation.X + e.X;
int newY = this.Top - mouseDownLocation.Y + e.Y;
// Ensure the new position is within the boundaries of the parent form
newX = Math.Max(0, Math.Min(newX, parentForm.ClientSize.Width - this.Width));
newY = Math.Max(0, Math.Min(newY, parentForm.ClientSize.Height - this.Height));
// Iterate through other controls and check if snapping is possible
foreach (var kvp in MyDictionary.userControlCollection)
{
if (kvp != this)
{
// Check top side
if (Math.Abs(newY - kvp.Bottom) < proximityThreshold)
{
newY = kvp.Bottom + 1;
// Align right and left if they are close enough
if (Math.Abs(newX - kvp.Left) < proximityThreshold)
{
newX = kvp.Left;
}
else if (Math.Abs(newX + this.Width - kvp.Right) < proximityThreshold)
{
newX = kvp.Right - this.Width;
}
}
// Check bottom side
else if (Math.Abs(newY + this.Height - kvp.Top) < proximityThreshold)
{
newY = kvp.Top - this.Height - 1;
// Align right and left if they are close enough
if (Math.Abs(newX - kvp.Left) < proximityThreshold)
{
newX = kvp.Left;
}
else if (Math.Abs(newX + this.Width - kvp.Right) < proximityThreshold)
{
newX = kvp.Right - this.Width;
}
}
// Check left side
if (Math.Abs(newX - kvp.Right) < proximityThreshold)
{
newX = kvp.Right + 1;
// Align tops if they are close enough
if (Math.Abs(newY - kvp.Top) < proximityThreshold)
{
newY = kvp.Top;
}
// Align bottoms if they are close enough
else if (Math.Abs(newY + this.Height - kvp.Bottom) < proximityThreshold)
{
newY = kvp.Bottom - this.Height;
}
}
// Check right side
else if (Math.Abs(newX + this.Width - kvp.Left) < proximityThreshold)
{
newX = kvp.Left - this.Width - 1;
// Align tops if they are close enough
if (Math.Abs(newY - kvp.Top) < proximityThreshold)
{
newY = kvp.Top;
}
// Align bottoms if they are close enough
else if (Math.Abs(newY + this.Height - kvp.Bottom) < proximityThreshold)
{
newY = kvp.Bottom - this.Height;
}
}
}
}
// Snap to parent form edges
if (Math.Abs(newX) < proximityThreshold)
{
newX = 0;
}
else if (Math.Abs(newX + this.Width - parentForm.ClientSize.Width) < proximityThreshold)
{
newX = parentForm.ClientSize.Width - this.Width;
}
if (Math.Abs(newY) < proximityThreshold)
{
newY = 0;
}
else if (Math.Abs(newY + this.Height - parentForm.ClientSize.Height) < proximityThreshold)
{
newY = parentForm.ClientSize.Height - this.Height;
}
this.Location = new Point(newX, newY);
// Forces the control to repaint for a smoother visual experience
this.Invalidate();
}
}
private void TitleBar_MouseDown(object sender, MouseEventArgs e)
{
isMouseDown = true;
mouseDownLocation = e.Location;
}
}
@חגי
צודק אני רואה שהתבלבתי לגמרי. הקוד של דוד הוא מצויין כמו שהוא
הייתי צריך משהו יותר ממוקד מfontdialog המובנה של windows form
אולי למישהו אחר גם יהיה מזה תועלת
יש להוסיף class חדש לפרוייקט להעתיק לתוכו את הקוד כמות שהוא.
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Linq;
public class CustomFontSelectionDialog : Form
{
private ListBox fontListBox;
private Label previewLabel;
private Button okButton;
private TextBox searchBox;
public Font SelectedFont { get; private set; }
public CustomFontSelectionDialog()
{
this.Text = "בחר גופן";
this.Size = new Size(450, 280);
this.RightToLeft = RightToLeft.Yes;
this.RightToLeftLayout = true;
searchBox = new TextBox();
searchBox.Location = new Point(10, 10);
searchBox.Size = new Size(200, 20);
searchBox.TextChanged += SearchBox_TextChanged;
this.Controls.Add(searchBox);
fontListBox = new ListBox();
fontListBox.Location = new Point(10, searchBox.Bottom + 10);
fontListBox.Size = new Size(200, 180);
fontListBox.SelectedIndexChanged += FontListBox_SelectedIndexChanged;
this.Controls.Add(fontListBox);
previewLabel = new Label();
previewLabel.Location = new Point(fontListBox.Right + 10, 10);
previewLabel.Size = new Size(180, this.ClientSize.Height - 2 * 20 - 40); // Adjusted for searchBox and margin
previewLabel.Font = new Font("Arial", 12);
previewLabel.Text = "תצוגה מקדימה"; // Sample Hebrew text for preview
previewLabel.BackColor = Color.White;
this.Controls.Add(previewLabel);
okButton = new Button();
okButton.Text = "אישור";
okButton.Location = new Point(previewLabel.Right - okButton.Width, this.ClientSize.Height - okButton.Height - 20);
okButton.Click += OkButton_Click;
this.Controls.Add(okButton);
// Populate the fontListBox with available fonts
foreach (FontFamily fontFamily in FontFamily.Families)
{
fontListBox.Items.Add(fontFamily.Name);
}
}
private void SearchBox_TextChanged(object sender, EventArgs e)
{
string searchText = searchBox.Text.ToLower(); // Convert search text to lowercase
fontListBox.Items.Clear();
// Filter and display fonts that match the search text (case-insensitive)
foreach (FontFamily fontFamily in FontFamily.Families)
{
if (fontFamily.Name.ToLower().Contains(searchText))
{
fontListBox.Items.Add(fontFamily.Name);
}
}
//fontListBox.SelectedIndex = 0;
}
private void FontListBox_SelectedIndexChanged(object sender, EventArgs e)
{
string selectedFontName = fontListBox.SelectedItem as string;
if (selectedFontName != null)
{
SelectedFont = new Font(selectedFontName, 12); // Set a default size
previewLabel.Font = SelectedFont;
}
}
private void OkButton_Click(object sender, EventArgs e)
{
// The user has selected a font, you can use the SelectedFont property here.
DialogResult = DialogResult.OK;
this.Close();
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new CustomFontSelectionDialog());
}
}
וזה הקוד שלי לפתיחת הבוחר פונטים
שימו לב: אפשר להשתמש עם זה כדי להגדיר פונט בתוכנה שלכם על ידי שימוש ב resources >Settings שם תוכלו להגדיר משתנה שישמור את שם הפונט שהשתמשתם בו כמוצג בקוד דלהלן.
private void chooseFontForBooks_Click(object sender, EventArgs e)
{
using (CustomFontSelectionDialog fontDialog = new CustomFontSelectionDialog())
{
if (fontDialog.ShowDialog() == DialogResult.OK)
{
Properties.Settings.Default.fontName = fontDialog.SelectedFont.Name;
Properties.Settings.Default.Save();
}
}
}
@dovid
לקחת את הרעיון שלי ושיפרת אותו לאין ערוך אין מילים בפי להודות לך. תודה!
@צדיק-תמים כתב במחפש דרך לקבל בקלות את כל הפרקי תהילים והמשניות שיש:
רק שיש שם בעיה עם הקידוד של העברית
הקידוד הוא windows 1255
אפשר לקרוא את הקובץ ככה ואז לשמור מחדש עם איזה קידוד שרק תרצו
@dovid כתב בביצוע פרקטי לאינדוקס מאגר טקסט עברי:
אני צריך ערובה שהשקעתי בתשובה לא תירד לטמיון.
גם מאוד מפריע לי הפיזור שלך בשאלות, זה נראה שאתה בלחץ אטומי. תברר דבר דבר, תעיין תבין ותחכים.
לגבי הערובה אני נמצא במקום של התלמיד כך שהשאלה היא האם התלמיד יכול להגיד לרב שמה שהוא אומר זה יעיל לו או לא? לבינתיים לא איכזבת אז אני מאמין בך. אם נגיע לתוצאות שאפשר להשתמש בהם ברור שאשתמש בזה.
האמת היא שאני עדיין מנסה לעכל את זה שיש פה מישהו שמוכן ככה לעזור בחפשיות (אם לא אשגע אותו מדאי הרבה). VBA הייתי צריך ללמוד לבד והדרך הייתה מפותלת ומעניינת. (היה לי שם חברותא אבל לא "רב").
לחץ אטומי ממש לא - פשוט ככה הראש שלי עובד אני מבין דברים הפוך, לא מההתחלה לסוף אלא מהסוף להתחלה הריכוז שלי ג"כ עובד בצורה מעניינת כלומר שהריכוז שלי מאוד ממוקד - סוג של חפרפרת שפשוט נדבק על משהו עד שהוא מגיע לאשורו (גם הנקיונות שלי לשבת נראים ככה - וזה משגע את אישתי...) (מכיון שראית את התפתחות חלק מהפוסטים שלי אני חושב שאתה יכול לקבל תמונה קצת על מה אני מדבר).
כל זה לא אומר שאני לא יכול לעבוד בצורה מסודרת אם צריך. אשתדל להישאר כאן בפוסט זה ולא לפזר שאלות לכל עבר.
דבר ראשון החיפוש הוא לא הגיוני, הטבלה הרי מכילה מילים בודדות, לא ביטוי (של יותר ממילה).
את זה אני יודע - הבדיקה היתה על חיפוש של מילה אחת כדי לבדוק מהירות שליפה.
לגבי הסימות וכו' הסיבה היא בגלל שאני אוהב לבדוק מקרי קצה לפני שאני נכנס לעובי הקורה. אולי אתה צודק ואי אפשר לשפוט יעילות לפי מקרי קצה. למרות שבפרוייקט שלי השימוש בסיומות וכו' אמור להיות די מצוי.
למעשה עשיתי עכשיו בדיקה ללא הסיומות ולא היה שום הבדל מצד המהירות
command.Parameters.Add(new SQLiteParameter("@searchTerm", searchTerm));
@dovid
אני יודע C# בסיסי (היה גם חלק דברים שתיכנתתי בעצמי בתוסף - רק שמסיבות אישיות אני החלטתי לשים לעצמי גבול כמה אני הולך לתכנת) הבעיה היא ברגע שמתחילים לדבר איתי על מושגים מעולם התיכנות שאני לא נפגשתי בהם בלמידה העצמית שלי. וכל מה שהמתכנת אומר זה (זה מורכב מאוד ונאנח לו ככה)...
גירסה אחרת שמצאתי שעובדת על בסיס קידוד ישיר
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Editor</title>
<style>
body {
background-color: #f0f0f0; /* Light gray background color */
margin: 0;
padding: 0;
}
/* Container for the editor */
.editor-container {
display: flex;
height: 100vh;
margin: 20px; /* Margin around the entire editor */
}
/* Style for the code input textarea */
#codeInput {
flex: 1;
border: 1px solid #ccc;
padding: 10px;
margin-right: 10px; /* Margin between input and output */
}
/* Style for the output frame */
#outputFrame {
flex: 1;
border: 1px solid #ccc;
padding: 10px;
background-color: #f5f5f5; /* Very light gray background color */
}
</style>
</head>
<body>
<div class="editor-container">
<!-- Left Box for Direct Editing -->
<textarea id="codeInput" contenteditable="true"></textarea>
<!-- Right Box for Code Display -->
<iframe id="outputFrame"></iframe>
</div>
<script>
// Get references to the textarea and the outputFrame
const codeInput = document.getElementById('codeInput');
const outputFrame = document.getElementById('outputFrame');
// Function to update the outputFrame with HTML code from codeInput
function updateOutput() {
const code = codeInput.value;
outputFrame.contentDocument.open();
outputFrame.contentDocument.write(code);
outputFrame.contentDocument.close();
}
// Update the output whenever there is a change in the codeInput
codeInput.addEventListener('input', updateOutput);
// You can initially load some sample code into the codeInput if needed
codeInput.value = 'This text will change the formatting in the right box.';
updateOutput(); // Update the output initially
</script>
</body>
</html>
@שוהם307
לא.
אולי עדיף שתשאל בפורום ידיים טובות לא מכיר את הפורום הזה רק יודע שהוא קיים.
@יעקב-מ-פינס
עם ישראל תמיד עסוק בשיפוצים אני לא חושב שיהיה מדאי קשה להשיג איזשהו תריס למי שבאמת רוצה - אם זה רק למחסן....
@YK
תודה רבה! רעיונות מצויינים יישמתי אותם.
@פלורידה
יש הרבה מתכונים לגלידה עם מלח לא מדובר בכמות גדולה כמובן
https://myglida.co.il/12-מתכוני-גלידה-מהירים-ללא-מכונה/
צורת הוולד הן בגוף והן במידותיו משתנה לפי הסביבה שבה ההורים חיים ולפי איפה שהראש שלהם נמצא. כמבואר לגבי הסיפור של מנשה מלך ישראל ובעוד מקומות.
עוד יש לעיין בדברי הגמ' תלמוד בבלי מסכת ברכות דף לא עמוד ב
אם היתה יולדת בצער יולדת בריוח, נקבות - יולדת זכרים, שחורים - יולדת לבנים,
הרי משמע מזה שהיו שחורים ולבנים בעם ישראל מימי קדם.
כמו"כ ידועם דברי רבותינו שלבן הארמי אחיה של רבקה היה "שחור" דהיינו שאפילו השם שלו "לבן" היה שקר.
סליחה על הבורות אבל רציתי לשאול האם נישואי תערובת של שחורים ולבנים מניבים אי פעם ילד לבן? אני לא מדבר על קרם אני מדבר על לבן...
@Whenever כתב בשני גלמודות מסכנות - האם ישנם ארגונים שיכולים להתערב ולעזור במקרים כאלה?:
אני חושב שאפשר לפנות למחקלת רווחה בעירייה.
סליחה על הבורות איך פונים למחלקת הרווחה?
אינני יודע אם זה מקום טוב לשאול את השאלה שלי, בכל אופן אני רוצה לשתף אתכם במצב קשה שמתרחש בבניין שלנו, בתקווה שאולי למישהו כאן יש מידע או ידע כיצד לעזור.
בבניין שלנו מתגוררות שתי נשים מבוגרות ועריריות, שאין להן כל מקור פרנסה. הן חיות בתנאים קשים מאוד, בדירה שהפכה לגרוטאה, ואינן מקבלות כל עזרה או תמיכה מגורם כלשהו.
מצבן הכלכלי קשה מאוד והן מתקשות לנהל את חיי היום-יום. בנוסף, השכנים סובלים מהמצב בגלל צעקות עסיסיות שהן מפנות לכל מי שמנסה לתקשר איתן.
כבר מזמן שהן לא משלמות שכירות, והסיבה שבעלת הבית לא גירשה אותן היא רק בגלל חוק הגנת הדייר. כתגובה, בעלת הבית מנסה להתנקם בהן בכל דרך אפשרית. למשל, לאחרונה הייתה נזילה בדירה ובעלת הבית הביאה פועלים לתקן את הבעיה, אך הם השאירו את כל הרצפה פתוחה והלכו.
האם ישנם ארגונים, עמותות או גורמים ממשלתיים שיכולים להתערב ולעזור במקרים כאלה? כל מידע או הכוונה יתקבלו בברכה.
@פלורידה
אני חושב שאתה טועה כנראה לא חיפשת במקום הנכון

@אהרון-פלדמן
לא ברור לי מה המטרה שלך אבל אם זה בגלל שאתה מחפש מילון בלי חיבור לאינטרנט חשוב שתדע שיש את זה עדיין מובנה בוורד

פירוש קצר על ההגדה - הרעיון הוא לנסות לפרש את ההגדה בצורה רעננה כמות שהיא מבלי להשתמש במדי הרבה וורטים או מקורות חיצוניים.
מצו"ב
נ.ב. יש קצת בעיות עם ההדפסה עם השוליים בגלל המסגרת. אשמח לקבל פתרון לזה
עריכה: יישמתי את ההצעה שנאמרה פה מקווה שזה עזר אין לי כרגע גישה למדפסת
מגיד-חלק-א.docx
עריכה: נוסף חלק ב
מגיד חלק ב.docx
נא להעביר הלאה לזיכוי הרבים